RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
rtctk::componentFramework::ComponentMetrics Class Reference

Implementation of ComponentMetricsIf. More...

#include <rtctk/componentFramework/componentMetrics.hpp>

Inheritance diagram for rtctk::componentFramework::ComponentMetrics:
rtctk::componentFramework::ComponentMetricsIf

Classes

struct  Parameters
 Runtime parameters. More...
 

Public Types

using CounterTypes
 Defines standard performance counter types:
 
using CounterVariant
 std::variant of pointers to each supported type in CounterTypes.
 
- Public Types inherited from rtctk::componentFramework::ComponentMetricsIf
using CounterTypes
 Defines standard performance counter types:
 
using CounterVariant = typename CounterTypes::CounterVariant
 std::variant of pointers to each supported type in CounterTypes.
 

Public Member Functions

 ComponentMetrics (OldbIf &oldb, DataPointPath oldb_root, RuntimeRepoIf &rtr, DataPointPath rtr_root, log4cplus::Logger logger)
 
 ~ComponentMetrics () noexcept
 Destructor will automatically stop monitoring.
 
void StartMonitoring () override
 Start monitoring and publishing metrics.
 
void StopMonitoring () noexcept override
 Stop monitoring.
 
bool IsMonitoring () noexcept override
 Query whether monitoring is active.
 
void UpdateParams () override
 Reloads parameters.
 
Parameters GetParams ()
 
virtual perfc::ScopedRegistration AddCounter (CounterVariant counter, CounterMetricInfo info) override
 Add a counter to be included in component metrics, identified by its address, together with info to the register.
 
bool RemoveCounter (CounterVariant counter) override
 Remove counter from register.
 
- Public Member Functions inherited from rtctk::componentFramework::ComponentMetricsIf
virtual ~ComponentMetricsIf () noexcept=default
 

Detailed Description

Implementation of ComponentMetricsIf.

Telemetry metrics are published to OLDB using a common root specified during construction:

Member Typedef Documentation

◆ CounterTypes

Defines standard performance counter types:

  • Double without timestamp
  • Unsigned 64bit integer without timestamp.
  • Signed 64bit integer without timestamp.

◆ CounterVariant

std::variant of pointers to each supported type in CounterTypes.

I.e.: std::variant<perfc::CounterDouble*, ...>

Constructor & Destructor Documentation

◆ ComponentMetrics()

rtctk::componentFramework::ComponentMetrics::ComponentMetrics ( OldbIf & oldb,
DataPointPath oldb_root,
RuntimeRepoIf & rtr,
DataPointPath rtr_root,
log4cplus::Logger logger )
explicit
Parameters
oldbInterface used to publish metrics.
oldb_rootPath to the root where all metrics will be published.
rtrInterface used to retrieve configuration.
rtr_rootPath to the root where configuration should live.
loggerLogger instance to use.

◆ ~ComponentMetrics()

rtctk::componentFramework::ComponentMetrics::~ComponentMetrics ( )
noexcept

Destructor will automatically stop monitoring.

Member Function Documentation

◆ AddCounter()

perfc::ScopedRegistration rtctk::componentFramework::ComponentMetrics::AddCounter ( CounterVariant counter,
CounterMetricInfo info )
overridevirtual

Add a counter to be included in component metrics, identified by its address, together with info to the register.

Precondition
counter must point to a valid counter object.
Note
The caller must ensure that the counter is deregistered before the counter is deleted. The returned RAII object aims to facilitate this by unregistering on destruction.
Parameters
counterPointer to any of the supported counter types.
infoA info object to be associated with counter.
Returns
RAII registration management object that automatically deregisters the counter when destroyed (or manually released). When oldb registration fails, this registration is invalid (check with isValid function).
Exceptions
MetricConflictExceptionif counter with same address has already been added before.
MetricConflictExceptionif another counter has been added with the same CounterMetricInfo::GetId().
RtctkExceptionif other exceptions occurs (nested).

Implements rtctk::componentFramework::ComponentMetricsIf.

◆ GetParams()

ComponentMetrics::Parameters rtctk::componentFramework::ComponentMetrics::GetParams ( )

◆ IsMonitoring()

bool rtctk::componentFramework::ComponentMetrics::IsMonitoring ( )
overridevirtualnoexcept

Query whether monitoring is active.

Returns
true if service is currently monitoring and publishing metrics.
false otherwise.

Implements rtctk::componentFramework::ComponentMetricsIf.

◆ RemoveCounter()

bool rtctk::componentFramework::ComponentMetrics::RemoveCounter ( CounterVariant counter)
overridevirtual

Remove counter from register.

Returns
true if counter was found and erased, false otherwise.

Implements rtctk::componentFramework::ComponentMetricsIf.

◆ StartMonitoring()

void rtctk::componentFramework::ComponentMetrics::StartMonitoring ( )
overridevirtual

Start monitoring and publishing metrics.

It has no effect if monitoring is already in-progress.

Synchronous setup in collaboration with parent thread.

Implements rtctk::componentFramework::ComponentMetricsIf.

◆ StopMonitoring()

void rtctk::componentFramework::ComponentMetrics::StopMonitoring ( )
overridevirtualnoexcept

Stop monitoring.

Has no effect if no monitoring is active.

Implements rtctk::componentFramework::ComponentMetricsIf.

◆ UpdateParams()

void rtctk::componentFramework::ComponentMetrics::UpdateParams ( )
overridevirtual

Reloads parameters.

There is no guarantee that parameters are applied synchronously. For example if monitoring is already active an update of polling interval could be applied when scheduling next interval.

Implements rtctk::componentFramework::ComponentMetricsIf.


The documentation for this class was generated from the following files: