grafana/k6 · error
failed to convert Native Histogram to the related Protobuf:
Error message
failed to convert Native Histogram to the related Protobuf: %w
What it means
Error "failed to convert Native Histogram to the related Protobuf: %w" thrown in grafana/k6.
Source
Thrown at internal/output/prometheusrw/remotewrite/trend.go:201
suffix := baseUnit(series.Metric.Contains)
labels := MapSeries(series, suffix)
timestamp := t.UnixMilli()
return []*prompb.TimeSeries{
{
Labels: labels,
Histograms: []*prompb.Histogram{
histogramToHistogramProto(timestamp, sink.H),
},
},
}
}
func histogramToHistogramProto(timestamp int64, h prometheus.Histogram) *prompb.Histogram {
// TODO: research more if a better way is possible.
metric := &dto.Metric{}
if err := h.Write(metric); err != nil {
panic(fmt.Errorf("failed to convert Native Histogram to the related Protobuf: %w", err))
}
hmetric := metric.Histogram
return &prompb.Histogram{
Count: &prompb.Histogram_CountInt{CountInt: *hmetric.SampleCount},
Sum: *hmetric.SampleSum,
Schema: *hmetric.Schema,
ZeroThreshold: *hmetric.ZeroThreshold,
ZeroCount: &prompb.Histogram_ZeroCountInt{ZeroCountInt: *hmetric.ZeroCount},
NegativeSpans: toBucketSpanProto(hmetric.NegativeSpan),
NegativeDeltas: hmetric.NegativeDelta,
PositiveSpans: toBucketSpanProto(hmetric.PositiveSpan),
PositiveDeltas: hmetric.PositiveDelta,
Timestamp: timestamp,
}
}
func toBucketSpanProto(s []*dto.BucketSpan) []*prompb.BucketSpan {View on GitHub (pinned to 93accf6570)
When it happens
Trigger: Thrown at internal/output/prometheusrw/remotewrite/trend.go:201 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/9ab180dcf3d0aad1.
Report an issue: GitHub.