{"record":{"id":"0d38a78774d03fcb","repo":"BerriAI/litellm","slug":"opentelemetry-otlp-grpc-log-exporter-is-not-availa-0d38a7","errorCode":null,"errorMessage":"OpenTelemetry OTLP gRPC log exporter is not available. Install `opentelemetry-exporter-otlp` and `grpcio` (or `litellm[grpc]`).","messagePattern":"OpenTelemetry OTLP gRPC log exporter is not available\\. Install `opentelemetry-exporter-otlp` and `grpcio` \\(or `litellm\\[grpc\\]`\\)\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/otel/plumbing/providers.py","lineNumber":299,"sourceCode":"    kind: Final = (config.exporter or \"console\").lower()\n    if kind in (\"in_memory\", \"inmemory\", \"memory\"):\n        return InMemoryLogExporter()\n    if kind in (\"otlp_http\", \"http\", \"http/protobuf\", \"http/json\"):\n        from opentelemetry.exporter.otlp.proto.http._log_exporter import (\n            OTLPLogExporter as HTTPLogExporter,\n        )\n\n        return HTTPLogExporter(\n            endpoint=_otlp_logs_endpoint(config.endpoint),\n            headers=parse_headers(config.headers),\n        )\n    if kind in (\"otlp_grpc\", \"grpc\"):\n        try:\n            from opentelemetry.exporter.otlp.proto.grpc._log_exporter import (\n                OTLPLogExporter as GRPCLogExporter,\n            )\n        except ImportError as exc:\n            raise ImportError(\n                \"OpenTelemetry OTLP gRPC log exporter is not available. Install \"\n                \"`opentelemetry-exporter-otlp` and `grpcio` (or `litellm[grpc]`).\"\n            ) from exc\n\n        return GRPCLogExporter(endpoint=config.endpoint, headers=parse_headers(config.headers))\n    return ConsoleLogExporter()\n\n\ndef build_logger_provider(\n    config: OpenTelemetryV2Config,\n    log_exporter: LogExporter | None = None,\n) -> SDKLoggerProvider:\n    \"\"\"Build the :class:`LoggerProvider` GenAI events export through.\n\n    ``log_exporter`` is an explicit override (tests inject an\n    ``InMemoryLogExporter``); otherwise the exporter is selected from the config's\n    exporter kind via :func:`build_log_exporter`. Console and in-memory exporters\n    get a Simple processor (synchronous export, which tests rely on), everything","sourceCodeStart":281,"sourceCodeEnd":317,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/otel/plumbing/providers.py#L281-L317","documentation":"The v2 OTel log-exporter provider mirrors the metric one: for kind otlp_grpc/grpc it lazily imports OTLPLogExporter from opentelemetry.exporter.otlp.proto.grpc._log_exporter and, on ImportError, re-raises with the standard guidance to install opentelemetry-exporter-otlp and grpcio (or litellm[grpc]), chaining the original error. It fails while building the logger provider, before any log records are shipped.","triggerScenarios":"OpenTelemetry v2 configured with a gRPC log exporter (exporter kind otlp_grpc/grpc) in an environment without the OTLP gRPC packages. Fires at provider construction — startup time — so enabling log export with gRPC on a dependency-slim image reproduces it immediately.","commonSituations":"Same family as the trace/metric variants: slim images without grpcio, HTTP-only lockfiles flipped to gRPC when pointing at a collector's 4317 port, alpine grpcio build failures leading teams to skip it, and environment drift between dev (transitive install) and deploy.","solutions":["pip install 'litellm[grpc]' in the image/venv that runs litellm (adds grpcio alongside the OTLP exporter package)","Or keep HTTP: set the v2 exporter kind to otlp_http / http/protobuf and target the collector's 4318 endpoint","Confirm with a direct import check in the runtime: python -c \"from opentelemetry.exporter.otlp.proto.grpc._log_exporter import OTLPLogExporter\"","Rebuild and restart the process so the logger provider builds without ImportError"],"exampleFix":"# before\n# v2 config: log exporter kind otlp_grpc; grpcio absent -> ImportError\n# after\npip install 'litellm[grpc]'","handlingStrategy":"validation","validationCode":"import importlib.util\n\nif config.exporter in ('otlp_grpc', 'grpc'):  # v2 log exporter kind\n    if importlib.util.find_spec('opentelemetry.exporter.otlp.proto.grpc._log_exporter') is None:\n        raise SystemExit('v2 gRPC log export requires: pip install opentelemetry-exporter-otlp grpcio (or litellm[grpc])')","typeGuard":null,"tryCatchPattern":"try:\n    from litellm.integrations.otel.plumbing.providers import build_logger_provider\n    provider = build_logger_provider(config)\nexcept ImportError as e:\n    if 'litellm[grpc]' in str(e):\n        raise SystemExit(\"pip install 'litellm[grpc]' or use the otlp_http log exporter\") from e\n    raise","preventionTips":["Pair every gRPC exporter kind in v2 config with the litellm[grpc] extra in the deployment manifest","Keep a matrix test of exporter kind x installed deps in CI to catch missing-module combinations","Treat grpcio as a first-class dependency, not optional baggage, once any gRPC exporter is configured","Validate configs by constructing the providers in a dry-run before shipping"],"tags":["opentelemetry","otel","import-error","missing-dependency","otlp-grpc","log-exporter","v2","packaging"],"backgroundTag":"missing-optional-dependency","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}