Frequently Asked Questions
editFrequently Asked Questions
editHow does the agent work?
editThe agent auto-instruments known frameworks and libraries and records interesting events, like HTTP requests and database queries. To do this, it leverages the capability of the JVM to instrument the bytecode of classes. This means that for the supported technologies, there are no code changes required.
The agent automatically safely injects small pieces of code before and after interesting events to measure their duration and metadata (like the DB statement) as well as HTTP related information (like the URL, parameters, and headers).
For example, if the agent detects that a class extending javax.servlet.HttpServlet
is loaded,
it injects monitoring code before and after the servlet invocation.
These events, called Transactions and Spans, are sent to the APM Server which converts them to a format suitable for Elasticsearch, and sends them to an Elasticsearch cluster. You can then use the APM UI in Kibana to gain insight into latency issues and error culprits within your application.
Is the agent doing bytecode instrumentation?
editYes
How safe is bytecode instrumentation?
editElastic APM is using the popular bytecode instrumentation library Byte Buddy, which takes care of the heavy lifting of dealing with actual bytecode and lets us write the instrumentation in pure Java.
Byte Buddy is widely used in popular Open Source projects, for example Hibernate, Jackson, Mockito and is also commonly used by APM vendors. It is created by a Java Champion, awarded with the Dukes Choice award and currently downloaded over 75 million times a year.
Unlike other bytecode instrumentation libraries, Byte Buddy is designed so that it is impossible to corrupt the bytecode of instrumented classes. It also respects other agents attached to your application at the same time.
Do I need to re-compile my application?
editNo
What if the agent doesn’t support the technologies I’m using?
editYou can use the public API to create custom spans and transactions, participate in the survey to vote for prioritizing adding support for the technologies you are using, or get involved in the agent development and contribute to the auto-instrumentation capabilities of the agent.