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

Dynamic datastream name or multiple namespaces option for APM on Elastic Agent #717

Closed julianacg closed 10 months ago

julianacg commented 2 years ago

Describe the enhancement:

In legacy version of APM we could use variables to define the names of our indices on the elasticsearch ouput. When using elastic agent, this is no longer possible, and namespace option only allows one static value. It would be nice to be able to define dynamic name for datastream, as this was behaviour supported before.

Describe a specific use case for the enhancement or feature: When working in kubernetes, you may want to name your apm indexes based on some kubernetes variable, such as the kubernetes namespace. Exemple available here on discuss

axw commented 2 years ago

@julianacg thanks for opening the enhancement request. This is definitely something we're working on a solution for. This is dependant on enhancements to Fleet: https://github.com/elastic/kibana/issues/134971

nicholas-r-king commented 1 year ago

Any update on this.

axw commented 1 year ago

Elasticsearch 8.8.0 introduced a reroute ingest processor, which can be used to route data to different namespaces. This can be used with a custom ingest pipeline for routing APM data.

Assuming Elastic Agent is running under Fleet, it will be necessary to wait for 8.10.0 (which should be out quite soon). Otherwise APM Server will not have sufficient privileges to write to arbitrary namespaces.

nicholas-r-king commented 1 year ago

Will there be updated documentation to show how to do this with the release of 8.10.0? Is it possible to do this without APM being managed by fleet with the standalone APM server?

axw commented 1 year ago

@nicholas-r-king yes, we will document this; we'll leave this issue open until that is done.

It is arleady possible to use the ingest pipeline with a standalone APM Server, as long as its privileges are sufficient to write to the routed-to data stream. The changes in 8.10.0 are essentially that Fleet will give APM Server privileges to write to traces-*, logs-*, and metrics-*. When running APM Server standalone you would just need to ensure the configured username/password or API Key have sufficient privileges.

nicholas-r-king commented 1 year ago

@axw Thanks a ton, really appreciate your help with this.

axw commented 1 year ago

8.10.0 has been released (https://www.elastic.co/blog/whats-new-elastic-8-10-0), so it is now possible to route to arbitrary namespaces using both standalone apm-server and the Fleet-managed APM integration.

If anyone has issues or feedback, please create a topic at https://discuss.elastic.co/c/observability/apm/58. Thank you for your patience!

(Still leaving this open until we have docs.)

nicholas-r-king commented 11 months ago

@axw Are docs still not quite ready for this yet?

axw commented 10 months ago

@nicholas-r-king I'm afraid not, sorry, that hasn't been scheduled. I've created a more specific issue for the docs: https://github.com/elastic/apm-server/issues/12375. I think we may as well close this one, and that one can be used for tracking the docs addition.