Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
Loading...
Searching...
No Matches
kcenon::monitoring::adaptive_scope Class Reference

Adaptive monitoring scope. More...

#include <adaptive_monitor.h>

Collaboration diagram for kcenon::monitoring::adaptive_scope:
Collaboration graph

Public Member Functions

 adaptive_scope (const std::string &name, std::shared_ptr< kcenon::monitoring::metrics_collector > collector, const adaptive_config &config={})
 
 ~adaptive_scope ()
 
 adaptive_scope (const adaptive_scope &)=delete
 
adaptive_scopeoperator= (const adaptive_scope &)=delete
 
 adaptive_scope (adaptive_scope &&other) noexcept
 
adaptive_scopeoperator= (adaptive_scope &&other) noexcept
 
bool is_registered () const
 

Private Attributes

adaptive_monitormonitor_
 
std::string collector_name_
 
bool registered_ {false}
 

Detailed Description

Adaptive monitoring scope.

Definition at line 550 of file adaptive_monitor.h.

Constructor & Destructor Documentation

◆ adaptive_scope() [1/3]

kcenon::monitoring::adaptive_scope::adaptive_scope ( const std::string & name,
std::shared_ptr< kcenon::monitoring::metrics_collector > collector,
const adaptive_config & config = {} )
inline

Definition at line 557 of file adaptive_monitor.h.

560 {}
562 auto result = monitor_->register_collector(name, collector, config);
563 registered_ = result.is_ok() && result.value();
564 }
common::Result< bool > register_collector(const std::string &name, std::shared_ptr< kcenon::monitoring::metrics_collector > collector, const adaptive_config &config={})
Register a collector for adaptive monitoring.
adaptive_monitor & global_adaptive_monitor()
Global adaptive monitor instance.

◆ ~adaptive_scope()

kcenon::monitoring::adaptive_scope::~adaptive_scope ( )
inline

Definition at line 566 of file adaptive_monitor.h.

566 {
567 if (registered_ && monitor_) {
569 }
570 }
common::Result< bool > unregister_collector(const std::string &name)
Unregister a collector.

References collector_name_, monitor_, registered_, and kcenon::monitoring::adaptive_monitor::unregister_collector().

Here is the call graph for this function:

◆ adaptive_scope() [2/3]

kcenon::monitoring::adaptive_scope::adaptive_scope ( const adaptive_scope & )
delete

◆ adaptive_scope() [3/3]

kcenon::monitoring::adaptive_scope::adaptive_scope ( adaptive_scope && other)
inlinenoexcept

Definition at line 577 of file adaptive_monitor.h.

578 : monitor_(other.monitor_)
579 , collector_name_(std::move(other.collector_name_))
580 , registered_(other.registered_) {
581 other.monitor_ = nullptr;
582 other.registered_ = false;
583 }

References kcenon::monitoring::other.

Member Function Documentation

◆ is_registered()

bool kcenon::monitoring::adaptive_scope::is_registered ( ) const
inline

Definition at line 599 of file adaptive_monitor.h.

599{ return registered_; }

References registered_.

Referenced by TEST_F().

Here is the caller graph for this function:

◆ operator=() [1/2]

adaptive_scope & kcenon::monitoring::adaptive_scope::operator= ( adaptive_scope && other)
inlinenoexcept

Definition at line 585 of file adaptive_monitor.h.

585 {
586 if (this != &other) {
587 if (registered_ && monitor_) {
589 }
590 monitor_ = other.monitor_;
591 collector_name_ = std::move(other.collector_name_);
592 registered_ = other.registered_;
593 other.monitor_ = nullptr;
594 other.registered_ = false;
595 }
596 return *this;
597 }

References collector_name_, monitor_, kcenon::monitoring::other, registered_, and kcenon::monitoring::adaptive_monitor::unregister_collector().

Here is the call graph for this function:

◆ operator=() [2/2]

adaptive_scope & kcenon::monitoring::adaptive_scope::operator= ( const adaptive_scope & )
delete

Member Data Documentation

◆ collector_name_

std::string kcenon::monitoring::adaptive_scope::collector_name_
private

Definition at line 553 of file adaptive_monitor.h.

Referenced by operator=(), and ~adaptive_scope().

◆ monitor_

adaptive_monitor* kcenon::monitoring::adaptive_scope::monitor_
private

Definition at line 552 of file adaptive_monitor.h.

Referenced by operator=(), and ~adaptive_scope().

◆ registered_

bool kcenon::monitoring::adaptive_scope::registered_ {false}
private

Definition at line 554 of file adaptive_monitor.h.

554{false};

Referenced by is_registered(), operator=(), and ~adaptive_scope().


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