Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Nov 13, 2024
1 parent 5770df2 commit 4bc6bc2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
18 changes: 10 additions & 8 deletions plugins/fluentd_telemetry_plugin/src/streamer.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ def __init__(self, conf_parser):
self.streaming_metrics_mgr = MonitorStreamingMgr()
self._fluent_sender = None
self.attributes_mngr = TelemetryAttributesManager()
self.telem_parser = TelemetryParser(self.config_parser, self.streaming_metrics_mgr, self.last_streamed_data_sample_per_endpoint, self.attributes_mngr)
self.telem_parser = TelemetryParser(self.config_parser, self.streaming_metrics_mgr,
self.last_streamed_data_sample_per_endpoint,
self.attributes_mngr)
self.init_streaming_attributes()

@property
Expand Down Expand Up @@ -95,7 +97,7 @@ def ufm_telemetry_endpoints(self):
endpoints = []
for i, value in enumerate(hosts):
_is_xdr_mode = Utils.convert_str_to_type(xdr_mode[i], 'boolean')
_url = TelemetryParser._append_filters_to_telemetry_url(
_url = TelemetryParser.append_filters_to_telemetry_url(
urls[i],
_is_xdr_mode,
xdr_ports_types[i].split(self.config_parser.UFM_TELEMETRY_ENDPOINT_SECTION_XDR_PORTS_TYPE_SPLITTER)
Expand Down Expand Up @@ -179,12 +181,12 @@ def init_streaming_attributes(self): # pylint: disable=too-many-locals
telemetry_data = self.telem_parser.get_metrics(_host, _port, _url, _msg_tag)
if telemetry_data:

# CSV format
rows = telemetry_data.split("\n")
if len(rows):
headers = rows[0].split(",")
for attribute in headers:
self.attributes_mngr.add_streaming_attribute(attribute)
# CSV format
rows = telemetry_data.split("\n")
if len(rows):
headers = rows[0].split(",")
for attribute in headers:
self.attributes_mngr.add_streaming_attribute(attribute)

processed_endpoints[endpoint_id] = True
# update the streaming attributes files
Expand Down
6 changes: 3 additions & 3 deletions plugins/fluentd_telemetry_plugin/src/telemetry_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
@date: Nov 13, 2024
"""
import logging
import requests
from typing import List
import requests

from telemetry_constants import UFMTelemetryConstants
from ufm_sdk_tools.src.xdr_utils import PortType,prepare_port_type_http_telemetry_filter
from utils.logger import Logger, LOG_LEVELS
from telemetry_constants import UFMTelemetryConstants
from utils.utils import Utils

class TelemetryParser:
Expand Down Expand Up @@ -49,7 +49,7 @@ def __init__(self, conf_parser, monitor_streaming_mgr, _last_streamed_data_sampl
self.attributes_mngr = attr_mngr

@staticmethod
def _append_filters_to_telemetry_url(url: str, xdr_mode: bool, port_types: List[str]):
def append_filters_to_telemetry_url(url: str, xdr_mode: bool, port_types: List[str]):
"""
This function constructs and appends filter parameters to the given URL if certain conditions are met.
Expand Down

0 comments on commit 4bc6bc2

Please sign in to comment.