opentelemetry-go
opentelemetry-go copied to clipboard
Add OTEL_EXPORTER_OTLP_LOGS_INSECURE and OTEL_EXPORTER_OTLP_INSECURE exporter env options
In this commit I add OTEL_EXPORTER_OTLP_LOGS_INSECURE and OTEL_EXPORTER_OTLP_INSECURE env options to otlploggrpc.Exporter
.
Now insecure option is fetched from env endpoint value (OTEL_EXPORTER_OTLP_LOGS_ENDPOINT/OTEL_EXPORTER_OTLP_ENDPOINT). According to spec:
Insecure: Whether to enable client transport security for the exporter’s gRPC connection. This option only applies to OTLP/gRPC when an endpoint is provided without the http or https scheme - OTLP/HTTP always uses the scheme provided for the endpoint.
So with current behavior we have several problems:
- If default endpoint is used, we can't use insecure connection (with setting OTEL_EXPORTER_OTLP_INSECURE).
- If endpoint provided with option without scheme (e.g.
WithEndpoint
) we can't use insecure connection with env settings. - If endpoint provided with env variable without scheme (e.g.
//env.endpoint:8080/
) we can't use insecure connection.
This commit fixes this.
The same problem with otlploghttp.Exporter
, and probably it should be fixed there too.
I'm open to suggestions on how to fix the current behavior in a more elegant way.