# I'm new to ELK, I have a doubt on APM

**URL:** <https://discuss.elastic.co/t/im-new-to-elk-i-have-a-doubt-on-apm/206898>\
**Category:** APM\
**Tags:** java\
**Created:** [November 7, 2019, 6:10am UTC](https://discuss.elastic.co/t/im-new-to-elk-i-have-a-doubt-on-apm/206898 "2019-11-07T06:10:01Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![praveenkumar\_nr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/praveenkumar_nr/32/57316_2.png) [@praveenkumar\_nr](https://discuss.elastic.co/u/praveenkumar_nr)\
**Post date:** [November 7, 2019, 6:10am UTC](https://discuss.elastic.co/t/im-new-to-elk-i-have-a-doubt-on-apm/206898/1 "2019-11-07T06:10:01Z")

</div>

Guys,

I'm supposed to work on an existing product which is using ELK. The product has APM support for web services. Now my task is to develop a Batch framework for to be used by that product. Is it possible to configure the APM for batch programs??

If possible, please share me the docs for it.

I've been searching for it, but most of the results were like ELK's APM supports only for spring boot and servlets.

Help me throughout the problem, guys!!

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [November 7, 2019, 4:37pm UTC](https://discuss.elastic.co/t/im-new-to-elk-i-have-a-doubt-on-apm/206898/2 "2019-11-07T16:37:43Z")

</div>

Not sure I entirely understand what you need, but may [our scheduling framework support](https://www.elastic.co/guide/en/apm/agent/java/current/supported-technologies-details.html#supported-scheduling-frameworks) help?

If not, go over [our public API](https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html) and get to know it. It should allow you trace anything in your code that you desire.

---

<div class="post-metadata">

**Author:** ![praveenkumar\_nr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/praveenkumar_nr/32/57316_2.png) [@praveenkumar\_nr](https://discuss.elastic.co/u/praveenkumar_nr)\
**Post date:** [November 8, 2019, 6:42am UTC](https://discuss.elastic.co/t/im-new-to-elk-i-have-a-doubt-on-apm/206898/3 "2019-11-08T06:42:55Z")

</div>

Thanks for the info @Eyal_Koren!!

Let me go through the docs you have been referred and get back to you.

---

<div class="post-metadata">

**Author:** ![praveenkumar\_nr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/praveenkumar_nr/32/57316_2.png) [@praveenkumar\_nr](https://discuss.elastic.co/u/praveenkumar_nr)\
**Post date:** [November 9, 2019, 6:11am UTC](https://discuss.elastic.co/t/im-new-to-elk-i-have-a-doubt-on-apm/206898/4 "2019-11-09T06:11:34Z")

</div>

@Eyal_Koren, @dadoonet,

I've gone through the docs you have been referred. But Still I can't fall into a conclusion for my problem.

Look into the following code. I have a java project using maven with following main method.

```
package self.library.spark.batch;

public class MySampleBatch {

    public static void main(String[] args) {
	    MySampleBatch mySampleBatch = new MySampleBatch();
	    mySampleBatch.execute(args[0], args[1], args[2]);
    }

    private void execute(String param1, String param2, String param3) {
	    // HTTP REST calls using SpringRestTemplates
	    // Reads data from DB using SpringJDBCTemplate
	    // Performs JAVA Logics
	    // Writes data into DB using SpringJDBCTemplate
    }

}

```

And I've built a jar my-sample-batch.jar.  
Now I'm using the following command to execute my program MySampleBatch.java,

```
 java -javaagent:/path/to/elastic-apm-agent-1.11.0.jar -Delastic.apm.service_name=my-sample-batch -Delastic.apm.application_packages=self.library -Delastic.apm.server_urls=http://192.168.50.219:7200 -cp my-sample-batch.jar self.library.spark.batch.MySampleBatch p1 p2 p3

```

Now I can see that the program is executing successfully. Also I can found a Json having some SHA key like structured data generated in my log.

But when I refer the APM under Kibana, I could not able to view the APM details.

At the same time I can see the APM details in Kibana for my my-sample-service.war running through tomcat.

Could you tell me the reason why I can't see APM details for my-sample-batch.jar rather I can see for my-sample-service.war?

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [November 11, 2019, 7:06am UTC](https://discuss.elastic.co/t/im-new-to-elk-i-have-a-doubt-on-apm/206898/5 "2019-11-11T07:06:09Z")

</div>

> [@praveenkumar\_nr](#):
>
> Could you tell me the reason why I can't see APM details for my-sample-batch.jar rather I can see for my-sample-service.war?

That's because nothing is starting and ending a transaction in this batch. So, add [the API](https://mvnrepository.com/artifact/co.elastic.apm/apm-agent-api) as a maven dependency and go over [the documentation](https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html) to see how to use it. For example, annotating your `execute` method with [`@CaptureTransaction`](https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#api-capture-transaction) should do the trick.

Good luck.

---

<div class="post-metadata">

**Author:** ![praveenkumar\_nr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/praveenkumar_nr/32/57316_2.png) [@praveenkumar\_nr](https://discuss.elastic.co/u/praveenkumar_nr)\
**Post date:** [November 11, 2019, 8:57am UTC](https://discuss.elastic.co/t/im-new-to-elk-i-have-a-doubt-on-apm/206898/6 "2019-11-11T08:57:18Z")

</div>

Let me implement the same @Eyal_Koren.

Thanks for the sharing your knowledge.

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [November 11, 2019, 9:14am UTC](https://discuss.elastic.co/t/im-new-to-elk-i-have-a-doubt-on-apm/206898/7 "2019-11-11T09:14:55Z")

</div>

Sure thing. Just make sure you configure [`application_packages`](https://www.elastic.co/guide/en/apm/agent/java/current/config-stacktrace.html#config-application-packages) if you use the annotations API.

---

<div class="post-metadata">

**Author:** ![praveenkumar\_nr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/praveenkumar_nr/32/57316_2.png) [@praveenkumar\_nr](https://discuss.elastic.co/u/praveenkumar_nr)\
**Post date:** [November 11, 2019, 9:35am UTC](https://discuss.elastic.co/t/im-new-to-elk-i-have-a-doubt-on-apm/206898/8 "2019-11-11T09:35:56Z")

</div>

Yeah sure @Eyal_Koren

---

<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:** [December 2, 2019, 5:35am UTC](https://discuss.elastic.co/t/im-new-to-elk-i-have-a-doubt-on-apm/206898/9 "2019-12-02T05:35:59Z")

</div>

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