open-telemetry / opentelemetry-go-contrib

Collection of extensions for OpenTelemetry-Go.
https://opentelemetry.io/
Apache License 2.0
1.15k stars 544 forks source link

Support `OTEL_EXPORTER_OTLP_{TRACES,METRICS}_PROTOCOL` in `autoexport` #5807

Closed MrAlias closed 2 months ago

MrAlias commented 3 months ago

Currently the proto configuration is only interpreted from OTEL_EXPORTER_OTLP_PROTOCOL:

https://github.com/open-telemetry/opentelemetry-go-contrib/blob/962040ebb41d91ccf0b9c0a4997d1ece8f0105e1/exporters/autoexport/spans.go#L68

The specification states:

Specify Protocol

The OTEL_EXPORTER_OTLP_PROTOCOL, OTEL_EXPORTER_OTLP_TRACES_PROTOCOL, OTEL_EXPORTER_OTLP_METRICS_PROTOCOL and OTEL_EXPORTER_OTLP_LOGS_PROTOCOL environment variables specify the OTLP transport protocol. Supported values:

  • grpc for protobuf-encoded data using gRPC wire format over HTTP/2 connection
  • http/protobuf for protobuf-encoded data over HTTP connection
  • http/json for JSON-encoded data over HTTP connection

SDKs SHOULD support both grpc and http/protobuf transports and MUST support at least one of them. If they support only one, it SHOULD be http/protobuf. They also MAY support http/json.

If no configuration is provided the default transport SHOULD be http/protobuf unless SDKs have good reasons to choose grpc as the default (e.g. for backward compatibility reasons when grpc was already the default in a stable SDK release).

We should support the signal specification configurations for the protocol.

Related: https://cloud-native.slack.com/archives/C01NPAXACKT/p1719416293839069

thomasgouveia commented 3 months ago

Hi @MrAlias, you could assign me on this one!