Skip to content

Commit

Permalink
add telemery timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
Miryam-Schwartz committed Nov 26, 2024
1 parent 3eadf12 commit 5ddf255
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interval = 30
message_tag_name =
xdr_mode=False
xdr_ports_types=legacy;aggregated;plane
timeout=60

[fluentd-endpoint]
host =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class UFMTelemetryStreamingConfigParser(ConfigParser):
UFM_TELEMETRY_ENDPOINT_SECTION_XDR_MODE = "xdr_mode"
UFM_TELEMETRY_ENDPOINT_SECTION_XDR_PORTS_TYPE = "xdr_ports_types"
UFM_TELEMETRY_ENDPOINT_SECTION_XDR_PORTS_TYPE_SPLITTER = ";"
UFM_TELEMETRY_ENDPOINT_SECTION_TIMEOUT = "timeout"

FLUENTD_ENDPOINT_SECTION = "fluentd-endpoint"
FLUENTD_ENDPOINT_SECTION_HOST = "host"
Expand Down Expand Up @@ -71,7 +72,11 @@ def get_ufm_telemetry_xdr_ports_types(self):
self.UFM_TELEMETRY_ENDPOINT_SECTION,
self.UFM_TELEMETRY_ENDPOINT_SECTION_XDR_PORTS_TYPE,
"legacy;aggregated;plane")

def get_telemetry_timeout(self):
return self.safe_get_int(None,
self.UFM_TELEMETRY_ENDPOINT_SECTION,
self.UFM_TELEMETRY_ENDPOINT_SECTION_TIMEOUT,
'60')
def get_streaming_interval(self):
return self.get_config_value(None,
self.UFM_TELEMETRY_ENDPOINT_SECTION,
Expand Down
2 changes: 1 addition & 1 deletion plugins/fluentd_telemetry_plugin/src/telemetry_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def get_metrics(self, _host, _port, _url, msg_tag):
url = f'http://{_host}:{_port}/{_url}'
logging.info('Send UFM Telemetry Endpoint Request, Method: GET, URL: %s', url)
try:
response = requests.get(url) # pylint: disable=missing-timeout
response = requests.get(url, timeout=self.config_parser.get_telemetry_timeout()) # pylint: disable=missing-timeout
response.raise_for_status()
actual_content_size = len(response.content)
expected_content_size = int(response.headers.get('Content-Length', actual_content_size))
Expand Down

0 comments on commit 5ddf255

Please sign in to comment.