{"record":{"id":"9ab180dcf3d0aad1","repo":"grafana/k6","slug":"failed-to-convert-native-histogram-to-the-related","errorCode":null,"errorMessage":"failed to convert Native Histogram to the related Protobuf: %w","messagePattern":"failed to convert Native Histogram to the related Protobuf: %w","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/output/prometheusrw/remotewrite/trend.go","lineNumber":201,"sourceCode":"\tsuffix := baseUnit(series.Metric.Contains)\n\tlabels := MapSeries(series, suffix)\n\ttimestamp := t.UnixMilli()\n\n\treturn []*prompb.TimeSeries{\n\t\t{\n\t\t\tLabels: labels,\n\t\t\tHistograms: []*prompb.Histogram{\n\t\t\t\thistogramToHistogramProto(timestamp, sink.H),\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc histogramToHistogramProto(timestamp int64, h prometheus.Histogram) *prompb.Histogram {\n\t// TODO: research more if a better way is possible.\n\tmetric := &dto.Metric{}\n\tif err := h.Write(metric); err != nil {\n\t\tpanic(fmt.Errorf(\"failed to convert Native Histogram to the related Protobuf: %w\", err))\n\t}\n\thmetric := metric.Histogram\n\n\treturn &prompb.Histogram{\n\t\tCount:          &prompb.Histogram_CountInt{CountInt: *hmetric.SampleCount},\n\t\tSum:            *hmetric.SampleSum,\n\t\tSchema:         *hmetric.Schema,\n\t\tZeroThreshold:  *hmetric.ZeroThreshold,\n\t\tZeroCount:      &prompb.Histogram_ZeroCountInt{ZeroCountInt: *hmetric.ZeroCount},\n\t\tNegativeSpans:  toBucketSpanProto(hmetric.NegativeSpan),\n\t\tNegativeDeltas: hmetric.NegativeDelta,\n\t\tPositiveSpans:  toBucketSpanProto(hmetric.PositiveSpan),\n\t\tPositiveDeltas: hmetric.PositiveDelta,\n\t\tTimestamp:      timestamp,\n\t}\n}\n\nfunc toBucketSpanProto(s []*dto.BucketSpan) []*prompb.BucketSpan {","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/output/prometheusrw/remotewrite/trend.go#L183-L219","documentation":"Error \"failed to convert Native Histogram to the related Protobuf: %w\" thrown in grafana/k6.","triggerScenarios":"Thrown at internal/output/prometheusrw/remotewrite/trend.go:201 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}