Skip to content

Add gRPC support for OpenTelemetry OTLP export #7812

@stoopman

Description

@stoopman

Summary

Flagsmith's self-hosted OpenTelemetry integration currently exports traces over OTLP/HTTP only. Many OTLP collectors and managed observability agents expect OTLP/gRPC instead.

When OTEL_EXPORTER_OTLP_PROTOCOL=grpc is set (the standard OpenTelemetry env var), Flagsmith still uses the HTTP exporter:

opentelemetry.exporter.otlp.proto.http.trace_exporter

This causes trace export to fail against gRPC-only backends, with errors such as:

Transient error ('Connection aborted.', BadStatusLine('\x00\x00\x06\x04...')) encountered while exporting span batch, retrying...
Failed to export span batch due to timeout, max retries or shutdown.
ConnectionResetError(104, 'Connection reset by peer')

The application continues to work; only trace export is affected.

Expected behaviour

Flagsmith should respect OTEL_EXPORTER_OTLP_PROTOCOL and export traces over gRPC when configured, consistent with the OpenTelemetry SDK environment variable spec.

Alternatively (or additionally), document clearly that only OTLP/HTTP is supported today.

Current behaviour

Per the OpenTelemetry docs, setting OTEL_EXPORTER_OTLP_ENDPOINT enables OTel export. In practice, export appears to always use OTLP/HTTP regardless of OTEL_EXPORTER_OTLP_PROTOCOL.

Suggested solution

  • Add OTLP/gRPC trace export support in the Flagsmith API / task processor OTel setup
  • Honour OTEL_EXPORTER_OTLP_PROTOCOL=grpc (and http/protobuf where applicable)
  • Update docs to describe supported protocols and relevant env vars

Environment

  • Flagsmith version: 2.242.0 (Docker image)
  • Relevant env vars: OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_PROTOCOL=grpc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions