I'm using the java agent version 1.35.0.
Is there a way to include the thread name in the span? Knowing the thread name helps understand a lot about how the app is doing multi-threading.
thanks
I'm using the java agent version 1.35.0.
Is there a way to include the thread name in the span? Knowing the thread name helps understand a lot about how the app is doing multi-threading.
thanks
If you mean automatically included, there is no way. If you mean manually adding in thread name to spans you create, then you have the setName() method
In addition to what jack said, this will be soon possible via baggage.
E.g. you can then define the thread name as baggage for the scope of your thread's run()
method and add the value as label to your spans and transactions.
You can follow the linked issue to track the progress.
I certainly would not want to have to do this programmatically in every app. It should either be done automatically or via a config option. Knowing the thread name tells a lot about how effectively an app is using multiple threads.
That's more the logging domain than tracing. We fully support integrating logs in with spans, we even have log_sending that let's you do it with nothing other than a config change. Most logging frameworks will log the thread with the rest of the details. Here's transaction I looked at and clicking in the log tab shows me the associated log with the thread name in the metadata (I'm using log-sending)
We are not using Elastic for logging. Will log sending help in this case?
Not sure what you mean by not using Elastic for logging. If you are using any of the usual logging frameworks (log4j, logback, j.u.logging, ...) then log correlation would have that in the log, and if you send the log to Elastic APM using either log_sending or filebeat then you can see that in the UI
Even if we were allowed to do log sending, there doesn't appear to be a way to associate the log event with the span, only the trace. It would make a ton more sense if you added the thread name to the span. You already pay the cost of getting a stack trace. Adding process.thread.name to the span seems like a no-brainer.
It would make a ton more sense if you added the thread name to the span. You already pay the cost of getting a stack trace. Adding process.thread.name to the span seems like a no-brainer.
It's less about the performance impact but more about not bloating the span documents storage wise. It's not even necessary to get a stacktrace for finding out the thread name, all it takes is Thread.currentThread().getName()
.
In addition a span does not necessarily run on a single thread. A span can be started on one thread and ended on another. We'd need to decide how to deal with these cases without presenting misleading information to users.
However, feel free to open a feature request in the GH repository. We'll consider the feature based on how requested it is.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
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.