RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
rtctk::componentFramework::ComponentMetricsIf Class Referenceabstract

Component metrics interface. More...

#include <rtctk/componentFramework/componentMetricsIf.hpp>

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

Public Member Functions

virtual ~ComponentMetricsIf () noexcept=default
 
Configuration and control
virtual void StartMonitoring ()=0
 Start monitoring and publishing metrics.
 
virtual void StopMonitoring () noexcept=0
 Stop monitoring.
 
virtual bool IsMonitoring () noexcept=0
 Query whether monitoring is active.
 
virtual void UpdateParams ()=0
 Reloads parameters.
 

Performance Counter Metrics

using CounterTypes
 Defines standard performance counter types:
 
using CounterVariant = typename CounterTypes::CounterVariant
 std::variant of pointers to each supported type in CounterTypes.
 
virtual perfc::ScopedRegistration AddCounter (CounterVariant counter, CounterMetricInfo info)=0
 Add a counter to be included in component metrics, identified by its address, together with info to the register.
 
virtual bool RemoveCounter (CounterVariant counter)=0
 Remove counter from register.
 

Detailed Description

Component metrics interface.

Supports registration and monitoring of component metrics.

Supported types of metrics:

Thread Safety
thread-safe

Member Typedef Documentation

◆ CounterTypes

Initial value:
perfc::CounterTypes<perfc::CounterDouble, perfc::CounterU64, perfc::CounterI64>

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

◆ ~ComponentMetricsIf()

virtual rtctk::componentFramework::ComponentMetricsIf::~ComponentMetricsIf ( )
virtualdefaultnoexcept

Member Function Documentation

◆ AddCounter()

virtual perfc::ScopedRegistration rtctk::componentFramework::ComponentMetricsIf::AddCounter ( CounterVariant counter,
CounterMetricInfo info )
pure virtual

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).

Implemented in rtctk::componentFramework::ComponentMetrics, and rtctk::componentFramework::FakeComponentMetrics.

◆ IsMonitoring()

virtual bool rtctk::componentFramework::ComponentMetricsIf::IsMonitoring ( )
pure virtualnoexcept

Query whether monitoring is active.

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

Implemented in rtctk::componentFramework::ComponentMetrics, and rtctk::componentFramework::FakeComponentMetrics.

◆ RemoveCounter()

virtual bool rtctk::componentFramework::ComponentMetricsIf::RemoveCounter ( CounterVariant counter)
pure virtual

Remove counter from register.

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

Implemented in rtctk::componentFramework::ComponentMetrics, and rtctk::componentFramework::FakeComponentMetrics.

◆ StartMonitoring()

virtual void rtctk::componentFramework::ComponentMetricsIf::StartMonitoring ( )
pure virtual

Start monitoring and publishing metrics.

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

Implemented in rtctk::componentFramework::ComponentMetrics, and rtctk::componentFramework::FakeComponentMetrics.

◆ StopMonitoring()

virtual void rtctk::componentFramework::ComponentMetricsIf::StopMonitoring ( )
pure virtualnoexcept

Stop monitoring.

Has no effect if no monitoring is active.

Implemented in rtctk::componentFramework::ComponentMetrics, and rtctk::componentFramework::FakeComponentMetrics.

◆ UpdateParams()

virtual void rtctk::componentFramework::ComponentMetricsIf::UpdateParams ( )
pure virtual

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.

Implemented in rtctk::componentFramework::ComponentMetrics, and rtctk::componentFramework::FakeComponentMetrics.


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