Skip to content

Commit

Permalink
Feature #4151551: TFS plugin refactor streamer.py file (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
Miryam-Schwartz authored Nov 27, 2024
1 parent 2507093 commit a31883f
Show file tree
Hide file tree
Showing 9 changed files with 719 additions and 765 deletions.
2 changes: 1 addition & 1 deletion plugins/fluentd_telemetry_plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ Usage
| [fluentd-endpoint.timeout](conf/fluentd_telemetry_plugin.cfg#L9) | True | Timeout in seconds for Fluentd endpoint streaming | 120 |
| [ufm-telemetry-endpoint.host](conf/fluentd_telemetry_plugin.cfg#L2) | True | Hostname or IPv4 or IPv6 for The UFM Telemetry Endpoint | 127.0.0.1 |
| [ufm-telemetry-endpoint.port](conf/fluentd_telemetry_plugin.cfg#L3) | True | Port for The UFM Telemetry Endpoint | 9001 |
| [ufm-telemetry-endpoint.url](conf/fluentd_telemetry_plugin.cfg#L4) | True | URL for The UFM Telemetry Endpoint, for Prometheus format you can use 'metrics' | 'csv/metrics' |
| [ufm-telemetry-endpoint.url](conf/fluentd_telemetry_plugin.cfg#L4) | True | URL for The UFM Telemetry Endpoint. | 'csv/metrics' |
| [ufm-telemetry-endpoint.interval](conf/fluentd_telemetry_plugin.cfg#L13) | True | Streaming interval in seconds | 30 |
| [ufm-telemetry-endpoint.message_tag_name](conf/fluentd_telemetry_plugin.cfg#L10) | False | Message Tag Name for Fluentd endpoint message | ufm-telemetry-endpoint.host:ufm-telemetry-endpoint.port |
| [ufm-telemetry-endpoint.xdr_mode](conf/fluentd_telemetry_plugin.cfg#7) | True | If True for a specific UFM telemetry endpoint, the TFS will start collecting/streaming the configured ports types specified under “xdr_ports_types” | False |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ xdr_mode=False
xdr_ports_types=legacy;aggregated;plane

[fluentd-endpoint]
host =
host =
port = 24225
timeout = 120

Expand All @@ -19,6 +19,7 @@ compressed_streaming = False
stream_only_new_samples = True
enable_cached_stream_on_telemetry_fail = True
enabled = False
telemetry_request_timeout = 60

[logs-config]
logs_file_name = /log/tfs.log
Expand Down
10 changes: 3 additions & 7 deletions plugins/fluentd_telemetry_plugin/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@
# pylint: disable=wrong-import-position
import logging
from web_service import UFMTelemetryFluentdStreamingAPI
from streamer import \
UFMTelemetryStreaming,\
UFMTelemetryStreamingConfigParser,\
UFMTelemetryConstants
from streamer import UFMTelemetryStreaming
from streaming_config_parser import UFMTelemetryStreamingConfigParser
from streaming_scheduler import StreamingScheduler

# pylint: disable=no-name-in-module,import-error
from utils.flask_server import run_api
from utils.args_parser import ArgsParser
from utils.logger import Logger
from utils.utils import Utils

Expand All @@ -46,8 +43,7 @@ def _init_logs(config_parser):
if __name__ == '__main__':

# init app config parser & load config files
args = ArgsParser.parse_args("UFM Telemetry Streaming to fluentd", UFMTelemetryConstants.args_list)
_config_parser = UFMTelemetryStreamingConfigParser(args)
_config_parser = UFMTelemetryStreamingConfigParser()

_init_logs(_config_parser)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,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
Loading

0 comments on commit a31883f

Please sign in to comment.