Contents ======== * `Contents <#contents>`__ * `EII TimeSeriesProfiler <#eii-timeseriesprofiler>`__ * `Prerequisites <#prerequisites>`__ * `EII TimeSeriesProfiler Mode <#eii-timeseriesprofiler-modes>`__ * `EII TimeSeriesProfiler Configuration <#eii-timeseriesprofiler-configurations>`__ * `Running TimeSeriesProfiler <#running-timeseriesprofiler>`__ EII TimeSeriesProfiler ---------------------- This module calculates the SPS (Samples Per Second) of any EII time-series modules based on the stream published by that respective module. Prerequisites ^^^^^^^^^^^^^ #. TimeSeriesProfiler expects a set of config, interfaces and public or private keys to be present in ETCD as a prerequisite. To achieve this, ensure an entry for TimeSeriesProfiler with its relative path from IEdgeInsights(\ ``[WORK_DIR]/IEdgeInsights/``\ ) directory is set in the time-series.yml file present in build/usecases(\ ``[WORK_DIR]/IEdgeInsights/build/usecases``\ ) directory. Following is an example: .. code-block:: sh AppContexts: - ConfigMgrAgent - Visualizer/multimodal-data-visualization-streaming/eii/ - Visualizer/multimodal-data-visualization/eii - DataStore - Kapacitor - Telegraf - tools/TimeSeriesProfiler #. With the previous pre-requisite done, please run the following command: .. code-block:: sh python3 builder.py -f ./usecases/time-series.yml EII TimeSeriesProfiler Mode ^^^^^^^^^^^^^^^^^^^^^^^^^^^ By default, the EII TimeSeriesProfiler supports "sps" mode. #. SPS mode This mode is enabled by setting the "mode" key in config(\ ``[WORK_DIR]/IEdgeInsights/tools/TimeSeriesProfiler/config.json``\ ) to "sps". This mode calculates the samples per second of any EII module by subscribing to that module's respective stream. .. code-block:: sh "mode": "sps" .. note:: * For running TimeSeriesProfiler in SPS mode, it is recommended to keep PROFILING_MODE set to false in .env(\ ``[WORK_DIR]/IEdgeInsights/build/.env``\ ) for better performance. EII TimeSeriesProfiler Configuration ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #. total_number_of_samples If mode is set to'sps', the average SPS is calculated for the number of samples set by this variable. Setting it to (-1) will run the profiler forever unless terminated by stopping the container TimeSeriesProfiler manually. total_number_of_samples should never be set as (-1) for 'sps' mode. #. export_to_csv Setting this switch to **true** exports csv files for the results obtained in TimeSeriesProfiler. Running TimeSeriesProfiler ^^^^^^^^^^^^^^^^^^^^^^^^^^ * The configuration required to run rfc_classifier.py UDF is as follows: In **Kapacitor config.json(\ ``[WORK_DIR]/IEdgeInsights/Kapacitor/config.json``\ )** , update "task" key as follows: .. code-block:: sh "task": [{ { "tick_script": "rfc_task.tick", "task_name": "random_forest_sample" } }] In **kapacitor.conf(\ ``[WORK_DIR]/IEdgeInsights/Kapacitor/config/kapacitor.conf``\ )** update udf section: .. code-block:: sh [udf.functions.rfc] prog = "python3.7" args = ["-u", "/EII/udfs/rfc_classifier.py"] timeout = "60s" [udf.functions.rfc.env] PYTHONPATH = "/EII/go/src/github.com/influxdata/kapacitor/udf/agent/py/" Keep the config.json(\ ``[WORK_DIR]/IEdgeInsights/tools/TimeSeriesProfiler/config.json``\ ) file as follows: .. code-block:: sh { "config": { "total_number_of_samples": 10, "export_to_csv": "False" }, "interfaces": { "Subscribers": [ { "Name": "default", "Type": "zmq_tcp", "EndPoint": "ia_datastore:65032", "PublisherAppName": "DataStore", "Topics": [ "rfc_results" ] } ] } } In .env(\ ``[WORK_DIR]/IEdgeInsights/build/.env``\ ): Set the profiling mode to true. #. Set environment variables accordingly in config.json(\ ``[WORK_DIR]/IEdgeInsights/tools/TimeSeriesProfiler/config.json``\ ). #. Set the required output stream or streams and the appropriate stream config in the config.json(\ ``[WORK_DIR]/IEdgeInsights/tools/TimeSeriesProfiler/config.json``\ ) file. #. To run this tool in IPC mode, the user must make the following changes to the subscribers interface section of [config.json] (./config.json)**:  .. code-block:: sh { "type": "zmq_ipc", "EndPoint": "/EII/sockets" } #. To provision, build, and run the tool along with the EII time-series recipe or stack, see `README.md `_. #. Run the following command to see the logs: .. code-block:: sh docker logs -f ia_timeseries_profiler