Repo-Init
 
Loading...
Searching...
No Matches
BaseServerStats Class Reference

#include <BaseServerStats.hpp>

Inheritance diagram for BaseServerStats:

Protected Member Functions

void initBaseStats (const std::shared_ptr< prometheus::Registry > &reg, const std::string &name)
 
void consumeBaseStats (uint64_t succeeded, uint64_t failed, double processingTime)
 

Private Attributes

prometheus::Summary * _processingTime {nullptr}
 Value of the command processing performance.
 
prometheus::Gauge * _maxProcessingTime {nullptr}
 Maximum value of the command processing performance.
 
prometheus::Gauge * _minProcessingTime {nullptr}
 Minimum value of the command processing performance.
 
prometheus::Counter * _succeededCommand {nullptr}
 Number of succeeded commands.
 
prometheus::Counter * _failedCommand {nullptr}
 Number of failed commands.
 
prometheus::Counter * _totalCommand {nullptr}
 Number of total received commands.
 

Detailed Description

Represents the base statistics for a server.

Definition at line 15 of file BaseServerStats.hpp.

Member Function Documentation

◆ consumeBaseStats()

void BaseServerStats::consumeBaseStats ( uint64_t succeeded,
uint64_t failed,
double processingTime )
protected

Definition at line 46 of file BaseServerStats.cpp.

47{
48 // Command stats
49 _succeededCommand->Increment(static_cast<double>(succeeded));
50 _failedCommand->Increment(static_cast<double>(failed));
51 _totalCommand->Increment(static_cast<double>(succeeded + failed));
52
53 // Performance stats
54 if (processingTime > 0)
55 {
56 _processingTime->Observe(processingTime);
57 _maxProcessingTime->Set(std::max(_maxProcessingTime->Value(), processingTime));
58 _minProcessingTime->Set(std::min(_minProcessingTime->Value(), processingTime));
59 }
60}
prometheus::Counter * _succeededCommand
Number of succeeded commands.
prometheus::Gauge * _minProcessingTime
Minimum value of the command processing performance.
prometheus::Counter * _failedCommand
Number of failed commands.
prometheus::Gauge * _maxProcessingTime
Maximum value of the command processing performance.
prometheus::Counter * _totalCommand
Number of total received commands.
prometheus::Summary * _processingTime
Value of the command processing performance.
Here is the caller graph for this function:

◆ initBaseStats()

void BaseServerStats::initBaseStats ( const std::shared_ptr< prometheus::Registry > & reg,
const std::string & name )
protected

Definition at line 6 of file BaseServerStats.cpp.

7{
8 // Command stats
9 _succeededCommand = &prometheus::BuildCounter()
10 .Name(name + "succeeded_commands")
11 .Help("Number of succeeded commands")
12 .Register(*reg)
13 .Add({});
14 _failedCommand = &prometheus::BuildCounter()
15 .Name(name + "failed_commands")
16 .Help("Number of failed commands")
17 .Register(*reg)
18 .Add({});
19 _totalCommand = &prometheus::BuildCounter()
20 .Name(name + "received_commands")
21 .Help("Number of received commands")
22 .Register(*reg)
23 .Add({});
24
25 // Performance stats
26 _processingTime = &prometheus::BuildSummary()
27 .Name(name + "processing_time")
28 .Help("Command processing performance")
29 .Register(*reg)
30 .Add({}, QUANTILE_DEFAULTS);
31 _maxProcessingTime = &prometheus::BuildGauge()
32 .Name(name + "maximum_processing_time")
33 .Help("Maximum value of the command processing performance")
34 .Register(*reg)
35 .Add({});
36 _minProcessingTime = &prometheus::BuildGauge()
37 .Name(name + "minimum_processing_time")
38 .Help("Minimum value of the command processing performance")
39 .Register(*reg)
40 .Add({});
41
42 // Set defaults
43 _minProcessingTime->Set(std::numeric_limits<int>::max());
44}
#define QUANTILE_DEFAULTS
Here is the caller graph for this function:

Member Data Documentation

◆ _failedCommand

prometheus::Counter* BaseServerStats::_failedCommand {nullptr}
private

Number of failed commands.

Definition at line 21 of file BaseServerStats.hpp.

21{nullptr};

◆ _maxProcessingTime

prometheus::Gauge* BaseServerStats::_maxProcessingTime {nullptr}
private

Maximum value of the command processing performance.

Definition at line 18 of file BaseServerStats.hpp.

18{nullptr};

◆ _minProcessingTime

prometheus::Gauge* BaseServerStats::_minProcessingTime {nullptr}
private

Minimum value of the command processing performance.

Definition at line 19 of file BaseServerStats.hpp.

19{nullptr};

◆ _processingTime

prometheus::Summary* BaseServerStats::_processingTime {nullptr}
private

Value of the command processing performance.

Definition at line 17 of file BaseServerStats.hpp.

17{nullptr};

◆ _succeededCommand

prometheus::Counter* BaseServerStats::_succeededCommand {nullptr}
private

Number of succeeded commands.

Definition at line 20 of file BaseServerStats.hpp.

20{nullptr};

◆ _totalCommand

prometheus::Counter* BaseServerStats::_totalCommand {nullptr}
private

Number of total received commands.

Definition at line 22 of file BaseServerStats.hpp.

22{nullptr};

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