126 void Complete(
bool success, std::uint64_t rows_returned = 0) noexcept;
136 std::chrono::steady_clock::time_point m_started;
137 std::uint64_t m_rows_returned;
163 std::uint64_t RowsReturned() const noexcept;
182 STORMBYTE_FORCE_INLINE operator
std::
string()
const {
215 std::atomic<std::uint64_t> attempts{0};
216 std::atomic<std::uint64_t> successes{0};
217 std::atomic<std::uint64_t> failures{0};
218 std::atomic<std::uint64_t> total_nanoseconds{0};
219 std::atomic<std::uint64_t> minimum_nanoseconds{std::numeric_limits<std::uint64_t>::max()};
220 std::atomic<std::uint64_t> maximum_nanoseconds{0};
230 void RecordOperation(Operation operation,
bool success, std::chrono::nanoseconds elapsed, std::uint64_t rows_returned)
noexcept;
232 std::array<Counter, static_cast<std::size_t>(Operation::Count)> m_operations;
233 std::array<std::atomic<std::uint64_t>,
static_cast<std::size_t
>(BackendEvent::Count)> m_events;
234 std::atomic<std::uint64_t> m_rows_returned;
Abstract backend.
Definition database.hxx:76
Abstract prepared statement.
Definition prepared_stmt.hxx:69
Records one operation and its elapsed time on destruction.
Definition telemetry.hxx:102
OperationScope(OperationScope &&)=delete
Move constructor is deleted.
OperationScope(const OperationScope &)=delete
Copy constructor is deleted.
OperationScope(StormByte::Shared< Telemetry > telemetry, Operation operation) noexcept
void Complete(bool success, std::uint64_t rows_returned=0) noexcept
Record the result and optional returned row count.
Thread-safe cumulative telemetry for one database connection.
Definition telemetry.hxx:96
virtual void RecordEvent(BackendEvent event) noexcept
Telemetry & operator=(const Telemetry &)=delete
Copy assignment is disabled.
Telemetry(Telemetry &&)=delete
Moving counters is disabled.
Telemetry(const Telemetry &)=delete
Copying counters is disabled.
Telemetry & operator=(Telemetry &&)=delete
Move assignment is disabled.
void RecordEvents(BackendEvent event, std::uint64_t count) noexcept
Add a known number of occurrences for one backend event.
BackendEvent
Shared error and warning categories for backend-specific telemetry.
Definition telemetry.hxx:54
@ Warning
Non-fatal warning reported by a backend.
@ Serialization
Transaction serialization conflict.
@ LockTimeout
Lock wait timed out.
@ Io
Storage or transport I/O failure.
@ Constraint
Constraint violation.
@ Other
Backend failure without a narrower category.
@ Deadlock
Deadlock victim or equivalent conflict.
@ Connection
Connection or protocol failure.
@ Busy
Busy, locked, or lock-timeout condition.
Operation
Database operation categories measured by telemetry.
Definition telemetry.hxx:37
@ RollbackTransaction
Explicit and automatic rollback attempts.
@ CommitTransaction
Transaction commit attempts.
@ Disconnect
Disconnect calls.
@ Connect
Connection attempts.
@ PreparedStatement
Prepared-statement execution attempts.
@ Query
Queries that return rows.
@ SilentQuery
Queries that return only success or failure.
@ BeginTransaction
Transaction begin attempts.
@ PrepareStatement
Prepared-statement registration attempts.
@ Count
Number of operation categories.
Root namespace of the StormByte C++ suite.
Immutable view of cumulative metrics for one operation category.
Definition telemetry.hxx:71
std::uint64_t Attempts
Number of recorded attempts.
Definition telemetry.hxx:72
std::uint64_t Failures
Number of failed attempts.
Definition telemetry.hxx:74
std::uint64_t MeanNanoseconds() const noexcept
Mean duration across attempts.
Definition telemetry.hxx:83
std::uint64_t MaximumNanoseconds
Maximum measured duration.
Definition telemetry.hxx:77
std::uint64_t Successes
Number of successful attempts.
Definition telemetry.hxx:73
std::uint64_t TotalNanoseconds
Sum of measured durations.
Definition telemetry.hxx:75
std::uint64_t MinimumNanoseconds
Minimum measured duration, or zero when empty.
Definition telemetry.hxx:76
#define STORMBYTE_DATABASE_PUBLIC
Definition visibility.h:54