elastic / apm

Elastic Application Performance Monitoring - resources and general issue tracking for Elastic APM.
https://www.elastic.co/apm
Apache License 2.0
384 stars 114 forks source link

[Discuss] Listen to OpenTelemetry environment configuration by default #816

Open Mpdreamz opened 1 year ago

Mpdreamz commented 1 year ago

Relates to: https://github.com/elastic/apm/pull/813 where we'd listen to OTEL_* environment variables in the context of logging.

If we agree to make our ecs-logging OpenTelemetry aware it makes sense to extend the same logic to our agent configuration.

Quick summary is to propose adding support for the following OTEL_* environment variables.

This would create a new resolving logic for the listed APM Agent configuration items:

We could later follow this up with a discussion on what other resource semantic conventions we could support in the future. As well as finding a way to map OTEL_RESOURCE_ATTRIBUTES to GlobalLabels but leaving it out of scope for now.

basepi commented 1 year ago

This seems reasonable to me.

jackshirazi commented 1 year ago

We're currently trying to implement the Java agent as follows:

So for example, take the log level. The Elastic default is INFO. So

  1. the default is set to the Elastic default (INFO)
  2. if ELASTIC_APM_LOG_LEVEL is set, the value is set to that
  3. if OTEL_LOG_LEVEL is set, then that provides the final value for the log level (overriding the ELASTIC_APM_LOG_LEVEL if that was set)
jackshirazi commented 10 months ago

Note that we rolled back trying to support elastic config in the Java agent. The current strategy is to not explicitly support any elastic configs and give documentation that tells users how to convert from a subset of elastic configs to otel configs

Mpdreamz commented 10 months ago

Thanks for highlighting that @jackshirazi 👍 We'll follow on from your learnings and won't do this in our agent, existing or new OTEL wise.

listening to OTEL environment variables in our logging libraries might be its own discussion though as per: https://github.com/elastic/apm/issues/816

Will put that back up on the agenda next week.