You are here: Foswiki>FESA Web>Fesa3_501>FESA3ProcessStatisticsWithCMX (17 Dec 2021, DominicDay)Edit Attach

Process Statistics

From FESA3 5.0.1 on process statistics will be available. The CMX-library enabling process statistics (default set and custom) was originally written @CERN.

Process statistics can be used for runtime diagnostics of FESA software.

A default set of statistical values is available per FESA class:
  • host and process information, uptime, ...
  • FESA specific information
    • the number of various requests (get/set/subscription)
    • the state of concurrency layers
    • the number of events
    • the numbers of posted and received notifications/messages
    • statistics on RT/server actions (successful/failed gets/sets)
Custom values for monitoring can be added to the statistics as well. See #Implementation for details.

Monitoring

The statistics and the observed values can be monitored on the same machine using the tool cmx-cmw-reader.

someone@sameMachine: cmw-cmx-reader

someone@sameMachine: watch -n1 cmw-cmx-reader   # run every second

someone@sameMachine: watch -n1 cmw-cmx-reader -n NotificationQ   # watch the Notification Queue metrics

Reading within FESA

An example for how to read a metric from within the same FESA process
#include <fesa-core/Diagnostic/MetricsManager.h> 
#include <fesa-core/Diagnostic/Metric.h> 
ControllerFactory::getInstance().getMetricsManager().getMetric(CONCURRENCY_LAYERS_COMPONENT, "MyLayer::accumulatedEvents").toString()

Implementation

To use custom metrics within a FESA class library consider the following code snippet as an example:

#include <fesa-core/Diagnostic/MetricsManager.h>
const std::string componentName = "MY_COMPONENT";
const std::string myMetricName1 = "MY_METRIC_1";
const std::string myMetricName2 = "MY_METRIC_2";

fesa::MetricsManager &metricsManager = fesa::ControllerFactory::getInstance().getMetricsManager();
static int32_t integer = 32;
static bool boolean = false;
metricsManager.registerMetric(componentName, myMetricName1, integer);
metricsManager.registerMetric(componentName, myMetricName2, boolean);

If a metric is registered with a local variable, the metric will be no longer be available when the variable is out of scope.

https://gitlab.cern.ch/cmx/cmw-cmx/wikis/home
Topic revision: r7 - 17 Dec 2021, DominicDay
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback