Lightweight 0.20260921.0
Loading...
Searching...
No Matches
Lightweight::SqlStatisticsSnapshot Struct Reference

#include <SqlStatistics.hpp>

Public Member Functions

constexpr SqlOperationStatistics const & operator[] (SqlStatisticsOperation operation) const noexcept
 

Public Attributes

std::array< SqlOperationStatistics, static_cast< std::size_t >(SqlStatisticsOperation::Count)> operations {}
 Per-operation-class counters, indexed by SqlStatisticsOperation.
 
SqlPoolStatistics pool {}
 Connection-pool counters.
 
std::uint64_t connectionsOpened {}
 Number of connections opened.
 
std::uint64_t connectionsClosed {}
 Number of connections closed.
 
std::uint64_t rowsFetched {}
 Total number of rows fetched across all statements.
 
std::uint64_t blockFetches {}
 Number of block-prefetch round-trips (one per SQLFetchScroll that materialized a row block).
 

Detailed Description

An immutable, plain-struct view of everything a SqlStatistics collector has observed.

Deliberately free of any exporter-specific concept: read the fields and feed them to Prometheus, StatsD, a log line, or a test assertion. Obtain one via SqlStatistics::Snapshot.

Note
The snapshot is not atomic as a whole. Individual counters are read with relaxed ordering while other threads may still be recording, so two related counters can disagree by a few samples at the edges. This is intentional: a consistent snapshot would require locking the hot path. Treat the numbers as monotonically-growing observations, not as a transaction.

Definition at line 215 of file SqlStatistics.hpp.

Member Function Documentation

◆ operator[]()

constexpr SqlOperationStatistics const & Lightweight::SqlStatisticsSnapshot::operator[] ( SqlStatisticsOperation  operation) const
inlineconstexprnoexcept

Retrieves the counters for one operation class.

Parameters
operationThe operation class to read.
Returns
A reference to the counters for operation.

Definition at line 239 of file SqlStatistics.hpp.

Member Data Documentation

◆ operations

std::array<SqlOperationStatistics, static_cast<std::size_t>(SqlStatisticsOperation::Count)> Lightweight::SqlStatisticsSnapshot::operations {}

Per-operation-class counters, indexed by SqlStatisticsOperation.

Definition at line 218 of file SqlStatistics.hpp.

◆ pool

SqlPoolStatistics Lightweight::SqlStatisticsSnapshot::pool {}

Connection-pool counters.

Definition at line 221 of file SqlStatistics.hpp.

◆ connectionsOpened

std::uint64_t Lightweight::SqlStatisticsSnapshot::connectionsOpened {}

Number of connections opened.

Definition at line 224 of file SqlStatistics.hpp.

◆ connectionsClosed

std::uint64_t Lightweight::SqlStatisticsSnapshot::connectionsClosed {}

Number of connections closed.

Definition at line 227 of file SqlStatistics.hpp.

◆ rowsFetched

std::uint64_t Lightweight::SqlStatisticsSnapshot::rowsFetched {}

Total number of rows fetched across all statements.

Definition at line 230 of file SqlStatistics.hpp.

◆ blockFetches

std::uint64_t Lightweight::SqlStatisticsSnapshot::blockFetches {}

Number of block-prefetch round-trips (one per SQLFetchScroll that materialized a row block).

Definition at line 233 of file SqlStatistics.hpp.


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