Skip to content

Commit

Permalink
paramter update and comment
Browse files Browse the repository at this point in the history
  • Loading branch information
nagworld9 committed Oct 11, 2024
1 parent 287c064 commit e0f5b81
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
4 changes: 2 additions & 2 deletions azurelinuxagent/common/protocol/wire.py
Original file line number Diff line number Diff line change
Expand Up @@ -1064,9 +1064,9 @@ def _send_encoded_event(self, provider_id, event_str, flush, encoding='utf8'):

# if it's important event flush, we use less throttle delay(to avoid long delay to complete this operation)) on throttling errors
if flush:
resp = self.call_wireserver(restutil.http_post, uri, data, header, max_retry=3, telemetry_throttle_delay=TELEMETRY_FLUSH_THROTTLE_DELAY_IN_SECONDS)
resp = self.call_wireserver(restutil.http_post, uri, data, header, max_retry=3, throttle_delay=TELEMETRY_FLUSH_THROTTLE_DELAY_IN_SECONDS)
else:
resp = self.call_wireserver(restutil.http_post, uri, data, header, max_retry=3, telemetry_throttle_delay=TELEMETRY_THROTTLE_DELAY_IN_SECONDS)
resp = self.call_wireserver(restutil.http_post, uri, data, header, max_retry=3, throttle_delay=TELEMETRY_THROTTLE_DELAY_IN_SECONDS)
except HttpError as e:
raise ProtocolError("Failed to send events:{0}".format(e))

Expand Down
15 changes: 6 additions & 9 deletions azurelinuxagent/common/utils/restutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def http_request(method,
max_retry=None,
retry_codes=None,
retry_delay=DELAY_IN_SECONDS,
telemetry_throttle_delay=TELEMETRY_THROTTLE_DELAY_IN_SECONDS,
throttle_delay=THROTTLE_DELAY_IN_SECONDS,
redact_data=False,
return_raw_response=False):
"""
Expand Down Expand Up @@ -438,10 +438,7 @@ def http_request(method,
# -- Otherwise, compute a delay that is the product of the next
# item in the Fibonacci series and the initial delay value
if was_throttled:
if _is_telemetry_req(url):
delay = telemetry_throttle_delay
else:
delay = THROTTLE_DELAY_IN_SECONDS
delay = throttle_delay
else:
delay = _compute_delay(retry_attempt=attempt, delay=retry_delay)

Expand Down Expand Up @@ -481,8 +478,8 @@ def http_request(method,
# retry attempts
if _is_throttle_status(resp.status):
was_throttled = True
# Today, THROTTLE_RETRIES set to big number as opposite to slow down the retry attempts
# So, we are not using that for telemetrydata endpoint, instead we are using max_retry that was set in the caller for overall retry attempts
# Today, THROTTLE_RETRIES is set to a large number (26) for retries, as opposed to backing off and attempting fewer retries.
# However, for telemetry calls (due to throttle limit 15 calls per 15 seconds), we use max_retry set by the caller for overall retry attempts instead of THROTTLE_RETRIES.
if not _is_telemetry_req(url):
max_retry = max(max_retry, THROTTLE_RETRIES)
continue
Expand Down Expand Up @@ -579,7 +576,7 @@ def http_post(url,
max_retry=None,
retry_codes=None,
retry_delay=DELAY_IN_SECONDS,
telemetry_throttle_delay=TELEMETRY_THROTTLE_DELAY_IN_SECONDS,
throttle_delay=THROTTLE_DELAY_IN_SECONDS,
timeout=10):

if max_retry is None:
Expand All @@ -593,7 +590,7 @@ def http_post(url,
max_retry=max_retry,
retry_codes=retry_codes,
retry_delay=retry_delay,
telemetry_throttle_delay=telemetry_throttle_delay)
throttle_delay=throttle_delay)


def http_put(url,
Expand Down

0 comments on commit e0f5b81

Please sign in to comment.