-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Labels
Description
Requirement
Implement the TODO at internal/metrics/metrics.go:69 to parse timer duration buckets from struct tags.
Current behavior:
When defining a Timer metric with a buckets tag, the Init function returns an error:
Field [X]: Buckets are not currently initialized for timer metrics
Context:
The TimerOptions struct already has a Buckets []time.Duration field defined in internal/metrics/factory.go:29, but the parsing logic was never implemented.
Proposed solution:
- Parse bucket strings using Go's
time.ParseDuration()(supports formats like "100ms", "1.5s", "2m") - Store parsed durations in
[]time.Duration - Pass to
factory.Timer(TimerOptions{...Buckets: buckets})
Example usage after implementation:
type Metrics struct {
RequestLatency metrics.Timer metric:"request_latency" buckets:"100ms,500ms,1s,5s"
}
This provides consistency with how Histogram buckets already work.
Reactions are currently unavailable