Tor 0.4.9.0-alpha-dev
Macros | Functions
hs_metrics.h File Reference

Header for feature/hs/hs_metrics.c. More...

#include "lib/container/smartlist.h"
#include "lib/crypt_ops/crypto_ed25519.h"
#include "feature/hs/hs_metrics_entry.h"
#include "feature/hs/hs_service.h"

Go to the source code of this file.

Macros

#define HS_METRICS_ENTRY_PRIVATE
 
#define hs_metrics_new_introduction(s)
 
#define hs_metrics_reject_intro_req(s, reason)
 
#define hs_metrics_app_write_bytes(i, port, n)
 
#define hs_metrics_app_read_bytes(i, port, n)
 
#define hs_metrics_new_established_rdv(s)
 
#define hs_metrics_failed_rdv(i, reason)
 
#define hs_metrics_close_established_rdv(i)
 
#define hs_metrics_new_rdv(i)    hs_metrics_update_by_ident(HS_METRICS_NUM_RDV, (i), 0, NULL, 1, 0, false)
 
#define hs_metrics_pow_pqueue_rdv(s, n)
 
#define hs_metrics_pow_suggested_effort(s, n)
 
#define hs_metrics_new_established_intro(s)
 
#define hs_metrics_close_established_intro(i)
 
#define hs_metrics_intro_circ_build_time(s, obs)
 
#define hs_metrics_rdv_circ_build_time(s, obs)
 

Functions

void hs_metrics_service_init (hs_service_t *service)
 
void hs_metrics_service_free (hs_service_t *service)
 
const smartlist_ths_metrics_get_stores (void)
 
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)
 
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)
 

Detailed Description

Header for feature/hs/hs_metrics.c.

Definition in file hs_metrics.h.

Macro Definition Documentation

◆ hs_metrics_app_read_bytes

#define hs_metrics_app_read_bytes (   i,
  port,
 
)
Value:
hs_metrics_update_by_ident(HS_METRICS_APP_READ_BYTES, (i), \
(port), NULL, (n), 0, false)
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)
Definition: hs_metrics.c:195

Number of bytes read from the application to the service.

Definition at line 52 of file hs_metrics.h.

◆ hs_metrics_app_write_bytes

#define hs_metrics_app_write_bytes (   i,
  port,
 
)
Value:
hs_metrics_update_by_ident(HS_METRICS_APP_WRITE_BYTES, (i), (port), NULL, \
(n), 0, false)

Number of bytes written to the application from the service.

Definition at line 47 of file hs_metrics.h.

◆ hs_metrics_close_established_intro

#define hs_metrics_close_established_intro (   i)
Value:
hs_metrics_update_by_ident(HS_METRICS_NUM_ESTABLISHED_INTRO, (i), 0, NULL, \
-1, 0, false)

Established introduction circuit closes. This is called when INTRO_ESTABLISHED circuit is marked for close.

Definition at line 95 of file hs_metrics.h.

◆ hs_metrics_close_established_rdv

#define hs_metrics_close_established_rdv (   i)
Value:
hs_metrics_update_by_ident(HS_METRICS_NUM_ESTABLISHED_RDV, (i), \
0, NULL, -1, 0, false)

Established rendezvous closed. This is called when the circuit in REND_JOINED state is marked for close.

Definition at line 69 of file hs_metrics.h.

◆ HS_METRICS_ENTRY_PRIVATE

#define HS_METRICS_ENTRY_PRIVATE

Definition at line 15 of file hs_metrics.h.

◆ hs_metrics_failed_rdv

#define hs_metrics_failed_rdv (   i,
  reason 
)
Value:
hs_metrics_update_by_ident(HS_METRICS_NUM_FAILED_RDV, (i), \
0, (reason), 1, 0, false)

New rendezvous circuit failure.

Definition at line 63 of file hs_metrics.h.

◆ hs_metrics_intro_circ_build_time

#define hs_metrics_intro_circ_build_time (   s,
  obs 
)
Value:
hs_metrics_update_by_service(HS_METRICS_INTRO_CIRC_BUILD_TIME, (s), 0, \
NULL, 1, obs, false)
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)
Definition: hs_metrics.c:148

Record an introduction circuit build time duration. This is called when the INTRO_ESTABLISHED has been received by the service.

Definition at line 101 of file hs_metrics.h.

◆ hs_metrics_new_established_intro

#define hs_metrics_new_established_intro (   s)
Value:
hs_metrics_update_by_service(HS_METRICS_NUM_ESTABLISHED_INTRO, (s), 0, \
NULL, 1, 0, false)

New introduction circuit has been established. This is called when the INTRO_ESTABLISHED has been received by the service.

Definition at line 89 of file hs_metrics.h.

◆ hs_metrics_new_established_rdv

#define hs_metrics_new_established_rdv (   s)
Value:
hs_metrics_update_by_service(HS_METRICS_NUM_ESTABLISHED_RDV, (s), \
0, NULL, 1, 0, false)

Newly established rendezvous. This is called as soon as the circuit purpose is REND_JOINED which is when the RENDEZVOUS2 cell is sent.

Definition at line 58 of file hs_metrics.h.

◆ hs_metrics_new_introduction

#define hs_metrics_new_introduction (   s)
Value:
hs_metrics_update_by_service(HS_METRICS_NUM_INTRODUCTIONS, (s), \
0, NULL, 1, 0, false)

New introducion request received.

Definition at line 37 of file hs_metrics.h.

◆ hs_metrics_new_rdv

#define hs_metrics_new_rdv (   i)     hs_metrics_update_by_ident(HS_METRICS_NUM_RDV, (i), 0, NULL, 1, 0, false)

New rendezvous circuit being launched.

Definition at line 74 of file hs_metrics.h.

◆ hs_metrics_pow_pqueue_rdv

#define hs_metrics_pow_pqueue_rdv (   s,
 
)
Value:
hs_metrics_update_by_service(HS_METRICS_POW_NUM_PQUEUE_RDV, (s), 0, \
NULL, (n), 0, true)

Update depth of rendezvous pqueue any time new work is enqueued.

Definition at line 78 of file hs_metrics.h.

◆ hs_metrics_pow_suggested_effort

#define hs_metrics_pow_suggested_effort (   s,
 
)
Value:
hs_metrics_update_by_service(HS_METRICS_POW_SUGGESTED_EFFORT, (s), 0, \
NULL, (n), 0, true)

Update the suggested effort we include in proof-of-work state

Definition at line 83 of file hs_metrics.h.

◆ hs_metrics_rdv_circ_build_time

#define hs_metrics_rdv_circ_build_time (   s,
  obs 
)
Value:
hs_metrics_update_by_service(HS_METRICS_REND_CIRC_BUILD_TIME, (s), 0, NULL, \
1, obs, false)

Record a rendezvous circuit build time duration. This is called as soon as the circuit purpose is REND_JOINED which is when the RENDEZVOUS2 cell is sent.

Definition at line 108 of file hs_metrics.h.

◆ hs_metrics_reject_intro_req

#define hs_metrics_reject_intro_req (   s,
  reason 
)
Value:
hs_metrics_update_by_service(HS_METRICS_NUM_REJECTED_INTRO_REQ, (s), 0, \
(reason), 1, 0, false)

Introducion request rejected.

Definition at line 42 of file hs_metrics.h.

Function Documentation

◆ hs_metrics_get_stores()

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.

◆ hs_metrics_service_free()

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.

◆ hs_metrics_service_init()

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().

◆ hs_metrics_update_by_ident()

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.

◆ hs_metrics_update_by_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 
)

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().