Lightweight 0.20260921.0
Loading...
Searching...
No Matches
Lightweight::SqlStatisticsScope Class Reference

#include <SqlStatistics.hpp>

Public Member Functions

 SqlStatisticsScope (SqlStatisticsOperation operation) noexcept
 
 SqlStatisticsScope (SqlStatisticsScope const &)=delete
 
SqlStatisticsScope & operator= (SqlStatisticsScope const &)=delete
 
 SqlStatisticsScope (SqlStatisticsScope &&)=delete
 
SqlStatisticsScope & operator= (SqlStatisticsScope &&)=delete
 
void Failed () noexcept
 Marks the timed operation as having failed.
 
void Retried () noexcept
 Records that the timed operation was transparently retried.
 

Detailed Description

RAII scope that times its enclosing region and records it as one operation.

Construct at the top of the region; the destructor records the elapsed time. Call Failed to mark the operation as errored (the destructor still records the latency, so a failing statement contributes to the distribution rather than silently vanishing from it).

Prefer the LIGHTWEIGHT_STATS_SCOPE macro over constructing this directly — it keeps instrumentation call sites uniform, and its destructor's RecordOperation call is itself a no-op whenever collection is runtime-disabled.

Definition at line 410 of file SqlStatistics.hpp.

Constructor & Destructor Documentation

◆ SqlStatisticsScope()

Lightweight::SqlStatisticsScope::SqlStatisticsScope ( SqlStatisticsOperation  operation)
inlineexplicitnoexcept

Starts timing a region.

Parameters
operationThe operation class to record under.

Definition at line 416 of file SqlStatistics.hpp.

◆ ~SqlStatisticsScope()

Lightweight::SqlStatisticsScope::~SqlStatisticsScope ( )
inline

Definition at line 428 of file SqlStatistics.hpp.

Member Function Documentation

◆ Failed()

void Lightweight::SqlStatisticsScope::Failed ( )
inlinenoexcept

Marks the timed operation as having failed.

Definition at line 440 of file SqlStatistics.hpp.

◆ Retried()

void Lightweight::SqlStatisticsScope::Retried ( )
inlinenoexcept

Records that the timed operation was transparently retried.

Definition at line 446 of file SqlStatistics.hpp.


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