Tor  0.4.8.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. */
44 typedef 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 rendezsvous. */
52  HS_METRICS_NUM_ESTABLISHED_RDV = 3,
53  /** Number of rendezsvous circuits created. */
54  HS_METRICS_NUM_RDV = 4,
55  /** Number of failed rendezsvous. */
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 } hs_metrics_key_t;
66 
67 /** The metadata of an HS metrics. */
68 typedef struct hs_metrics_entry_t {
69  /* Metric key used as a static array index. */
70  hs_metrics_key_t key;
71  /* Metric type. */
72  metrics_type_t type;
73  /* Metrics output name. */
74  const char *name;
75  /* Metrics output help comment. */
76  const char *help;
77  /* The buckets, if the metric type is METRICS_TYPE_HISTOGRAM. */
78  const int64_t *buckets;
79  /* The number of buckets, if the metric type is METRICS_TYPE_HISTOGRAM. */
80  size_t bucket_count;
81  /* True iff a port label should be added to the metrics entry. */
82  bool port_as_label;
83 } hs_metrics_entry_t;
84 
85 extern const hs_metrics_entry_t base_metrics[];
86 extern const size_t base_metrics_size;
87 
88 extern const char *hs_metrics_intro_req_error_reasons[];
89 extern const size_t hs_metrics_intro_req_error_reasons_size;
90 
91 extern const char *hs_metrics_rend_error_reasons[];
92 extern const size_t hs_metrics_rend_error_reasons_size;
93 
94 #endif /* defined(HS_METRICS_ENTRY_PRIVATE) */
95 #endif /* !defined(TOR_FEATURE_HS_METRICS_ENTRY_H) */
const char * name
Definition: config.c:2443
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