Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature #4151551: TFS plugin refactor streamer.py file #278

Merged
merged 20 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Miryam-Schwartz marked this conversation as resolved.
Show resolved Hide resolved

[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')
Miryam-Schwartz marked this conversation as resolved.
Show resolved Hide resolved
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
Miryam-Schwartz marked this conversation as resolved.
Show resolved Hide resolved
response.raise_for_status()
actual_content_size = len(response.content)
expected_content_size = int(response.headers.get('Content-Length', actual_content_size))
Expand Down