# Elasticsearch APM usage for Custom java applicatio call methods

**URL:** <https://discuss.elastic.co/t/elasticsearch-apm-usage-for-custom-java-applicatio-call-methods/200821>\
**Category:** APM\
**Tags:** java\
**Created:** [September 24, 2019, 8:51am UTC](https://discuss.elastic.co/t/elasticsearch-apm-usage-for-custom-java-applicatio-call-methods/200821 "2019-09-24T08:51:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rj23495](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@rj23495](https://discuss.elastic.co/u/rj23495)\
**Post date:** [September 24, 2019, 8:51am UTC](https://discuss.elastic.co/t/elasticsearch-apm-usage-for-custom-java-applicatio-call-methods/200821/1 "2019-09-24T08:51:52Z")

</div>

Hi,  
I am using elasticsaerch APM to monitor certain custom metrics of my java application(tomcat).  
ELK version - 6.7 with Xpack.  
currently I am using APM agent standalone jar version 1.9.0  
My requirement - We are planning to move to ELK stack and we wish to monitor few custom set of application metrics.  
As in cloudwatch we create a metric and then emit those metrics using AWS sdk into custom namespaces, i wish to do the same here, but right now i am unable to see any of the custom metrics, all i can see on the apm dashboard PFA for image

 ![50%20PM](https://us1.discourse-cdn.com/elastic/original/3X/8/e/8e94d80c5468ee3f24da481649ae765438d4c7eb.png)  
i have some more metrics exposed in the application methods and classes to measure the latencies of those calls and i want to capture those metrics as well.  
Any help will be highly appreciated. @spinscale  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [September 24, 2019, 9:44am UTC](https://discuss.elastic.co/t/elasticsearch-apm-usage-for-custom-java-applicatio-call-methods/200821/2 "2019-09-24T09:44:55Z")

</div>

Currently, we don't have an API to programmatically capture metrics but we plan to integrate with Micrometer in the future.

What you can do now, especially if it's about response time for a method, is to use the tracer API to create a span for the method, for example with the [`@CaptureSpan`](https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#api-capture-span) annotatoin or the [`trace_methods`](https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-trace-methods) configuration option.

What are some of the metrics you want to track and where/how would you like them to be visualized?

Already, you can use Micrometer's [Elasticsearch registry](https://micrometer.io/docs/registry/elastic) to send metrics to Elasticsearch. You could then create a custom Kibana dashboard to visualize those metrics.

I hope that helps 🙂

Cheers,  
Felix

---

<div class="post-metadata">

**Author:** ![rj23495](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@rj23495](https://discuss.elastic.co/u/rj23495)\
**Post date:** [September 24, 2019, 10:25am UTC](https://discuss.elastic.co/t/elasticsearch-apm-usage-for-custom-java-applicatio-call-methods/200821/3 "2019-09-24T10:25:52Z")

</div>

Thanks a lot @felixbarny for prompt reply, i was actually going through this link [https://www.elastic.co/guide/en/apm/agent/java/master/public-api.html](https://www.elastic.co/guide/en/apm/agent/java/master/public-api.html) and by using annotations and start the counter.  
We will be visualising them on kibana  
My application has some latency metrics for few internal calls we want to create alarms on top of those metrics in case of threshold breach.  
I will look into elasticsearch registry documentation if it serves my purpose, in case of any issues i will revert on this ticket itself.

---

<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:** [October 15, 2019, 6:25am UTC](https://discuss.elastic.co/t/elasticsearch-apm-usage-for-custom-java-applicatio-call-methods/200821/4 "2019-10-15T06:25:54Z")

</div>

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