grafana/k6 · error
failed to create histogram for %q: %w
Error message
failed to create histogram for %q: %w
What it means
The OTel Meter rejected creation of a Float64Histogram instrument for this metric name. getOrCreateHistogram wraps the SDK error, typically a name conflict with an existing instrument of another kind.
Source
Thrown at internal/output/opentelemetry/registry.go:71
}
func (r *registry) getOrCreateHistogram(name, unit string) (otelMetric.Float64Histogram, error) {
if histogram, ok := r.histograms.Load(name); ok {
if v, ok := histogram.(otelMetric.Float64Histogram); ok {
return v, nil
}
return nil, fmt.Errorf("metric %q is not a histogram", name)
}
opts := []otelMetric.Float64HistogramOption{}
if unit != "" {
opts = append(opts, otelMetric.WithUnit(unit))
}
h, err := r.meter.Float64Histogram(name, opts...)
if err != nil {
return nil, fmt.Errorf("failed to create histogram for %q: %w", name, err)
}
r.logger.Debugf("registered histogram metric %q", name)
r.histograms.Store(name, h)
return h, nil
}
func (r *registry) getOrCreateCounterForRate(name string) (otelMetric.Int64Counter, error) {
// k6's rate metric tracks how frequently a non-zero value occurs.
// To be accurate is a percentage, which is a ratio.
// To correctly calculate this metric in a metrics backend,
// we need to split the rate metric via a dedicated attribute.
totalName := name + ".total"
var err error
var totalCounter otelMetric.Int64CounterView on GitHub (pinned to 01ffac6f24)
Solutions
- Check the wrapped error from the meter provider
- Use a unique metric name for the histogram
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at internal/output/opentelemetry/registry.go:71 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/c33c85c976b56d14.
Report an issue: GitHub.