grafana/k6 · error

metric %q has unsupported metric type

Error message

metric %q has unsupported metric type

What it means

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.

Source

Thrown at internal/output/opentelemetry/output.go:181

		gauge, err := o.metricsRegistry.getOrCreateGauge(name, unit)
		if err != nil {
			return err
		}

		gauge.Record(ctx, entry.Value, attributeSetOpt)
	case metrics.Trend:
		trend, err := o.metricsRegistry.getOrCreateHistogram(name, unit)
		if err != nil {
			return err
		}

		trend.Record(ctx, entry.Value, attributeSetOpt)
	case metrics.Rate:
		if err := o.singleCounterForRate(ctx, name, attributeSetOpt, entry); err != nil {
			return err
		}
	default:
		return fmt.Errorf("metric %q has unsupported metric type", entry.Metric.Name)
	}
	return nil
}

func (o *Output) singleCounterForRate(
	ctx context.Context,
	metricName string,
	attributeSetOpt otelMetric.MeasurementOption,
	entry metrics.Sample,
) error {
	rate, err := o.metricsRegistry.getOrCreateCounterForRate(metricName)
	if err != nil {
		return fmt.Errorf("get or create counter for Rate metric %q: %w", metricName, err)
	}
	var valueType string
	if entry.Value != 0 {
		valueType = "nonzero"
	} else {

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Check for a custom metric with an unregistered/new metric type
  2. Register the metric as one of the supported types (Counter, Gauge, Trend, Rate)
  3. Report a bug if a built-in metric triggers this
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at internal/output/opentelemetry/output.go:181 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/5a62177518ec7ce0. Report an issue: GitHub.