|
AnyCollect
1.1.2
|
#include <SnapInterface.h>


Public Member Functions | |
| SnapInterface () | |
| Construct a new Snap 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 | contollerCollectedMetrics (const Controller &controller, const std::vector< const Metric *> &metrics) override final |
| Function called every time the Controller has collected metrics. More... | |
| bool | contollerShouldStopCollectingMetrics (const Controller &controller) 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 = 1 |
| Snap plugin version. More... | |
| static constexpr std::string_view | appName = "anycollect"sv |
| Snap plugin name. More... | |
Protected Member Functions | |
| void | insertAppPrefixToNamespace (std::vector< std::string > &ns) |
| Inserts plugin name prefix into Snap namespace. More... | |
| void | setConfig (const Plugin::Config &cfg) |
| Configures the plugin and the controller accordingly, unspecified values are reset to default. More... | |
| void | formatName (std::vector< std::string > &name) |
| Formats a metric name to be compatible with Snap requirements. More... | |
| size_t | computeNameKey (const Metric &m) |
| Computes a key based solely on a metric's name. More... | |
| size_t | computeNameKey (const Plugin::Metric &m) |
| Computes a key based solely on a metric's name. More... | |
| Plugin::Metric | convertToSnapMetric (const Metric &metric) |
| Converts a metric object into a Snap metric object. More... | |
Protected Attributes | |
| AnyCollect::Controller | controller_ |
| Controller used to collect statistics. More... | |
| std::map< size_t, Plugin::Metric > | metrics_ |
| Map associating keys to their metric. More... | |
| std::set< size_t > | requestedMetrics_ |
| Array of keys of requested metrics. More... | |
| std::set< size_t > | unwantedMetrics_ |
| Array of keys of non requested metrics. More... | |
| bool | sendAllMetrics_ |
| Whether to send all metrics, regardless of which are requested. More... | |
| std::vector< Plugin::Metric * > | metricsToSend_ |
| Array of pointers to Snap metrics to be sent. More... | |
Static Protected Attributes | |
| static constexpr std::array | appPrefix = {"cfm"sv, "anycollect"sv} |
| Snap metric name prefix. More... | |
| static constexpr std::string_view | configKeyConfigFile = "ConfigFile"sv |
| Snap plugin configuration key. More... | |
| static constexpr std::string_view | configKeySamplingInterval = "SamplingInterval"sv |
| Snap plugin configuration key. More... | |
| static constexpr std::string_view | configKeySendAllMetrics = "SendAllMetrics"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, configKeyMaxCollectDuration, configKeyMaxMetricsBuffer} |
| Array of integer-valued configuration keys. More... | |
| static constexpr std::array | configKeysBool = {configKeySendAllMetrics} |
| Array of boolean-valued configuration keys. More... | |
| static constexpr bool | defaultSendAllMetrics = false |
| 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 = {AnyCollect::Controller::defaultSamplingInterval.count(), SnapInterface::defaultMaxCollectDuration.count(), SnapInterface::defaultMaxMetricsBuffer} |
| Array of integer-valued configuration default values. More... | |
| static constexpr std::array< int, configKeysBool.size()> | configValuesBool = {SnapInterface::defaultSendAllMetrics} |
| Array of boolean-valued configuration default values. More... | |
| static std::hash< std::string > | hasher {} |
| Object used to compute keys (string hashes) More... | |
Definition at line 36 of file SnapInterface.h.
| AnyCollect::SnapInterface::SnapInterface | ( | ) |
Construct a new Snap Interface object.
Definition at line 29 of file SnapInterface.cc.
|
protected |
Computes a key based solely on a metric's name.
| m | the metric to compute the name key |
Definition at line 87 of file SnapInterface.cc.


|
protected |
Computes a key based solely on a metric's name.
| m | the Snap metric to compute the name key |
Definition at line 96 of file SnapInterface.cc.
|
finaloverridevirtual |
Function called every time the Controller has collected metrics.
| controller | the calling Controller |
| metrics | latest collected metrics |
Implements AnyCollect::ControllerDelegate.
Definition at line 190 of file SnapInterface.cc.

|
finaloverridevirtual |
Function called after each iteration to ask the delegate whether the controller should stop collecting metrics.
| controller | the calling Controller |
Implements AnyCollect::ControllerDelegate.
Definition at line 216 of file SnapInterface.cc.
|
protected |
Converts a metric object into a Snap metric object.
| metric | the metric to convert |
Definition at line 103 of file SnapInterface.cc.


|
protected |
Formats a metric name to be compatible with Snap requirements.
| name | name to format |
Definition at line 58 of file SnapInterface.cc.

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

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

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

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

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


|
finaloverride |
Stream metrics to Snap.
Definition at line 182 of file SnapInterface.cc.

|
static |
Snap plugin name.
Definition at line 39 of file SnapInterface.h.
|
staticprotected |
Snap metric name prefix.
Definition at line 42 of file SnapInterface.h.
|
static |
Snap plugin version.
Definition at line 38 of file SnapInterface.h.
|
staticprotected |
Snap plugin configuration key.
Definition at line 43 of file SnapInterface.h.
|
staticprotected |
Snap plugin configuration key.
Definition at line 46 of file SnapInterface.h.
|
staticprotected |
Snap plugin configuration key.
Definition at line 47 of file SnapInterface.h.
|
staticprotected |
Snap plugin configuration key.
Definition at line 44 of file SnapInterface.h.
|
staticprotected |
Array of boolean-valued configuration keys.
Definition at line 49 of file SnapInterface.h.
|
staticprotected |
Snap plugin configuration key.
Definition at line 45 of file SnapInterface.h.
|
staticprotected |
Array of integer-valued configuration keys.
Definition at line 48 of file SnapInterface.h.
|
staticprotected |
Array of boolean-valued configuration default values.
Definition at line 54 of file SnapInterface.h.
|
staticprotected |
Array of integer-valued configuration default values.
Definition at line 53 of file SnapInterface.h.
|
protected |
Controller used to collect statistics.
Definition at line 57 of file SnapInterface.h.
|
staticprotected |
Snap plugin configuration default value.
Definition at line 51 of file SnapInterface.h.
|
staticprotected |
Snap plugin configuration default value.
Definition at line 52 of file SnapInterface.h.
|
staticprotected |
Snap plugin configuration default value.
Definition at line 50 of file SnapInterface.h.
|
staticprotected |
Object used to compute keys (string hashes)
Definition at line 55 of file SnapInterface.h.
|
protected |
Map associating keys to their metric.
Definition at line 58 of file SnapInterface.h.
|
protected |
Array of pointers to Snap metrics to be sent.
Definition at line 62 of file SnapInterface.h.
|
protected |
Array of keys of requested metrics.
Definition at line 59 of file SnapInterface.h.
|
protected |
Whether to send all metrics, regardless of which are requested.
Definition at line 61 of file SnapInterface.h.
|
protected |
Array of keys of non requested metrics.
Definition at line 60 of file SnapInterface.h.