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


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!!

Not sure I entirely understand what you need, but may our scheduling framework support help?

If not, go over our public API and get to know it. It should allow you trace anything in your code that you desire.

Thanks for the info @Eyal_Koren!!

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

@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= -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?

That's because nothing is starting and ending a transaction in this batch. So, add the API as a maven dependency and go over the documentation to see how to use it. For example, annotating your execute method with @CaptureTransaction should do the trick.

Good luck.

1 Like

Let me implement the same @Eyal_Koren.

Thanks for the sharing your knowledge.

Sure thing. Just make sure you configure application_packages if you use the annotations API.

1 Like

Yeah sure @Eyal_Koren

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