Tor 0.4.9.0-alpha-dev
hs_metrics_entry.h
Go to the documentation of this file.
1/* Copyright (c) 2020-2021, The Tor Project, Inc. */
2/* See LICENSE for licensing information */
3
4/**
5 * @file hs_metrics_entry.h
6 * @brief Header for feature/hs/hs_metrics_entry.c
7 **/
8
9#ifndef TOR_FEATURE_HS_METRICS_ENTRY_H
10#define TOR_FEATURE_HS_METRICS_ENTRY_H
11
12#ifdef HS_METRICS_ENTRY_PRIVATE
13
15
16/* Possible values for the reason label of the
17 * hs_intro_rejected_intro_req_count metric. */
18/** The hidden service received an unknown introduction auth key. */
19#define HS_METRICS_ERR_INTRO_REQ_BAD_AUTH_KEY "bad_auth_key"
20/** The hidden service received a malformed INTRODUCE2 cell. */
21#define HS_METRICS_ERR_INTRO_REQ_INTRODUCE2 "invalid_introduce2"
22/** The hidden service does not have the necessary subcredential. */
23#define HS_METRICS_ERR_INTRO_REQ_SUBCREDENTIAL "subcredential"
24/** The hidden service received an INTRODUCE2 replay. */
25#define HS_METRICS_ERR_INTRO_REQ_INTRODUCE2_REPLAY "replay"
26
27/* Possible values for the reason label of the hs_rdv_error_count metric. */
28/** The hidden service failed to connect to the rendezvous point. */
29#define HS_METRICS_ERR_RDV_RP_CONN_FAILURE "rp_conn_failure"
30/** The hidden service failed to build a circuit to the rendezvous point due
31 * to an invalid selected path. */
32#define HS_METRICS_ERR_RDV_PATH "invalid_path"
33/** The hidden service failed to send the RENDEZVOUS1 cell on rendezvous
34 * circuit. */
35#define HS_METRICS_ERR_RDV_RENDEZVOUS1 "rendezvous1"
36/** The hidden service failed to set up an end-to-end rendezvous circuit to
37 * the client. */
38#define HS_METRICS_ERR_RDV_E2E "e2e_circ"
39/** The hidden service reattempted to connect to the rendezvous point by
40 * launching a new circuit to it, but failed */
41#define HS_METRICS_ERR_RDV_RETRY "retry"
42
43/** Metrics key which are used as an index in the main base metrics array. */
44typedef enum {
45 /** Number of introduction requests. */
46 HS_METRICS_NUM_INTRODUCTIONS = 0,
47 /** Number of bytes written from onion service to application. */
48 HS_METRICS_APP_WRITE_BYTES = 1,
49 /** Number of bytes read from application to onion service. */
50 HS_METRICS_APP_READ_BYTES = 2,
51 /** Number of established rendezvous. */
52 HS_METRICS_NUM_ESTABLISHED_RDV = 3,
53 /** Number of rendezvous circuits created. */
54 HS_METRICS_NUM_RDV = 4,
55 /** Number of failed rendezvous. */
56 HS_METRICS_NUM_FAILED_RDV = 5,
57 /** Number of established introducton points. */
58 HS_METRICS_NUM_ESTABLISHED_INTRO = 6,
59 /** Number of rejected introducton requests. */
60 HS_METRICS_NUM_REJECTED_INTRO_REQ = 7,
61 /** Introduction circuit build time in milliseconds. */
62 HS_METRICS_INTRO_CIRC_BUILD_TIME = 8,
63 /** Rendezvous circuit build time in milliseconds. */
64 HS_METRICS_REND_CIRC_BUILD_TIME = 9,
65 /** Number of requests waiting in the proof of work priority queue. */
66 HS_METRICS_POW_NUM_PQUEUE_RDV = 10,
67 /** Suggested effort for requests with a proof of work client puzzle. */
68 HS_METRICS_POW_SUGGESTED_EFFORT = 11,
69} hs_metrics_key_t;
70
71/** The metadata of an HS metrics. */
72typedef struct hs_metrics_entry_t {
73 /* Metric key used as a static array index. */
74 hs_metrics_key_t key;
75 /* Metric type. */
76 metrics_type_t type;
77 /* Metrics output name. */
78 const char *name;
79 /* Metrics output help comment. */
80 const char *help;
81 /* The buckets, if the metric type is METRICS_TYPE_HISTOGRAM. */
82 const int64_t *buckets;
83 /* The number of buckets, if the metric type is METRICS_TYPE_HISTOGRAM. */
84 size_t bucket_count;
85 /* True iff a port label should be added to the metrics entry. */
86 bool port_as_label;
87} hs_metrics_entry_t;
88
89extern const hs_metrics_entry_t base_metrics[];
90extern const size_t base_metrics_size;
91
92extern const char *hs_metrics_intro_req_error_reasons[];
94
95extern const char *hs_metrics_rend_error_reasons[];
96extern const size_t hs_metrics_rend_error_reasons_size;
97
98#endif /* defined(HS_METRICS_ENTRY_PRIVATE) */
99#endif /* !defined(TOR_FEATURE_HS_METRICS_ENTRY_H) */
const char * name
Definition: config.c:2462
const char * hs_metrics_rend_error_reasons[]
const hs_metrics_entry_t base_metrics[]
const size_t hs_metrics_intro_req_error_reasons_size
const size_t base_metrics_size
const char * hs_metrics_intro_req_error_reasons[]
const size_t hs_metrics_rend_error_reasons_size
Header for lib/metrics/metrics_common.c.
metrics_type_t