ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
Video chat in your terminal
Loading...
Searching...
No Matches
include/ascii-chat/stats/stats.h
Go to the documentation of this file.
1#pragma once
2
5#include <stdbool.h>
6#include <stdint.h>
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
14
15typedef enum {
62
73
89
90typedef struct {
91 const char *name;
92 const char *unit;
93 const char *description;
97
102
113
121
136
142
148typedef void (*stats_observer_fn)(stats_record_kind_t kind, unsigned id, uint64_t value, void *context);
149void stats_scope_set_observer(stats_scope_t *scope, stats_observer_fn observer, void *context);
150
160
171
176
184
190
200 stats_rates_t *out_rates);
202
203#ifdef __cplusplus
204}
205#endif
Synchronized per-thread pending error stacks and value snapshots. SET_ERRNO pushes,...
unsigned long long uint64_t
Definition common.h:63
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:44
void stats_scope_destroy(stats_scope_t *scope)
void stats_scope_set_observer(stats_scope_t *scope, stats_observer_fn observer, void *context)
void stats_counter_add(stats_scope_t *scope, stats_counter_id_t id, uint64_t amount)
@ STATS_COUNTER_MCP_RENDER_FAILURES
@ STATS_COUNTER_HTTP_BYTES_RECEIVED
@ STATS_COUNTER_SESSION_EXPIRATIONS
@ STATS_COUNTER_RATE_LIMIT_REJECTIONS
@ STATS_COUNTER_MIGRATION_FAILURES
@ STATS_COUNTER_MCP_HTTP_RESPONSES
void stats_duration_record(stats_scope_t *scope, stats_duration_id_t id, uint64_t elapsed_ns)
@ STATS_GAUGE_PARTICIPANTS_ACTIVE
@ STATS_GAUGE_HTTP_CONNECTIONS_ACTIVE
@ STATS_GAUGE_HTTP_STREAMS_ACTIVE
@ STATS_GAUGE_AUDIO_BUFFERED_SAMPLES
void stats_sampler_destroy(stats_sampler_t *sampler)
@ STATS_DURATION_CONNECTION_SETUP
void(* stats_observer_fn)(stats_record_kind_t kind, unsigned id, uint64_t value, void *context)
const stats_descriptor_t * stats_duration_descriptor(stats_duration_id_t id)
Definition descriptors.c:90
asciichat_error_t stats_scope_snapshot(const stats_scope_t *scope, stats_snapshot_t *out)
stats sampler config keeps the values that move through the subsystem: window_ns, resolution_ns....
struct stats_sampler stats_sampler_t
asciichat_error_t stats_scope_create(const stats_capabilities_t *capabilities, stats_scope_t **out_scope)
const stats_descriptor_t * stats_gauge_descriptor(stats_gauge_id_t id)
Definition descriptors.c:86
asciichat_error_t stats_sampler_update(stats_sampler_t *sampler, const stats_snapshot_t *snapshot, stats_rates_t *out_rates)
void stats_gauge_set(stats_scope_t *scope, stats_gauge_id_t id, uint64_t value)
asciichat_error_t stats_sampler_create(const stats_sampler_config_t *config, stats_sampler_t **out_sampler)
const stats_descriptor_t * stats_counter_descriptor(stats_counter_id_t id)
Definition descriptors.c:82
struct stats_scope stats_scope_t
static bool size_t gotel_query_t * out
Definition queries.h:8
stats descriptor is intentionally a small, concrete record. Fields such as name, unit,...
bool counters[STATS_COUNTER_COUNT]
bool durations[STATS_DURATION_COUNT]
double duration_mean_ns[STATS_DURATION_COUNT]
bool duration_valid[STATS_DURATION_COUNT]
double counters_per_second[STATS_COUNTER_COUNT]
This is the handoff point for stats scope. Callers fill observer, observer_context,...
stats duration shard keeps the values that move through the subsystem: owner. Some members are pointe...
stats_capabilities_t capabilities
uint64_t gauges[STATS_GAUGE_COUNT]
uint64_t counters[STATS_COUNTER_COUNT]
stats_duration_snapshot_t durations[STATS_DURATION_COUNT]