|
MetroCollect
2.3.4
|
Interface class between MetricsController and Snap's streaming-collector plugin class. More...
#include <SnapStreamInterface.h>


Classes | |
| struct | MetricsPackage |
| Strcut to store Snap metric objects and metric data to make it faster to send them to Snap. More... | |
Public Member Functions | |
| SnapStreamInterface () | |
| Construct a new Snap Stream Interface object. More... | |
| const Plugin::ConfigPolicy | get_config_policy () override final |
| Returns the plugin configuration keys and default values to Snap. More... | |
| std::vector< Plugin::Metric > | get_metric_types (Plugin::Config cfg) override final |
| Returns all metrics that can be fetched by the plugin to Snap. More... | |
| void | get_metrics_in (std::vector< Plugin::Metric > &metsIn) override final |
| Gets the user's requested metrics from Snap. More... | |
| void | stream_metrics () override final |
| Stream metrics to Snap. More... | |
| void | metricsContollerCollectedMetricsValues (const MetroCollect::MetricsController &metricsController, const MetroCollect::MetricsDiffArray &metricsDiff, const MetroCollect::MetricsDataArray &previousMetrics, const MetroCollect::MetricsDataArray ¤tMetrics) override final |
| Function called every time the MetricsController has collected new values. More... | |
| void | metricsContollerCollectedMetricsStats (const MetroCollect::MetricsController &metricsController, const MetroCollect::MetricsController::MetricsStats &metricsStats) override final |
| Function called every time the MetricsController has computed statistics. More... | |
| bool | metricsContollerShouldStopCollectingMetrics (const MetroCollect::MetricsController &metricsController) override final |
| Function called after each iteration to ask the delegate whether the controller should stop collecting metrics. More... | |
Static Public Attributes | |
| static constexpr int | appVersion = 2 |
| Snap plugin version. More... | |
| static constexpr std::string_view | appName = "metrocollect"sv |
| Snap plugin name. More... | |
Protected Member Functions | |
| void | setConfig (const Plugin::Config &cfg) |
| Configures the plugin and the controller accordingly, unspecified values are reset to default. More... | |
| void | parseSnapMetrics (const std::vector< Plugin::Metric > &metrics) |
| Generate requestedMetrics array from list of Snap metrics. More... | |
| void | insertAppPrefixToNamespace (std::vector< std::string > &ns) |
| Inserts plugin name prefix into Snap namespace. More... | |
| void | createRequestedMetrics (MetricsPackage &package, std::string suffix, std::function< bool(MetroCollect::Statistics::Stats, bool *)> condition) |
| Configures a MetricsPackage object according to requested metrics. More... | |
| void | fillMetricsPackage (MetricsPackage &package) |
| Initializes a MetricsPackage sub-sampling counters. More... | |
| void | sendMetrics (MetricsPackage &package, std::function< void(MetricsPackage::TimedMetrics &)> copyMetrics) |
| Filters and sends metrics form a package to Snap. More... | |
Protected Attributes | |
| MetroCollect::MetricsController | metricsController_ |
| MetricsController used to collect statistics. More... | |
| MetroCollect::MetricsArray< MetroCollect::Statistics::Stats > | requestedMetrics_ |
| Array of requested metrics. More... | |
| size_t | unchangedMetricsTimeout_ |
| Sub-sampling period for constant metrics. More... | |
| MetricsPackage | valuesPackage_ |
| MetricsPackage for metrics from raw counters variations. More... | |
| MetricsPackage | statsPackage_ |
| MetricsPackage for metrics from computed statistics. More... | |
Static Protected Attributes | |
| static constexpr std::array | appPrefix = {"cfm"sv} |
| Snap metric name prefix. More... | |
| static constexpr std::string_view | configKeySendValues = "SendValues"sv |
| Snap plugin configuration key. More... | |
| static constexpr std::string_view | configKeySendStats = "SendStats"sv |
| Snap plugin configuration key. More... | |
| static constexpr std::string_view | configKeySamplingInterval = "SamplingInterval"sv |
| Snap plugin configuration key. More... | |
| static constexpr std::string_view | configKeyProcessingWindowLength = "ProcessingWindowLength"sv |
| Snap plugin configuration key. More... | |
| static constexpr std::string_view | configKeyProcessingWindowOverlap = "ProcessingWindowOverlap"sv |
| Snap plugin configuration key. More... | |
| static constexpr std::string_view | configKeyConvertToUnitsPerSecond = "ConvertToUnitsPerSecond"sv |
| Snap plugin configuration key. More... | |
| static constexpr std::string_view | configKeyUnchangedMetricTimeout = "UnchangedMetricTimeout"sv |
| Snap plugin configuration key. More... | |
| static constexpr std::string_view | configKeyMaxCollectDuration = "MaxCollectDuration"sv |
| Snap plugin configuration key. More... | |
| static constexpr std::string_view | configKeyMaxMetricsBuffer = "MaxMetricsBuffer"sv |
| Snap plugin configuration key. More... | |
| static constexpr std::array | configKeysInt = {configKeySamplingInterval, configKeyProcessingWindowLength, configKeyProcessingWindowOverlap, configKeyUnchangedMetricTimeout, configKeyMaxCollectDuration, configKeyMaxMetricsBuffer} |
| Array of integer-valued configuration keys. More... | |
| static constexpr std::array | configKeysBool = {configKeySendValues, configKeySendStats, configKeyConvertToUnitsPerSecond} |
| Array of boolean-valued configuration keys. More... | |
| static constexpr bool | defaultSendValues = false |
| Snap plugin configuration default value. More... | |
| static constexpr bool | defaultSendStats = true |
| Snap plugin configuration default value. More... | |
| static constexpr size_t | defaultUnchangedMetricTimeout = 300 |
| Snap plugin configuration default value. More... | |
| static constexpr std::chrono::seconds | defaultMaxCollectDuration = 0s |
| Snap plugin configuration default value. More... | |
| static constexpr size_t | defaultMaxMetricsBuffer = 0 |
| Snap plugin configuration default value. More... | |
| static constexpr std::array< int, configKeysInt.size()> | configValuesInt = {MetroCollect::MetricsController::defaultSamplingInterval.count(), MetroCollect::MetricsController::defaultProcessingWindowLength, MetroCollect::MetricsController::defaultProcessingWindowOverlap, SnapStreamInterface::defaultUnchangedMetricTimeout, SnapStreamInterface::defaultMaxCollectDuration.count(), SnapStreamInterface::defaultMaxMetricsBuffer} |
| Array of integer-valued configuration default values. More... | |
| static constexpr std::array< bool, configKeysBool.size()> | configValuesBool = {defaultSendValues, defaultSendStats, MetroCollect::MetricsController::defaultConvertToUnitsPerSecond} |
| Array of boolean-valued configuration default values. More... | |
| static constexpr std::string_view | statNamespaceLastComponent = "value"sv |
| Snap metric name category. More... | |
| static constexpr std::string_view | statNamespaceDescription = "statistic"sv |
| Snap metric name description. More... | |
Interface class between MetricsController and Snap's streaming-collector plugin class.
Definition at line 41 of file SnapStreamInterface.h.
| SnapInterface::SnapStreamInterface::SnapStreamInterface | ( | ) |
Construct a new Snap Stream Interface object.
Definition at line 29 of file SnapStreamInterface.cc.
|
protected |
Configures a MetricsPackage object according to requested metrics.
| package | package to configure |
| suffix | suffix to add to all package's metrics names (generally a statistic name) |
| condition | boolean function specifying whether a requested metric should be included, and whether it is a primary metric |
Definition at line 95 of file SnapStreamInterface.cc.


|
protected |
Initializes a MetricsPackage sub-sampling counters.
| package |
Definition at line 118 of file SnapStreamInterface.cc.

|
finaloverride |
Returns the plugin configuration keys and default values to Snap.
Definition at line 172 of file SnapStreamInterface.cc.

|
finaloverride |
Returns all metrics that can be fetched by the plugin to Snap.
| cfg | incomming Snap configuration values |
Definition at line 190 of file SnapStreamInterface.cc.

|
finaloverride |
Gets the user's requested metrics from Snap.
| metsIn | the user's requested metrics array |
Definition at line 215 of file SnapStreamInterface.cc.

|
protected |
Inserts plugin name prefix into Snap namespace.
| ns | Snap namespace to modify |
Definition at line 91 of file SnapStreamInterface.cc.

|
finaloverridevirtual |
Function called every time the MetricsController has computed statistics.
| metricsController | the calling MetricsController |
| metricsStats | computed statistics |
Implements MetroCollect::MetricsControllerDelegate.
Definition at line 256 of file SnapStreamInterface.cc.

|
finaloverridevirtual |
Function called every time the MetricsController has collected new values.
| metricsController | the calling MetricsController |
| metricsDiff | computed metrics differences |
| previousMetrics | earlier collected metrics |
| currentMetrics | latest collected metrics |
Implements MetroCollect::MetricsControllerDelegate.
Definition at line 245 of file SnapStreamInterface.cc.

|
finaloverridevirtual |
Function called after each iteration to ask the delegate whether the controller should stop collecting metrics.
| metricsController | the calling MetricsController |
Implements MetroCollect::MetricsControllerDelegate.
Definition at line 269 of file SnapStreamInterface.cc.
|
protected |
Generate requestedMetrics array from list of Snap metrics.
| metrics | Snap metrics requested by the user |
Definition at line 69 of file SnapStreamInterface.cc.


|
protected |
Filters and sends metrics form a package to Snap.
| package | metrics to send |
| copyMetrics | function used to copy new metrics into the package |
Definition at line 127 of file SnapStreamInterface.cc.

|
protected |
Configures the plugin and the controller accordingly, unspecified values are reset to default.
| cfg | configuration options to use |
Definition at line 34 of file SnapStreamInterface.cc.


|
finaloverride |
Stream metrics to Snap.
Definition at line 208 of file SnapStreamInterface.cc.

|
static |
Snap plugin name.
Definition at line 44 of file SnapStreamInterface.h.
|
staticprotected |
Snap metric name prefix.
Definition at line 84 of file SnapStreamInterface.h.
|
static |
Snap plugin version.
Definition at line 43 of file SnapStreamInterface.h.
|
staticprotected |
Snap plugin configuration key.
Definition at line 90 of file SnapStreamInterface.h.
|
staticprotected |
Snap plugin configuration key.
Definition at line 92 of file SnapStreamInterface.h.
|
staticprotected |
Snap plugin configuration key.
Definition at line 93 of file SnapStreamInterface.h.
|
staticprotected |
Snap plugin configuration key.
Definition at line 88 of file SnapStreamInterface.h.
|
staticprotected |
Snap plugin configuration key.
Definition at line 89 of file SnapStreamInterface.h.
|
staticprotected |
Snap plugin configuration key.
Definition at line 87 of file SnapStreamInterface.h.
|
staticprotected |
Array of boolean-valued configuration keys.
Definition at line 95 of file SnapStreamInterface.h.
|
staticprotected |
Snap plugin configuration key.
Definition at line 86 of file SnapStreamInterface.h.
|
staticprotected |
Snap plugin configuration key.
Definition at line 85 of file SnapStreamInterface.h.
|
staticprotected |
Array of integer-valued configuration keys.
Definition at line 94 of file SnapStreamInterface.h.
|
staticprotected |
Snap plugin configuration key.
Definition at line 91 of file SnapStreamInterface.h.
|
staticprotected |
Array of boolean-valued configuration default values.
Definition at line 102 of file SnapStreamInterface.h.
|
staticprotected |
Array of integer-valued configuration default values.
Definition at line 101 of file SnapStreamInterface.h.
|
staticprotected |
Snap plugin configuration default value.
Definition at line 99 of file SnapStreamInterface.h.
|
staticprotected |
Snap plugin configuration default value.
Definition at line 100 of file SnapStreamInterface.h.
|
staticprotected |
Snap plugin configuration default value.
Definition at line 97 of file SnapStreamInterface.h.
|
staticprotected |
Snap plugin configuration default value.
Definition at line 96 of file SnapStreamInterface.h.
|
staticprotected |
Snap plugin configuration default value.
Definition at line 98 of file SnapStreamInterface.h.
|
protected |
MetricsController used to collect statistics.
Definition at line 106 of file SnapStreamInterface.h.
|
protected |
Array of requested metrics.
Definition at line 108 of file SnapStreamInterface.h.
|
staticprotected |
Snap metric name description.
Definition at line 104 of file SnapStreamInterface.h.
|
staticprotected |
Snap metric name category.
Definition at line 103 of file SnapStreamInterface.h.
|
protected |
MetricsPackage for metrics from computed statistics.
Definition at line 112 of file SnapStreamInterface.h.
|
protected |
Sub-sampling period for constant metrics.
Definition at line 109 of file SnapStreamInterface.h.
|
protected |
MetricsPackage for metrics from raw counters variations.
Definition at line 111 of file SnapStreamInterface.h.