# Setup elastic-apm-agent for kafka

**URL:** <https://discuss.elastic.co/t/setup-elastic-apm-agent-for-kafka/291674>\
**Category:** Elastic Observability\
**Created:** [December 13, 2021, 2:41pm UTC](https://discuss.elastic.co/t/setup-elastic-apm-agent-for-kafka/291674 "2021-12-13T14:41:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChristianOelsner](https://avatars.discourse-cdn.com/v4/letter/c/d9b06d/32.png) [@ChristianOelsner](https://discuss.elastic.co/u/ChristianOelsner)\
**Post date:** [December 13, 2021, 2:41pm UTC](https://discuss.elastic.co/t/setup-elastic-apm-agent-for-kafka/291674/1 "2021-12-13T14:41:50Z")

</div>

Hey guys,  
I am playing around with elastic-apm-agent. The goal is to monitor kafka.  
I am using the agent config given to me in Kibana:

```auto
java -javaagent:/root/kafka/elastic-apm-agent-1.28.1.jar \
-Delastic.apm.service_name=my-application \
-Delastic.apm.server_urls=http://10.0.0.41:8200 \
-Delastic.apm.secret_token= \
-Delastic.apm.environment=production \
-Delastic.apm.application_packages=org.example \
-jar my-application.jar

```

It seems that no matter which jar in kafka/libs folder i try in "-jar my-application.jar" line,  
doesnt work.  
for example if i try kafka-clients-3.0.0.jar i get this output, which is the same for any jar i try with

```auto
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
2021-12-13 15:39:30,891 [main] INFO co.elastic.apm.agent.util.JmxUtils - Found JVM-specific OperatingSystemMXBean interface: com.sun.management.OperatingSystemMXBean
2021-12-13 15:39:30,997 [main] INFO co.elastic.apm.agent.configuration.StartupInfo - Starting Elastic APM 1.28.1 as my-application on Java 11.0.13 Runtime version: 11.0.13+8-LTS VM version: 11.0.13+8-LTS (Red Hat, Inc.) Linux 3.10.0-1160.49.1.el7.x86_64
2021-12-13 15:39:30,998 [main] INFO co.elastic.apm.agent.configuration.StartupInfo - service_name: 'my-application' (source: Java System Properties)
2021-12-13 15:39:30,999 [main] INFO co.elastic.apm.agent.configuration.StartupInfo - environment: 'production' (source: Java System Properties)
2021-12-13 15:39:30,999 [main] INFO co.elastic.apm.agent.configuration.StartupInfo - secret_token: 'XXXX' (source: Java System Properties)
2021-12-13 15:39:30,999 [main] INFO co.elastic.apm.agent.configuration.StartupInfo - server_urls: 'http://10.0.0.41:8200' (source: Java System Properties)
2021-12-13 15:39:31,000 [main] INFO co.elastic.apm.agent.configuration.StartupInfo - application_packages: 'org.example' (source: Java System Properties)
2021-12-13 15:39:33,842 [main] INFO co.elastic.apm.agent.impl.ElasticApmTracer - Tracer switched to RUNNING state
no main manifest attribute, in libs/kafka-clients-3.0.0.jar

```

The APM server is running and reachable via curl.  
I am pretty sure i am missing the obvious, but i could use some help with this 🙂

Best regards  
Christian

---

<div class="post-metadata">

**Author:** ![riferrei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/riferrei/32/104867_2.png) [@riferrei](https://discuss.elastic.co/u/riferrei)\
**Post date:** [December 13, 2021, 6:22pm UTC](https://discuss.elastic.co/t/setup-elastic-apm-agent-for-kafka/291674/2 "2021-12-13T18:22:12Z")

</div>

Hi Christian,

Could you please describe a little further what is not working? The warning you posted is fairly generic and tells only that certain reflection operations won't be allowed, but not that the agent is not working.

Also, it is essential to highlight that the APM support for Kafka is for the applications and not for the Kafka broker. So I would presume that `my-application.jar` is some application using the Kafka client API to produce or consumer records.

— @riferrei

---

<div class="post-metadata">

**Author:** ![ChristianOelsner](https://avatars.discourse-cdn.com/v4/letter/c/d9b06d/32.png) [@ChristianOelsner](https://discuss.elastic.co/u/ChristianOelsner)\
**Post date:** [December 19, 2021, 11:01pm UTC](https://discuss.elastic.co/t/setup-elastic-apm-agent-for-kafka/291674/3 "2021-12-19T23:01:59Z")

</div>

@riferrei  
Hi Ricardo  
Sorry about the latency, but Covid got the better of this household 🙂  
Your info on APM support being only for the applications solved my understanding issues. Thanks for that.

Best regards  
Christian

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 4, 2022, 8:33am UTC](https://discuss.elastic.co/t/setup-elastic-apm-agent-for-kafka/291674/4 "2022-11-04T08:33:22Z")

</div>


