128 void Complete(
bool success, std::uint64_t rows_returned = 0) noexcept;
138 std::chrono::microseconds m_started;
139 bool m_clock_started;
140 std::uint64_t m_rows_returned;
166 std::uint64_t RowsReturned() const noexcept;
179 virtual operator
StormByte::Safe::String() const override;
185 STORMBYTE_FORCE_INLINE operator
std::
string()
const {
213 mutable std::array<StormByte::ThreadLock, static_cast<std::size_t>(Operation::Count)> m_clock_locks;
220 std::atomic<std::uint64_t> successes{0};
221 std::atomic<std::uint64_t> failures{0};
222 std::atomic<std::uint64_t> minimum_nanoseconds{std::numeric_limits<std::uint64_t>::max()};
223 std::atomic<std::uint64_t> maximum_nanoseconds{0};
233 void RecordOperation(Operation operation,
bool success, std::chrono::nanoseconds elapsed, std::uint64_t rows_returned)
noexcept;
235 std::array<Counter, static_cast<std::size_t>(Operation::Count)> m_operations;
236 std::array<std::atomic<std::uint64_t>,
static_cast<std::size_t
>(BackendEvent::Count)> m_events;
237 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:104
OperationScope(StormByte::Safe::Shared< Telemetry > telemetry, Operation operation) noexcept
OperationScope(OperationScope &&)=delete
Move constructor is deleted.
OperationScope(const OperationScope &)=delete
Copy constructor is deleted.
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:98
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:56
@ 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:39
@ 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:73
std::uint64_t Attempts
Number of recorded attempts.
Definition telemetry.hxx:74
std::uint64_t Failures
Number of failed attempts.
Definition telemetry.hxx:76
std::uint64_t MeanNanoseconds() const noexcept
Mean duration across attempts.
Definition telemetry.hxx:85
std::uint64_t MaximumNanoseconds
Maximum measured duration.
Definition telemetry.hxx:79
std::uint64_t Successes
Number of successful attempts.
Definition telemetry.hxx:75
std::uint64_t TotalNanoseconds
Sum of measured durations.
Definition telemetry.hxx:77
std::uint64_t MinimumNanoseconds
Minimum measured duration, or zero when empty.
Definition telemetry.hxx:78
#define STORMBYTE_DATABASE_PUBLIC
Definition visibility.h:54