open-telemetry / opentelemetry-go

OpenTelemetry Go API and SDK
https://opentelemetry.io/docs/languages/go
Apache License 2.0
5.23k stars 1.05k forks source link

Otlp: `too many colons in address` when export env: `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` #5706

Closed afifurrohman-id closed 1 month ago

afifurrohman-id commented 1 month ago

Description

A clear and concise description of what the bug is.

Environment

Steps To Reproduce

}


- You got log:

traces export: failed to exit idle mode: invalid target address http://127.0.0.1:4317, error info: address http://127.0.0.1:4317:443: too many colons in address



### Expected behavior

Should work! and not append `:443` at end of endpoint
amanakin commented 1 month ago

I suppose when you call NewOtlpTracerProvider, you should provide a domain name or IP address, instead of URL (remove http://).

MrAlias commented 1 month ago

I suppose when you call NewOtlpTracerProvider, you should provide a domain name or IP address, instead of URL (remove http://).

:point_up:

WithEndpoint sets the target endpoint (host and port) the Exporter will connect to. The provided endpoint should resemble "example.com:4317" (no scheme or path).

https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc#WithEndpoint

afifurrohman-id commented 1 month ago

I suppose when you call NewOtlpTracerProvider, you should provide a domain name or IP address, instead of URL (remove http://).

☝️

WithEndpoint sets the target endpoint (host and port) the Exporter will connect to. The provided endpoint should resemble "example.com:4317" (no scheme or path).

https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc#WithEndpoint

Okay, i still have confusion here.

Does it means when we set env should prefix with http:// or https:// ? But if we pass parameter should ip or domain example.com 192.168.10.1 ? And if we set both env and parameter to that fn, otel package should use the parameter instead env?

MrAlias commented 1 month ago

Does it means wen we set env should prefix with http:// or https:// ? But if we pass parameter should ip or domain example.com 192.168.10.1 ? And if we set both env and parameter to that fn, otel package should use the parameter instead env?

If I understand these questions correctly, the answer is yes to all of them.