Tor 0.4.9.0-alpha-dev
|
Onion service metrics exposed through the MetricsPort. More...
#include "orconfig.h"
#include "lib/malloc/malloc.h"
#include "lib/container/smartlist.h"
#include "lib/metrics/metrics_store.h"
#include "lib/log/util_bug.h"
#include "feature/hs/hs_metrics.h"
#include "feature/hs/hs_metrics_entry.h"
#include "feature/hs/hs_service.h"
Go to the source code of this file.
Functions | |
static const char * | port_to_str (const uint16_t port) |
static void | add_metric_with_labels (hs_service_t *service, hs_metrics_key_t metric, bool port_as_label, uint16_t port) |
static void | init_store (hs_service_t *service) |
void | hs_metrics_update_by_service (const hs_metrics_key_t key, const hs_service_t *service, uint16_t port, const char *reason, int64_t n, int64_t obs, bool reset) |
void | hs_metrics_update_by_ident (const hs_metrics_key_t key, const ed25519_public_key_t *ident_pk, const uint16_t port, const char *reason, int64_t n, int64_t obs, bool reset) |
const smartlist_t * | hs_metrics_get_stores (void) |
void | hs_metrics_service_init (hs_service_t *service) |
void | hs_metrics_service_free (hs_service_t *service) |
Onion service metrics exposed through the MetricsPort.
Definition in file hs_metrics.c.
#define HS_METRICS_ENTRY_PRIVATE |
Definition at line 9 of file hs_metrics.c.
|
static |
Add a new metric to the metrics store of the service.
metric is the index of the metric in the base_metrics array.
Definition at line 38 of file hs_metrics.c.
Referenced by init_store().
const smartlist_t * hs_metrics_get_stores | ( | void | ) |
Return a list of all the onion service metrics stores. This is the function attached to the .get_metrics() member of the subsys_t.
Definition at line 223 of file hs_metrics.c.
void hs_metrics_service_free | ( | hs_service_t * | service | ) |
Free the metrics store in the given service.
Definition at line 254 of file hs_metrics.c.
void hs_metrics_service_init | ( | hs_service_t * | service | ) |
Initialize the metrics store in the given service.
Definition at line 236 of file hs_metrics.c.
Referenced by register_service().
void hs_metrics_update_by_ident | ( | const hs_metrics_key_t | key, |
const ed25519_public_key_t * | ident_pk, | ||
const uint16_t | port, | ||
const char * | reason, | ||
int64_t | n, | ||
int64_t | obs, | ||
bool | reset | ||
) |
Update the metrics key entry in the store of a service identified by the given identity public key. The port, if non 0, and the reason label, if non NULL, are used to find the correct metrics entry. The value n is the value used to update the entry.
This is used by callsite that have access to the key but not the service object so an extra lookup is done to find the service.
Definition at line 195 of file hs_metrics.c.
void hs_metrics_update_by_service | ( | const hs_metrics_key_t | key, |
const hs_service_t * | service, | ||
uint16_t | port, | ||
const char * | reason, | ||
int64_t | n, | ||
int64_t | obs, | ||
bool | reset | ||
) |
Update the metrics key entry in the store in the given service. The port, if non 0, and the reason label, if non NULL, are used to find the correct metrics entry. The value n is the value used to update the entry.
Definition at line 148 of file hs_metrics.c.
Referenced by hs_metrics_update_by_ident().
|
static |
Initialize a metrics store for the given service.
Essentially, this goes over the base_metrics array and adds them all to the store set with their label(s) if any.
Definition at line 126 of file hs_metrics.c.
Referenced by hs_metrics_service_init().
|
static |
Return a static buffer pointer that contains the port as a string.
Subsequent call to this function invalidates the previous buffer.
Definition at line 26 of file hs_metrics.c.