Skip to content

Commit fd7570e

Browse files
committed
metrics: signing duration histogram
1 parent c23c4c3 commit fd7570e

File tree

10 files changed

+65
-2
lines changed

10 files changed

+65
-2
lines changed

book/api/metrics-generated.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,16 @@
459459

460460
</div>
461461

462+
## Sign Tile
463+
464+
<div class="metrics">
465+
466+
| Metric | Type | Description |
467+
|--------|------|-------------|
468+
| <span class="metrics-name">sign_&#8203;sign_&#8203;duration_&#8203;seconds</span> | histogram | Duration of signing a message |
469+
470+
</div>
471+
462472
## Metric Tile
463473

464474
<div class="metrics">
@@ -737,6 +747,7 @@
737747
| <span class="metrics-name">repair_&#8203;sent_&#8203;pkt_&#8203;types</span><br/>{repair_&#8203;sent_&#8203;request_&#8203;types="<span class="metrics-enum">needed_&#8203;orphan</span>"} | counter | What types of client messages are we sending (Need Orphans) |
738748
| <span class="metrics-name">repair_&#8203;store_&#8203;link_&#8203;wait</span> | histogram | Time in seconds spent waiting for the store to link a new FEC set |
739749
| <span class="metrics-name">repair_&#8203;store_&#8203;link_&#8203;work</span> | histogram | Time in seconds spent on linking a new FEC set |
750+
| <span class="metrics-name">repair_&#8203;sign_&#8203;duration_&#8203;seconds</span> | histogram | Duration of signing a message |
740751

741752
</div>
742753

src/disco/metrics/generated/fd_metrics_all.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const char * FD_METRICS_TILE_KIND_NAMES[FD_METRICS_TILE_KIND_CNT] = {
4747
"poh",
4848
"shred",
4949
"store",
50+
"sign",
5051
"metric",
5152
"replay",
5253
"storei",
@@ -72,6 +73,7 @@ const ulong FD_METRICS_TILE_KIND_SIZES[FD_METRICS_TILE_KIND_CNT] = {
7273
FD_METRICS_POH_TOTAL,
7374
FD_METRICS_SHRED_TOTAL,
7475
FD_METRICS_STORE_TOTAL,
76+
FD_METRICS_SIGN_TOTAL,
7577
FD_METRICS_METRIC_TOTAL,
7678
FD_METRICS_REPLAY_TOTAL,
7779
FD_METRICS_STOREI_TOTAL,
@@ -96,6 +98,7 @@ const fd_metrics_meta_t * FD_METRICS_TILE_KIND_METRICS[FD_METRICS_TILE_KIND_CNT]
9698
FD_METRICS_POH,
9799
FD_METRICS_SHRED,
98100
FD_METRICS_STORE,
101+
FD_METRICS_SIGN,
99102
FD_METRICS_METRIC,
100103
FD_METRICS_REPLAY,
101104
FD_METRICS_STOREI,

src/disco/metrics/generated/fd_metrics_all.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "fd_metrics_storei.h"
2020
#include "fd_metrics_repair.h"
2121
#include "fd_metrics_gossip.h"
22+
#include "fd_metrics_sign.h"
2223
#include "fd_metrics_netlnk.h"
2324
#include "fd_metrics_snaprd.h"
2425
#include "fd_metrics_snapdc.h"
@@ -160,7 +161,7 @@ extern const fd_metrics_meta_t FD_METRICS_ALL_LINK_OUT[FD_METRICS_ALL_LINK_OUT_T
160161

161162
#define FD_METRICS_TOTAL_SZ (8UL*253UL)
162163

163-
#define FD_METRICS_TILE_KIND_CNT 22
164+
#define FD_METRICS_TILE_KIND_CNT 23
164165
extern const char * FD_METRICS_TILE_KIND_NAMES[FD_METRICS_TILE_KIND_CNT];
165166
extern const ulong FD_METRICS_TILE_KIND_SIZES[FD_METRICS_TILE_KIND_CNT];
166167
extern const fd_metrics_meta_t * FD_METRICS_TILE_KIND_METRICS[FD_METRICS_TILE_KIND_CNT];

src/disco/metrics/generated/fd_metrics_repair.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ const fd_metrics_meta_t FD_METRICS_REPAIR[FD_METRICS_REPAIR_TOTAL] = {
1919
DECLARE_METRIC_ENUM( REPAIR_SENT_PKT_TYPES, COUNTER, REPAIR_SENT_REQUEST_TYPES, NEEDED_ORPHAN ),
2020
DECLARE_METRIC_HISTOGRAM_SECONDS( REPAIR_STORE_LINK_WAIT ),
2121
DECLARE_METRIC_HISTOGRAM_SECONDS( REPAIR_STORE_LINK_WORK ),
22+
DECLARE_METRIC_HISTOGRAM_SECONDS( REPAIR_SIGN_DURATION_SECONDS ),
2223
};

src/disco/metrics/generated/fd_metrics_repair.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,13 @@
8585
#define FD_METRICS_HISTOGRAM_REPAIR_STORE_LINK_WORK_MIN (1e-08)
8686
#define FD_METRICS_HISTOGRAM_REPAIR_STORE_LINK_WORK_MAX (0.0005)
8787

88-
#define FD_METRICS_REPAIR_TOTAL (17UL)
88+
#define FD_METRICS_HISTOGRAM_REPAIR_SIGN_DURATION_SECONDS_OFF (65UL)
89+
#define FD_METRICS_HISTOGRAM_REPAIR_SIGN_DURATION_SECONDS_NAME "repair_sign_duration_seconds"
90+
#define FD_METRICS_HISTOGRAM_REPAIR_SIGN_DURATION_SECONDS_TYPE (FD_METRICS_TYPE_HISTOGRAM)
91+
#define FD_METRICS_HISTOGRAM_REPAIR_SIGN_DURATION_SECONDS_DESC "Duration of signing a message"
92+
#define FD_METRICS_HISTOGRAM_REPAIR_SIGN_DURATION_SECONDS_CVT (FD_METRICS_CONVERTER_SECONDS)
93+
#define FD_METRICS_HISTOGRAM_REPAIR_SIGN_DURATION_SECONDS_MIN (1e-08)
94+
#define FD_METRICS_HISTOGRAM_REPAIR_SIGN_DURATION_SECONDS_MAX (0.001)
95+
96+
#define FD_METRICS_REPAIR_TOTAL (18UL)
8997
extern const fd_metrics_meta_t FD_METRICS_REPAIR[FD_METRICS_REPAIR_TOTAL];
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/* THIS FILE IS GENERATED BY gen_metrics.py. DO NOT HAND EDIT. */
2+
#include "fd_metrics_sign.h"
3+
4+
const fd_metrics_meta_t FD_METRICS_SIGN[FD_METRICS_SIGN_TOTAL] = {
5+
DECLARE_METRIC_HISTOGRAM_SECONDS( SIGN_SIGN_DURATION_SECONDS ),
6+
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* THIS FILE IS GENERATED BY gen_metrics.py. DO NOT HAND EDIT. */
2+
3+
#include "../fd_metrics_base.h"
4+
#include "fd_metrics_enums.h"
5+
6+
#define FD_METRICS_HISTOGRAM_SIGN_SIGN_DURATION_SECONDS_OFF (16UL)
7+
#define FD_METRICS_HISTOGRAM_SIGN_SIGN_DURATION_SECONDS_NAME "sign_sign_duration_seconds"
8+
#define FD_METRICS_HISTOGRAM_SIGN_SIGN_DURATION_SECONDS_TYPE (FD_METRICS_TYPE_HISTOGRAM)
9+
#define FD_METRICS_HISTOGRAM_SIGN_SIGN_DURATION_SECONDS_DESC "Duration of signing a message"
10+
#define FD_METRICS_HISTOGRAM_SIGN_SIGN_DURATION_SECONDS_CVT (FD_METRICS_CONVERTER_SECONDS)
11+
#define FD_METRICS_HISTOGRAM_SIGN_SIGN_DURATION_SECONDS_MIN (1e-08)
12+
#define FD_METRICS_HISTOGRAM_SIGN_SIGN_DURATION_SECONDS_MAX (0.001)
13+
14+
#define FD_METRICS_SIGN_TOTAL (1UL)
15+
extern const fd_metrics_meta_t FD_METRICS_SIGN[FD_METRICS_SIGN_TOTAL];

src/disco/metrics/metrics.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,7 @@ metric introduced.
806806
<histogram name="StoreLinkWork" min="0.00000001" max="0.0005" converter="seconds">
807807
<summary>Time in seconds spent on linking a new FEC set</summary>
808808
</histogram>
809+
<histogram name="SignDurationSeconds" min="0.00000001" max="0.001" converter="seconds" summary="Duration of signing a message" />
809810
</tile>
810811

811812
<tile name="gossip">
@@ -863,6 +864,10 @@ metric introduced.
863864
<gauge name="GossipPeerCounts" enum="GossipPeerState" clickhouse_exclude="true" summary="Number of gossip peers tracked" />
864865
</tile>
865866

867+
<tile name="sign">
868+
<histogram name="SignDurationSeconds" min="0.00000001" max="0.001" converter="seconds" summary="Duration of signing a message" />
869+
</tile>
870+
866871
<enum name="NetlinkMsg">
867872
<int value="0" name="Link" label="Link" />
868873
<int value="1" name="Neigh" label="Neighbor Table Entry" />

src/disco/sign/fd_sign_tile.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "../keyguard/fd_keyload.h"
88
#include "../keyguard/fd_keyswitch.h"
99
#include "../../ballet/base58/fd_base58.h"
10+
#include "../metrics/fd_metrics.h"
1011

1112
#include <errno.h>
1213
#include <sys/mman.h>
@@ -51,6 +52,8 @@ typedef struct {
5152

5253
uchar * public_key;
5354
uchar * private_key;
55+
56+
fd_histf_t sign_duration[1];
5457
} fd_sign_ctx_t;
5558

5659
FD_FN_CONST static inline ulong
@@ -98,6 +101,11 @@ during_housekeeping( fd_sign_ctx_t * ctx ) {
98101
during_housekeeping_sensitive( ctx );
99102
}
100103

104+
static inline void
105+
metrics_write( fd_sign_ctx_t * ctx ) {
106+
FD_MHIST_COPY( SIGN, SIGN_DURATION_SECONDS, ctx->sign_duration );
107+
}
108+
101109
/* during_frag is called between pairs for sequence number checks, as
102110
we are reading incoming frags. We don't actually need to copy the
103111
fragment here, see fd_dedup.c for why we do this.*/
@@ -261,6 +269,9 @@ unprivileged_init_sensitive( fd_topo_t * topo,
261269
FD_TEST( tile->in_cnt<=MAX_IN );
262270
FD_TEST( tile->in_cnt==tile->out_cnt );
263271

272+
fd_histf_join( fd_histf_new( ctx->sign_duration, FD_MHIST_SECONDS_MIN( SIGN, SIGN_DURATION_SECONDS ),
273+
FD_MHIST_SECONDS_MAX( SIGN, SIGN_DURATION_SECONDS ) ) );
274+
264275
ctx->keyswitch = fd_keyswitch_join( fd_topo_obj_laddr( topo, tile->keyswitch_obj_id ) );
265276
derive_fields( ctx );
266277

@@ -370,6 +381,7 @@ populate_allowed_fds( fd_topo_t const * topo,
370381
#define STEM_CALLBACK_CONTEXT_ALIGN alignof(fd_sign_ctx_t)
371382

372383
#define STEM_CALLBACK_DURING_HOUSEKEEPING during_housekeeping
384+
#define STEM_CALLBACK_METRICS_WRITE metrics_write
373385
#define STEM_CALLBACK_DURING_FRAG during_frag
374386
#define STEM_CALLBACK_AFTER_FRAG after_frag
375387

src/discof/send/fd_send_tile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "../../disco/topo/fd_topo.h"
33
#include "../../disco/keyguard/fd_keyload.h"
44
#include "../../disco/fd_txn_m_t.h"
5+
#include "../../disco/keyguard/fd_keyguard.h"
56
#include "generated/fd_send_tile_seccomp.h"
67

78
#include <errno.h>

0 commit comments

Comments
 (0)