Logger System 0.1.3
High-performance C++20 thread-safe logging system with asynchronous capabilities
Loading...
Searching...
No Matches
kcenon::logger::sampling::sampling_stats Struct Reference

Statistics about sampling behavior. More...

#include <sampling_config.h>

Collaboration diagram for kcenon::logger::sampling::sampling_stats:
Collaboration graph

Public Member Functions

double actual_ratio () const
 Calculate the actual sampling ratio.
 
void reset ()
 Reset all statistics.
 

Public Attributes

std::uint64_t total_count = 0
 Total number of log messages considered for sampling.
 
std::uint64_t sampled_count = 0
 Number of messages that passed sampling (were logged)
 
std::uint64_t dropped_count = 0
 Number of messages dropped due to sampling.
 
std::uint64_t bypassed_count = 0
 Number of messages that bypassed sampling (always_log levels)
 
double effective_rate = 1.0
 Current effective sampling rate.
 
bool is_throttling = false
 Whether adaptive sampling is currently reducing the rate.
 

Detailed Description

Statistics about sampling behavior.

Tracks sampling metrics for monitoring and debugging purposes. All counters are thread-safe when accessed through the sampler API.

Since
3.3.0

Definition at line 305 of file sampling_config.h.

Member Function Documentation

◆ actual_ratio()

double kcenon::logger::sampling::sampling_stats::actual_ratio ( ) const
inlinenodiscard

Calculate the actual sampling ratio.

Returns
Ratio of sampled messages to total messages
Examples
/home/runner/work/logger_system/logger_system/include/kcenon/logger/sampling/sampling_config.h.

Definition at line 341 of file sampling_config.h.

341 {
342 if (total_count == 0) {
343 return 1.0;
344 }
345 return static_cast<double>(sampled_count + bypassed_count) /
346 static_cast<double>(total_count);
347 }
std::uint64_t sampled_count
Number of messages that passed sampling (were logged)
std::uint64_t bypassed_count
Number of messages that bypassed sampling (always_log levels)
std::uint64_t total_count
Total number of log messages considered for sampling.

References bypassed_count, sampled_count, and total_count.

◆ reset()

void kcenon::logger::sampling::sampling_stats::reset ( )
inline

Reset all statistics.

Examples
/home/runner/work/logger_system/logger_system/include/kcenon/logger/sampling/sampling_config.h.

Definition at line 352 of file sampling_config.h.

352 {
353 total_count = 0;
354 sampled_count = 0;
355 dropped_count = 0;
356 bypassed_count = 0;
357 effective_rate = 1.0;
358 is_throttling = false;
359 }
std::uint64_t dropped_count
Number of messages dropped due to sampling.
double effective_rate
Current effective sampling rate.
bool is_throttling
Whether adaptive sampling is currently reducing the rate.

References bypassed_count, dropped_count, effective_rate, is_throttling, sampled_count, and total_count.

Member Data Documentation

◆ bypassed_count

std::uint64_t kcenon::logger::sampling::sampling_stats::bypassed_count = 0

Number of messages that bypassed sampling (always_log levels)

Examples
/home/runner/work/logger_system/logger_system/include/kcenon/logger/sampling/sampling_config.h.

Definition at line 324 of file sampling_config.h.

Referenced by actual_ratio(), kcenon::logger::sampling::log_sampler::get_stats(), and reset().

◆ dropped_count

std::uint64_t kcenon::logger::sampling::sampling_stats::dropped_count = 0

◆ effective_rate

double kcenon::logger::sampling::sampling_stats::effective_rate = 1.0

Current effective sampling rate.

May differ from configured rate when adaptive sampling is active

Examples
/home/runner/work/logger_system/logger_system/include/kcenon/logger/sampling/sampling_config.h.

Definition at line 330 of file sampling_config.h.

Referenced by kcenon::logger::sampling::log_sampler::get_stats(), and reset().

◆ is_throttling

bool kcenon::logger::sampling::sampling_stats::is_throttling = false

Whether adaptive sampling is currently reducing the rate.

Examples
/home/runner/work/logger_system/logger_system/include/kcenon/logger/sampling/sampling_config.h.

Definition at line 335 of file sampling_config.h.

Referenced by kcenon::logger::sampling::log_sampler::get_stats(), and reset().

◆ sampled_count

std::uint64_t kcenon::logger::sampling::sampling_stats::sampled_count = 0

◆ total_count

std::uint64_t kcenon::logger::sampling::sampling_stats::total_count = 0

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