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

service.namespace support #544

Open brettmc opened 3 years ago

brettmc commented 3 years ago

Describe the feature. Using APM or opentelemetry for tracing, I would like to have the ability to namespace services so that we do not get naming collisions between generically-named services (eg "auth", "api", ...). I would also like to be able to see the namespace in the APM view, and potentially filter by namespace. As a workaround, we are prefixing namespaces into our service names (eg service.name='NAMESPACE_SERVICENAME'). The opentelemetry specification has the concept of a namespace: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#service but there doesn't appear to be a place in APM server to map that namespace to.

axw commented 3 years ago

@brettmc thanks for opening the issue. I'll transfer this to elastic/apm, as I think we'll want to treat this feature holistically -- server, agents, and UI.

tobiasstadler commented 3 years ago

Most (all?) elastic agents support a configuration environment, which you can use. You can also filter it in Kibana, see e.g. https://www.elastic.co/guide/en/kibana/current/services.html.

The equivalent for environment in OpenTelemetry is deployment.environment, which the APM Server understands and maps.

brettmc commented 3 years ago

We use environment to label traces as production/test/dev etc, which I believe is its intended purpose (and we do have multiple environments' traces going into the one elastic instance, so it's important that we use it for this purpose). If it was unused though, that would be an interesting workaround.

tobiasstadler commented 3 years ago

Ok, you want namespaces inside environments.

You may use labels (e.g. for the java agent: global_labels=service_namespace=...) as workaround.