Distributed Tracing with Elastic APM

Hello Team

We have a use case of monitoring micro-services(written in java and python) with elastic APM. Can you suggest me few pointers for below questions

  1. Is distributed tracing part of X-pack ?
  2. To monitor databases for which these services are connecting to, Do I've to install beats ?

Hi @rahulnama

The agents are all OSS: mostly Apache2 licensed, a couple are BSD licensed. APM Server comes under a mixed Apache2/Elastic license (https://github.com/elastic/apm-server/blob/master/LICENSE.txt), but you don't need to use any proprietary features for the purpose of distributed tracing.

The APM UI, which is how distributed traces can be visualised, comes under the Basic license. It's free to use.

If you're only interested in seeing the database query latency in your distributed traces, then you do not need to install any Beats. The Java agent will capture JDBC query timings, and the Python agent will do the same for DB-API 2.0 clients.

If you want additional insight into the database itself, then you can use Metricbeat (e.g. Metricbeat MySQL module) and Filebeat (e.g. Filebeat MySQL module).

2 Likes

Thanks @axw that helps :slight_smile:

Please let me know if any tutorials for monitoring java and python apps with Elastic APM are available.

Best
Rahul

We don't really have tutorials. You can find documentation on how to set up the agents at https://www.elastic.co/guide/en/apm/agent/index.html, as well as some more information on https://www.elastic.co/blog, e.g.

There are tutorial-style walkthroughs around the web. I can't recommend any in particular, but this one looks like it might be a good place to start: https://medium.com/@sece.cosmin/monitor-spring-boot-application-performance-with-elastic-apm-elasticsearch-and-kibana-8d4299cad2be.

1 Like

hey @axw

I've integrated python with elastic apm. it works cool.

but suppose I've two scenarios

Scenario-1: I've hardcoded all the sql queries in my python code
Scenario-2: I'm maintaining a config file for queries and i'm importing the queries to my code

in both cases will elastic apm maintain the query latency ? do we need to follow any best practices in terms of coding .

Glad to hear it's working well for you.

I'm not sure I understand your question. As long as you're using one of the database libraries mentioned in https://www.elastic.co/guide/en/apm/agent/python/current/supported-technologies.html#automatic-instrumentation-db, then the agent will capture the database queries. It doesn't matter whether the queries are hard-coded or defined in a file, the agent instruments the database client.

1 Like

got it. very good to know

Thanks again :slight_smile:

Hey @axw

I'm also trying to integrate apm with java app.

Java App: https://github.com/elastic/spring-petclinic

Java app is up and running(on AWS EC-2):
image

APM is running too
image

APM is configured in Java as a jar. you can see it here
image

Now, How do I make sure the logs from java app are being sent to apm server and then to elasticsearch. I dont see any service related to java in kibana.

Is there anything that I need to do while running java app.

Please suggest

Thanks for your time as always :slight_smile:

I'm not personally familiar with the spring-petclinic app. It could be that it's using an older version of the Java agent, which does not work with your version of the stack. The README for spring-petclinic says:

Other versions of the Elasticstack may work. Currently, only version 6.4.2 has been tested.

If that's still accurate, it implies an old version of the Java agent is being used, as the current version will not work with APM Server 6.4.2. In addition, APM Server 7.2.0 will not support those older (pre-GA) versions of the Java agent.

I don't know if that documentation is accurate though. I'd suggest opening new, more specific topic and perhaps someone else can chime in.

Sure. Will try changing the java agent version. Still, If not working, will open a new thread.

Thank you :slight_smile:

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.