{"record":{"id":"42c49a944b07889d","repo":"sgl-project/sglang","slug":"unsupported-otlp-protocol-protocol-configured","errorCode":null,"errorMessage":"Unsupported OTLP protocol '{protocol}' configured. Supported protocols are: {', '.join(sorted(supported_protocols))}","messagePattern":"Unsupported OTLP protocol '(.+?)' configured\\. Supported protocols are: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/observability/trace.py","lineNumber":275,"sourceCode":"    tracer = trace.get_tracer(\"sglang server\")\n\n    # Auto-start async trace exporter when SGLANG_TRACE_ASYNC=1\n    if envs.SGLANG_TRACE_ASYNC.get():\n        from sglang.srt.observability.trace_async import start_trace_exporter\n\n        start_trace_exporter(otlp_endpoint, server_name, trace_modules=trace_modules)\n\n\ndef get_global_tracing_enabled():\n    return opentelemetry_initialized\n\n\ndef get_otlp_span_exporter(endpoint):\n    protocol = os.environ.get(OTEL_EXPORTER_OTLP_TRACES_PROTOCOL, \"grpc\")\n    supported_protocols = {\"grpc\", \"http/protobuf\"}\n\n    if protocol not in supported_protocols:\n        raise ValueError(\n            f\"Unsupported OTLP protocol '{protocol}' configured. \"\n            f\"Supported protocols are: {', '.join(sorted(supported_protocols))}\"\n        )\n\n    if protocol == \"grpc\":\n        return GRPCSpanExporter(endpoint=endpoint, insecure=True)\n    elif protocol == \"http/protobuf\":\n        return HTTPSpanExporter(endpoint=endpoint)\n\n\n# Should be called by each tracked thread.\ndef trace_set_thread_info(\n    thread_label: str,\n    tp_rank: Optional[int] = None,\n    dp_rank: Optional[int] = None,\n    pp_rank: Optional[int] = None,\n):\n    if not opentelemetry_initialized:","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/observability/trace.py#L257-L293","documentation":"SGLang's tracing initialization reads the OTEL_EXPORTER_OTLP_TRACES_PROTOCOL environment variable to decide which OTLP span exporter to build. Only 'grpc' and 'http/protobuf' are recognized; any other value raises this ValueError. The check happens in get_otlp_span_exporter(), called from process_tracing_init when --enable-tracing or OTEL export is configured.","triggerScenarios":"Setting OTEL_EXPORTER_OTLP_TRACES_PROTOCOL to a value like 'http' (instead of 'http/protobuf'), 'http/json', or a typo'd string, then starting the server with tracing enabled (SGLANG_ENABLE_TRACING or --enable-tracing with an OTLP endpoint).","commonSituations":"OpenTelemetry conventions allow 'http/json' for some exporters; users copy configs from other OTel-instrumented apps and pass unsupported protocol names, or omit the '/protobuf' suffix.","solutions":["Set OTEL_EXPORTER_OTLP_TRACES_PROTOCOL to exactly 'grpc' or 'http/protobuf'","Unset the variable entirely — 'grpc' is the default","Check for trailing whitespace/case differences in the env value (matching is exact)"],"exampleFix":"# before\nexport OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http\n# after\nexport OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf","handlingStrategy":"validation","validationCode":"import os\nproto = os.environ.get(\"OTEL_EXPORTER_OTLP_TRACES_PROTOCOL\", \"grpc\")\nassert proto in {\"grpc\", \"http/protobuf\"}, f\"bad protocol: {proto!r}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate the env var at deploy time in a startup script","Document the exact two allowed values next to tracing config"],"tags":["opentelemetry","tracing","configuration","env-var"],"backgroundTag":"unsupported-configuration-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}