Tor  0.4.8.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)    hs_metrics_update_by_ident(HS_METRICS_NUM_FAILED_RDV, (i), 0, (reason), 1, 0)
 
#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)
 
#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)
 
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)
 

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)
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)
Definition: hs_metrics.c:190

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)

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)

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

Definition at line 84 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)

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

Definition at line 68 of file hs_metrics.h.

◆ hs_metrics_failed_rdv

#define hs_metrics_failed_rdv (   i,
  reason 
)     hs_metrics_update_by_ident(HS_METRICS_NUM_FAILED_RDV, (i), 0, (reason), 1, 0)

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)
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)
Definition: hs_metrics.c:146

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

Definition at line 90 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)

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

Definition at line 78 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)

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)

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)

New rendezvous circuit being launched.

Definition at line 73 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)

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 97 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)

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 213 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 244 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 226 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 
)

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 190 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 
)

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 146 of file hs_metrics.c.

Referenced by hs_metrics_update_by_ident().