opentelemetry-java icon indicating copy to clipboard operation
opentelemetry-java copied to clipboard

Configure alternative host to "localhost"

Open prdoyle opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe. Telemetry is sent to localhost by default. According to the docs, changing this requires setting half a dozen different environment variables that individually configure where each kind of telemetry goes.

During development, I run the Jaeger all-in-one container via Docker Compose as a service I'm calling otel. I'd rather not have to configure a slew of environment variables, and I'd rather not have to expose host ports just so that this agent can use localhost.

Describe the solution you'd like I'd like to have an environment variable that lets me specify an alternative to localhost as the default host name for all telemetry. Setting this variable would change only the host name, and would have no effect on protocol, port number, or URI path.

In my setup, I'd set this to otel, and this would send all telemetry to my Jaeger container without having to expose any host ports.

Describe alternatives you've considered

  • Exposing host ports. This doesn't work in all environments (eg. running a Linux VM in Windows) and can cause needless port conflicts if, for example, you want to try running two of these setups at the same time.
  • Setting all the environment variables for the individual telemetry types. This results in a lot of boilerplate code that would need to be maintained in the future when telemetry types are added or modified.

prdoyle avatar Jul 30 '22 14:07 prdoyle

It sounds like you're using the jaeger exporter, yet you've linked to docs for configuring the OTLP exporter. The minimal set of env vars needed to configure the jaeger exporter for traces is just two:

OTEL_TRACES_EXPORTER=jaeger
OTEL_EXPORTER_JAEGER_ENDPOINT=<endpoint>

It doesn't sound like you want metrics, so you'd need to additionally disable the metrics exporter, which defaults to otlp:

OTEL_METRICS_EXPORTER=none

To address the part about host ports, if you're using docker compose to run both jaeger and your application you don't need to assign a host port. Both services will be part of the same docker network and the application can export to jaeger over a stable port that doesn't have to contend with port usage on the host.

jack-berg avatar Aug 01 '22 20:08 jack-berg

This issue was marked stale due to lack of author feedback. It will be closed in 7 days.

github-actions[bot] avatar Aug 24 '22 16:08 github-actions[bot]

@prdoyle Did @jack-berg 's answer get your problem solved? If so, let's close this out. Thanks!

breedx-splk avatar Aug 24 '22 20:08 breedx-splk

This issue was marked stale due to lack of author feedback. It will be closed in 7 days.

github-actions[bot] avatar Aug 31 '22 21:08 github-actions[bot]

Sorry to ghost you @jack-berg! Yes, that worked! FYI @breedx-splk

prdoyle avatar Sep 01 '22 14:09 prdoyle