Skip to content

Commit

Permalink
move timeout to streaming section
Browse files Browse the repository at this point in the history
  • Loading branch information
Miryam-Schwartz committed Nov 26, 2024
1 parent 331ce56 commit e4a181f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,7 @@
},
"message_tag_name": {
"type": "string"
},
"timeout": {
"type": "integer",
"minimum": 1,
"err_message": "[telemetry-endpoint - timeout] attribute should be an integer greater than 0"
}
}
},
"required": [
"host",
Expand Down Expand Up @@ -125,6 +120,11 @@
},
"enabled": {
"type": "boolean"
},
"telemetry_request_timeout": {
"type": "integer",
"minimum": 1,
"err_message": "[streaming - telemetry_request_timeout] attribute should be an integer greater than 0"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ 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 All @@ -37,6 +36,7 @@ class UFMTelemetryStreamingConfigParser(ConfigParser):
STREAMING_SECTION_STREAM_ONLY_NEW_SAMPLES = "stream_only_new_samples"
STREAMING_SECTION_ENABLE_CACHED_STREAM_ON_TELEMETRY_FAIL = "enable_cached_stream_on_telemetry_fail"
STREAMING_SECTION_ENABLED = "enabled"
STREAMING_SECTION_TELEMETRY_REQUEST_TIMEOUT = "TELEMETRY_REQUEST_TIMEOUT"

META_FIELDS_SECTION = "meta-fields"

Expand Down Expand Up @@ -72,10 +72,10 @@ 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):
def get_streaming_telemetry_request_timeout(self):
return self.safe_get_int(None,
self.UFM_TELEMETRY_ENDPOINT_SECTION,
self.UFM_TELEMETRY_ENDPOINT_SECTION_TIMEOUT,
self.STREAMING_SECTION,
self.STREAMING_SECTION_TELEMETRY_REQUEST_TIMEOUT,
60)
def get_streaming_interval(self):
return self.get_config_value(None,
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, timeout=self.config_parser.get_telemetry_timeout())
response = requests.get(url, timeout=self.config_parser.get_streaming_telemetry_request_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 e4a181f

Please sign in to comment.