Tor 0.4.9.2-alpha-dev
|
Metrics interface to store them based on specific store type and get their MetricsPort output. More...
#include "orconfig.h"
#include "lib/container/map.h"
#include "lib/log/util_bug.h"
#include "lib/malloc/malloc.h"
#include "lib/metrics/metrics_store.h"
#include "lib/metrics/metrics_store_entry.h"
#include "lib/metrics/prometheus.h"
#include <stdio.h>
Go to the source code of this file.
Data Structures | |
struct | metrics_store_t |
Typedefs | |
typedef void() | fmt_driver_fn_t(const metrics_store_entry_t *, buf_t *, bool no_comment) |
Functions | |
static void | metrics_store_free_void (void *p) |
static void | get_output (const metrics_store_t *store, buf_t *data, fmt_driver_fn_t fmt) |
metrics_store_t * | metrics_store_new (void) |
void | metrics_store_free_ (metrics_store_t *store) |
smartlist_t * | metrics_store_get_all (const metrics_store_t *store, const char *name) |
metrics_store_entry_t * | metrics_store_add (metrics_store_t *store, metrics_type_t type, const char *name, const char *help, size_t bucket_count, const int64_t *buckets) |
void | metrics_store_get_output (const metrics_format_t fmt, const metrics_store_t *store, buf_t *data) |
void | metrics_store_reset (metrics_store_t *store) |
Metrics interface to store them based on specific store type and get their MetricsPort output.
Definition in file metrics_store.c.
#define METRICS_STORE_ENTRY_PRIVATE |
Definition at line 10 of file metrics_store.c.
typedef void() fmt_driver_fn_t(const metrics_store_entry_t *, buf_t *, bool no_comment) |
Function pointer to the format function of a specific driver.
Definition at line 37 of file metrics_store.c.
|
static |
Put the given store output in the buffer data and use the format function given in fmt to get it for each entry.
Definition at line 56 of file metrics_store.c.
Referenced by metrics_store_get_output().
metrics_store_entry_t * metrics_store_add | ( | metrics_store_t * | store, |
metrics_type_t | type, | ||
const char * | name, | ||
const char * | help, | ||
size_t | bucket_count, | ||
const int64_t * | buckets | ||
) |
Add a new metrics entry to the given store and type. The name MUST be the unique identifier. The help string can be omitted.
Definition at line 109 of file metrics_store.c.
Referenced by fill_cc_counters_values(), fill_cc_gauges_values(), fill_circuits_values(), fill_dos_values(), fill_global_bw_limit_values(), fill_oom_values(), fill_relay_circ_proto_violation(), fill_relay_destroy_cell(), fill_relay_drop_cell(), fill_relay_flags(), fill_socket_values(), fill_streams_values(), fill_tcp_exhaustion_values(), and fill_traffic_values().
void metrics_store_free_ | ( | metrics_store_t * | store | ) |
Free the given store including all its entries.
Definition at line 85 of file metrics_store.c.
|
static |
Helper: Free a single entry in a metrics_store_t taking a void pointer parameter.
Definition at line 43 of file metrics_store.c.
smartlist_t * metrics_store_get_all | ( | const metrics_store_t * | store, |
const char * | name | ||
) |
Find all metrics entry in the given store identified by name. If not found, NULL is returned.
Definition at line 98 of file metrics_store.c.
Referenced by hs_metrics_update_by_service().
void metrics_store_get_output | ( | const metrics_format_t | fmt, |
const metrics_store_t * | store, | ||
buf_t * | data | ||
) |
Set the output of the given store of the format fmt into the given buffer data.
Definition at line 134 of file metrics_store.c.
metrics_store_t * metrics_store_new | ( | void | ) |
Return a newly allocated and initialized store of the given type.
Definition at line 74 of file metrics_store.c.
Referenced by hs_metrics_service_init().
void metrics_store_reset | ( | metrics_store_t * | store | ) |
Reset a store as in free its content.
Definition at line 152 of file metrics_store.c.
Referenced by fill_store().