{"record":{"id":"7facced162f2df86","repo":"grafana/k6","slug":"grpc-exporter-endpoint-is-required","errorCode":null,"errorMessage":"gRPC exporter endpoint is required","messagePattern":"gRPC exporter endpoint is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/output/opentelemetry/config.go","lineNumber":236,"sourceCode":"\t\treturn err\n\t}\n\treturn nil\n}\n\nfunc (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 {","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/output/opentelemetry/config.go#L218-L254","documentation":"When the OTel exporter protocol is grpc (the default), the output requires a gRPC endpoint. k6 defaults it to localhost:4317, so the check only fails when the default has been overridden with an empty value — K6_OTEL_GRPC_EXPORTER_ENDPOINT set to an empty string (or \"grpcExporterEndpoint\": \"\" in the JSON output config) — leaving nothing to dial.","triggerScenarios":"export K6_OTEL_GRPC_EXPORTER_ENDPOINT= (defined but empty) while protocol is grpc (default); a config JSON that blanks the gRPC endpoint; CI templates exporting the variable without a value for this collector.","commonSituations":"Empty-string overrides from CI matrices; configs written for an HTTP collector that blank out the gRPC endpoint instead of switching protocol; stale env files after moving collectors.","solutions":["Set a host:port value, e.g. export K6_OTEL_GRPC_EXPORTER_ENDPOINT=otel-collector:4317 (no scheme, no path)","Remove the empty variable so the localhost:4317 default applies","If your collector only serves HTTP (4318), switch protocol instead: K6_OTEL_EXPORTER_PROTOCOL=http/protobuf and configure the HTTP endpoint"],"exampleFix":"# before\nexport K6_OTEL_GRPC_EXPORTER_ENDPOINT=\nk6 run -o opentelemetry script.js\n# after\nexport K6_OTEL_GRPC_EXPORTER_ENDPOINT=otel-collector:4317\nk6 run -o opentelemetry script.js","handlingStrategy":"validation","validationCode":"// Shell\nif [ \"${K6_OTEL_EXPORTER_PROTOCOL:-grpc}\" = \"grpc\" ] && [ -z \"${K6_OTEL_GRPC_EXPORTER_ENDPOINT:-}\" ]; then\n  unset K6_OTEL_GRPC_EXPORTER_ENDPOINT   # restore localhost:4317 default\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Write gRPC endpoints as host:port without scheme or path","Use the 4317 port for gRPC and 4318 for HTTP collectors","Unset, don't blank, endpoint variables you don't need"],"tags":["opentelemetry","grpc","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"}