Skip to content

Commit 7a15860

Browse files
authored
Set bucket boundaries for histogram metrics (#14)
Set appropriate bucket boundaries for histogram metrics to accommodate the distribution of measured values.
1 parent 2388a6a commit 7a15860

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

sender/metrics.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ var (
2424
sendLatency: must(meter.Float64Histogram(
2525
"send_latency",
2626
metric.WithDescription("Latency of sending transactions in seconds"),
27-
metric.WithUnit("s"))),
27+
metric.WithUnit("s"),
28+
metric.WithExplicitBucketBoundaries(0.1, 0.2, 0.3, 0.5, 1.0, 2.0, 3.0, 5.0, 10.0, 20.0))),
2829
receiptLatency: must(meter.Float64Histogram(
2930
"receipt_latency",
3031
metric.WithDescription("Latency of sending transactions in seconds"),
31-
metric.WithUnit("s"))),
32+
metric.WithUnit("s"),
33+
metric.WithExplicitBucketBoundaries(0.1, 0.2, 0.3, 0.5, 1.0, 2.0, 3.0, 5.0, 10.0, 20.0))),
3234
workerQueueLength: must(meter.Int64ObservableGauge(
3335
"worker_queue_length",
3436
metric.WithDescription("Length of the worker's queue"),

stats/metrics.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@ var (
1616
gasUsed: must(meter.Int64Histogram(
1717
"gas_used",
1818
metric.WithDescription("Gas used in transactions"),
19-
metric.WithUnit("{gas}"))),
19+
metric.WithUnit("{gas}"),
20+
metric.WithExplicitBucketBoundaries(1, 1000, 10_000, 50_000, 100_000, 200_000, 300_000, 400_000, 500_000, 600_000, 700_000, 800_000, 1_000_000))),
2021
blockNumber: must(meter.Int64Gauge(
2122
"block_number",
2223
metric.WithDescription("Block number in the chain"),
2324
metric.WithUnit("{height}"))),
2425
blockTime: must(meter.Float64Histogram(
2526
"block_time",
2627
metric.WithDescription("Time taken to produce a block"),
27-
metric.WithUnit("s"))),
28+
metric.WithUnit("s"),
29+
metric.WithExplicitBucketBoundaries(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 2.0, 5.0, 10.0, 20.0))),
2830
}
2931
)
3032

0 commit comments

Comments
 (0)