{"record":{"id":"5a62177518ec7ce0","repo":"grafana/k6","slug":"metric-q-has-unsupported-metric-type","errorCode":null,"errorMessage":"metric %q has unsupported metric type","messagePattern":"metric %q has unsupported metric type","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/output/opentelemetry/output.go","lineNumber":181,"sourceCode":"\t\tgauge, err := o.metricsRegistry.getOrCreateGauge(name, unit)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tgauge.Record(ctx, entry.Value, attributeSetOpt)\n\tcase metrics.Trend:\n\t\ttrend, err := o.metricsRegistry.getOrCreateHistogram(name, unit)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\ttrend.Record(ctx, entry.Value, attributeSetOpt)\n\tcase metrics.Rate:\n\t\tif err := o.singleCounterForRate(ctx, name, attributeSetOpt, entry); err != nil {\n\t\t\treturn err\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"metric %q has unsupported metric type\", entry.Metric.Name)\n\t}\n\treturn nil\n}\n\nfunc (o *Output) singleCounterForRate(\n\tctx context.Context,\n\tmetricName string,\n\tattributeSetOpt otelMetric.MeasurementOption,\n\tentry metrics.Sample,\n) error {\n\trate, err := o.metricsRegistry.getOrCreateCounterForRate(metricName)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"get or create counter for Rate metric %q: %w\", metricName, err)\n\t}\n\tvar valueType string\n\tif entry.Value != 0 {\n\t\tvalueType = \"nonzero\"\n\t} else {","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/output/opentelemetry/output.go#L163-L199","documentation":"During metric flush, a sample's metric type (Counter, Gauge, Trend, Rate are handled) fell through to the default branch of dispatch — an unknown or unsupported metric type for OpenTelemetry export. The named metric cannot be mapped to an OTel instrument.","triggerScenarios":"Thrown at internal/output/opentelemetry/output.go:181 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check for a custom metric with an unregistered/new metric type","Register the metric as one of the supported types (Counter, Gauge, Trend, Rate)","Report a bug if a built-in metric triggers this"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}