From 9f0df5e86e3713c969b5fdb25c0f62ec4714d7fa Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 13:08:54 +0100 Subject: [PATCH] ax(mining): replace prose struct comments with usage examples in metrics.go AX principle 2: comments show HOW with real values, not WHAT the type signature already states. Metrics and LatencyHistogram had prose descriptions; replaced with concrete call-site examples. Co-Authored-By: Charon --- pkg/mining/metrics.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/mining/metrics.go b/pkg/mining/metrics.go index 2476fe6..b6bbac6 100644 --- a/pkg/mining/metrics.go +++ b/pkg/mining/metrics.go @@ -6,8 +6,8 @@ import ( "time" ) -// Metrics provides simple instrumentation counters for the mining package. -// These can be exposed via Prometheus or other metrics systems in the future. +// snapshot := mining.GetMetricsSnapshot() +// snapshot["miners_started"].(int64) type Metrics struct { // API metrics RequestsTotal atomic.Int64 @@ -34,7 +34,8 @@ type Metrics struct { P2PConnectionsTotal atomic.Int64 } -// LatencyHistogram tracks request latencies with basic percentile support. +// h := mining.NewLatencyHistogram(1000) +// h.Record(42 * time.Millisecond) type LatencyHistogram struct { mu sync.Mutex samples []time.Duration