grafana/k6 · error

HTTP exporter endpoint is required

Error message

HTTP exporter endpoint is required

What it means

Thrown by Config.validateExporterProtocol() for the OpenTelemetry output when exporterProtocol is http/protobuf and the HTTP exporter endpoint is empty. The OTLP HTTP exporter needs a host:port endpoint; unlike some SDKs, this output does not fall back to a default collector address.

Source

Thrown at internal/output/opentelemetry/config.go:241

func (cfg Config) validateExporterProtocol() error {
	if cfg.ExporterProtocol.String != "" {
		if cfg.ExporterProtocol.String != grpcExporterProtocol && cfg.ExporterProtocol.String != httpExporterProtocol {
			return fmt.Errorf(
				"unsupported exporter protocol %q, only %q and %q are supported",
				cfg.ExporterProtocol.String,
				grpcExporterProtocol,
				httpExporterProtocol,
			)
		}
		switch cfg.ExporterProtocol.String {
		case grpcExporterProtocol:
			if cfg.GRPCExporterEndpoint.String == "" {
				return errors.New("gRPC exporter endpoint is required")
			}
		case httpExporterProtocol:
			endpoint := cfg.HTTPExporterEndpoint.String
			if endpoint == "" {
				return errors.New("HTTP exporter endpoint is required")
			}

			if strings.HasPrefix(endpoint, "http://") ||
				strings.HasPrefix(endpoint, "https://") {
				return errors.New("HTTP exporter endpoint must only be host and port, no scheme")
			}
		}
	}
	return nil
}

// String returns a string representation of the config
func (cfg Config) String() string {
	var endpoint string
	protocol := cfg.ExporterProtocol.String
	switch protocol {
	case httpExporterProtocol:
		endpoint = "http"

View on GitHub (pinned to 93accf6570)

Solutions

  1. Set K6_OTEL_HTTP_EXPORTER_ENDPOINT, e.g. K6_OTEL_HTTP_EXPORTER_ENDPOINT=localhost:4318
  2. Or inline: -o experimental-opentelemetry="exporterProtocol=http/protobuf,httpExporterEndpoint=localhost:4318"
  3. Check the variable is non-empty in the actual runtime environment (print it before running k6)

Example fix

# before
export K6_OTEL_EXPORTER_PROTOCOL=http/protobuf
# no endpoint -> error

# after
export K6_OTEL_EXPORTER_PROTOCOL=http/protobuf
export K6_OTEL_HTTP_EXPORTER_ENDPOINT=localhost:4318
Defensive patterns

Strategy: validation

Validate before calling

if [ "${K6_OTEL_EXPORTER_PROTOCOL:-http/protobuf}" = "http/protobuf" ]; then
  : "${K6_OTEL_HTTP_EXPORTER_ENDPOINT:?K6_OTEL_HTTP_EXPORTER_ENDPOINT required, host:port only}"
fi

Prevention

When it happens

Trigger: Setting K6_OTEL_EXPORTER_PROTOCOL=http/protobuf (or the JSON equivalent) while K6_OTEL_HTTP_EXPORTER_ENDPOINT is unset or empty; removing the endpoint var after switching protocol from gRPC to http; a config file with exporterProtocol set but httpExporterEndpoint omitted.

Common situations: Assuming the exporter defaults to localhost:4318 like the OTel SDKs do; templated CI configs where the endpoint var is conditionally defined; leftover gRPC-era configs reused after switching to HTTP.

Related errors


AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15). Data as JSON: /api/errors/b5d94b43b844ccf2. Report an issue: GitHub.