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 <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 13:08:54 +01:00
parent 00d0e5ed96
commit 9f0df5e86e
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -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