Hey I'm running a basic apm server sending events to kafka, deployed to kubernetes with a custom helm chart. A rails app has installed the agent gem and is not using any special env vars.
(ruby 3.4.0) -> (apm server 7.4.2) -> kafka
When I inspect the events written to the kafka topic, the span events do not contain the kubernetes metadata. We see this metadata for the metrics events.
We tried setting the kubernetes metadata fields using environment variables using the downward api as prescribed in the apm docs, and we verified they are populating in the application container correctly, but this didn't fix the problem.
I have tried capturing the http requests from the agent and they show the k8s metadata in the metadata payload at the start of each post body. So I'm leaning toward this being an issue with the apm server.
Global labels on spans are not supported in the currently released APM Server versions. Support has been implemented though with PR#2806 and will be part of the next release.
Update: I pulled down the apm server repo and ran make release successfully on the 7.6 branch. I deployed it and didn't see the k8s values in the span.
@jasonmoo-we sorry, there was a bit of misunderstanding earlier. Kubernetes metadata does not require global labels, and the change that Silvia referred to will not help.
It was a conscious decision to omit Kubernetes metadata from span documents, to keep storage costs down. The idea was that you would be able to use Kubernetes metadata to search for transactions of interest first, and then you would find spans related to a specific transaction.
It might make sense to revisit this decision - perhaps making it optional. What are you intending to do with the metadata?
Yes ok this makes more sense. I didn't understand the relation to global labels.
We are using the kafka output option on the apm server, and processing events downstream for consumption by a Prometheus metrics stack. It doesn't make sense for us to do some type of metadata decorating across multiple events. Having the k8s metadata is critical for us. I will fork the server and fix it until you guys are able to address the issue. Given that there are multiple output options on the apm server I'd expect the defaults to optimize for elasticsearch, but things like this to be configurable.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.