apm icon indicating copy to clipboard operation
apm copied to clipboard

service.namespace support

Open brettmc opened this issue 4 years ago • 4 comments

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.

brettmc avatar Nov 09 '21 23:11 brettmc

@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.

axw avatar Nov 10 '21 00:11 axw

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.

tobiasstadler avatar Nov 10 '21 10:11 tobiasstadler

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.

brettmc avatar Nov 10 '21 11:11 brettmc

Ok, you want namespaces inside environments.

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

tobiasstadler avatar Nov 10 '21 11:11 tobiasstadler