{"record":{"id":"b5d94b43b844ccf2","repo":"grafana/k6","slug":"http-exporter-endpoint-is-required","errorCode":null,"errorMessage":"HTTP exporter endpoint is required","messagePattern":"HTTP exporter endpoint is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/output/opentelemetry/config.go","lineNumber":241,"sourceCode":"func (cfg Config) validateExporterProtocol() error {\n\tif cfg.ExporterProtocol.String != \"\" {\n\t\tif cfg.ExporterProtocol.String != grpcExporterProtocol && cfg.ExporterProtocol.String != httpExporterProtocol {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"unsupported exporter protocol %q, only %q and %q are supported\",\n\t\t\t\tcfg.ExporterProtocol.String,\n\t\t\t\tgrpcExporterProtocol,\n\t\t\t\thttpExporterProtocol,\n\t\t\t)\n\t\t}\n\t\tswitch cfg.ExporterProtocol.String {\n\t\tcase grpcExporterProtocol:\n\t\t\tif cfg.GRPCExporterEndpoint.String == \"\" {\n\t\t\t\treturn errors.New(\"gRPC exporter endpoint is required\")\n\t\t\t}\n\t\tcase httpExporterProtocol:\n\t\t\tendpoint := cfg.HTTPExporterEndpoint.String\n\t\t\tif endpoint == \"\" {\n\t\t\t\treturn errors.New(\"HTTP exporter endpoint is required\")\n\t\t\t}\n\n\t\t\tif strings.HasPrefix(endpoint, \"http://\") ||\n\t\t\t\tstrings.HasPrefix(endpoint, \"https://\") {\n\t\t\t\treturn errors.New(\"HTTP exporter endpoint must only be host and port, no scheme\")\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\n// String returns a string representation of the config\nfunc (cfg Config) String() string {\n\tvar endpoint string\n\tprotocol := cfg.ExporterProtocol.String\n\tswitch protocol {\n\tcase httpExporterProtocol:\n\t\tendpoint = \"http\"","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/output/opentelemetry/config.go#L223-L259","documentation":"When the OTel exporter protocol is http/protobuf, the output requires an HTTP endpoint (host:port). k6 defaults it to localhost:4318, so the check fails when the default has been overridden with an empty value — K6_OTEL_HTTP_EXPORTER_ENDPOINT set to empty (or \"httpExporterEndpoint\": \"\" in JSON config) while the protocol is http/protobuf.","triggerScenarios":"export K6_OTEL_EXPORTER_PROTOCOL=http/protobuf together with K6_OTEL_HTTP_EXPORTER_ENDPOINT= (empty); a JSON output config that selects the HTTP protocol but blanks the endpoint; CI variables that exist but are unpopulated.","commonSituations":"Switching a pipeline from grpc to HTTP export and clearing the old-style endpoint; templated configs where the endpoint variable is provisioned per-environment and this one is missing.","solutions":["Set a host:port value, e.g. export K6_OTEL_HTTP_EXPORTER_ENDPOINT=otel-collector:4318","Remove the empty variable so the localhost:4318 default applies","Remember the URL path is configured separately via K6_OTEL_HTTP_EXPORTER_URL_PATH (default /v1/metrics) — do not put the path in the endpoint"],"exampleFix":"# before\nexport K6_OTEL_EXPORTER_PROTOCOL=http/protobuf\nexport K6_OTEL_HTTP_EXPORTER_ENDPOINT=\nk6 run -o opentelemetry script.js\n# after\nexport K6_OTEL_EXPORTER_PROTOCOL=http/protobuf\nexport K6_OTEL_HTTP_EXPORTER_ENDPOINT=otel-collector:4318\nk6 run -o opentelemetry script.js","handlingStrategy":"validation","validationCode":"// Shell\nif [ \"${K6_OTEL_EXPORTER_PROTOCOL:-}\" = \"http/protobuf\" ] && [ -z \"${K6_OTEL_HTTP_EXPORTER_ENDPOINT:-}\" ]; then\n  unset K6_OTEL_HTTP_EXPORTER_ENDPOINT   # restore localhost:4318 default\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember the HTTP protocol's full k6 name is http/protobuf, not http","Keep endpoint (host:port) and URL path (K6_OTEL_HTTP_EXPORTER_URL_PATH) in separate variables","Pre-flight-validate that switching protocols brought its matching endpoint along"],"tags":["opentelemetry","http","endpoint","configuration","k6"],"backgroundTag":"missing-endpoint-config","analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}