# How to add application metrics to elastic APM dashbords

**URL:** <https://discuss.elastic.co/t/how-to-add-application-metrics-to-elastic-apm-dashbords/201341>\
**Category:** APM\
**Tags:** java\
**Created:** [September 27, 2019, 6:19am UTC](https://discuss.elastic.co/t/how-to-add-application-metrics-to-elastic-apm-dashbords/201341 "2019-09-27T06:19:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![surenraju](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/surenraju/32/62606_2.png) [@surenraju](https://discuss.elastic.co/u/surenraju)\
**Post date:** [September 27, 2019, 6:19am UTC](https://discuss.elastic.co/t/how-to-add-application-metrics-to-elastic-apm-dashbords/201341/1 "2019-09-27T06:19:09Z")

</div>

Elastic Search Version: 7.3.1  
APM Server Version: 7.3.1  
APM Client Version: APM Java Agent: 1.x (current)  
APM Agent language and version: Java 1.8

We are evaluating elastic APM for our micro service stack. And we are evaluating to use elastic stack for application metrics, application log aggregation, k8s infrastructure monitoring.  
Our micro services are spring boot based and we are using micrometer for application metrics. Currently micrometer pushes the metrics to elastic search. We are trying to build dashboards around the application metrics and make it available from prebuild APM metrics dashboards which is available in Kibana .

I am looking for help and learn the best practices for the following questions.

1. How to make correlation available from kibana for application metrics generated from frameworks like micrometer?
2. How to build dashboards for application metrics and make it available from APM metrics dashboards which is ready available in kibana?
3. Does Elastic recommend to use java-ecs-logging to be able to correlate logs and APM traces.  
[https://github.com/elastic/java-ecs-logging](https://github.com/elastic/java-ecs-logging)
4. java-ecs-logging seems to have longer json keys. Will it impact the log index size?

Thanks for the support.

---

<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 27, 2019, 9:21am UTC](https://discuss.elastic.co/t/how-to-add-application-metrics-to-elastic-apm-dashbords/201341/2 "2019-09-27T09:21:41Z")

</div>

Hi and thanks for checking out Elastic APM 👍

> [@surenraju](#):
>
> 1. How to make correlation available from kibana for application metrics generated from frameworks like micrometer?

You could use [common tags](https://micrometer.io/docs/concepts#_common_tags) which correspond to the same fields which Elastic APM sets, for example `service.name` and `service.environment. We also have a longstanding open issue for better integration with micrometer. One idea is that if the agent is active, it automatically registers a registry which sends the logs to APM Server.

> [@surenraju](#):
>
> 1. How to build dashboards for application metrics and make it available from APM metrics dashboards which is ready available in kibana?

You can build your own visualizations and dashboards with the time series visual builder or the regular Kibana visualizations. There currently is no way, however, to include those dashboards in the metrics tab of the APM Kibana App.

> [@surenraju](#):
>
> 1. Does Elastic recommend to use java-ecs-logging to be able to correlate logs and APM traces.  
> [GitHub - elastic/ecs-logging-java: Centralized logging for Java applications with the Elastic stack made easy](https://github.com/elastic/java-ecs-logging)

Yes, that's what I made it for 🙂

> [@surenraju](#):
>
> 1. java-ecs-logging seems to have longer json keys. Will it impact the log index size?

Could you specify what you mean with longer JSON keys? Longer compared to what? Whether in general a long field name takes up more storage in Elasticsearch vs. a shorter one, I'm not too sure. Maybe @spinscale knows?

---

<div class="post-metadata">

**Author:** ![surenraju](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/surenraju/32/62606_2.png) [@surenraju](https://discuss.elastic.co/u/surenraju)\
**Post date:** [September 28, 2019, 7:13am UTC](https://discuss.elastic.co/t/how-to-add-application-metrics-to-elastic-apm-dashbords/201341/3 "2019-09-28T07:13:28Z")

</div>

Long name live log.level comparing shorter keys ll or message to msg etc. Also [java-ecs-logging] does not offer any mechanism populate structured arguments as part of the json. [https://github.com/logstash/logstash-logback-encoder/blob/master/src/main/java/net/logstash/logback/argument/StructuredArguments.java](https://github.com/logstash/logstash-logback-encoder/blob/master/src/main/java/net/logstash/logback/argument/StructuredArguments.java)

---

<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 28, 2019, 8:20am UTC](https://discuss.elastic.co/t/how-to-add-application-metrics-to-elastic-apm-dashbords/201341/4 "2019-09-28T08:20:14Z")

</div>

> [@surenraju](#):
>
> Also [java-ecs-logging] does not offer any mechanism populate structured arguments as part of the json.

It does for Log4j2: [https://github.com/elastic/java-ecs-logging/blob/master/log4j2-ecs-layout/README.md#structured-logging](https://github.com/elastic/java-ecs-logging/blob/master/log4j2-ecs-layout/README.md#structured-logging) but unfortunately, Logback is not as flexible.

What you could do is to add a MDC before logging and remove it afterwards. The `StructuredArguments` are a bit of a hack but it seems to work well. Maybe there is a way to support them within `java-ecs-logging` rater than trying to reinvent it.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [September 30, 2019, 12:06pm UTC](https://discuss.elastic.co/t/how-to-add-application-metrics-to-elastic-apm-dashbords/201341/5 "2019-09-30T12:06:06Z")

</div>

There are some small factors where this plays a role, but it the end the gains are negiligible to the maintenance horror you introduce by forcing everyone to know every abbreviation. The cluster state is a bit bigger due to the different mapping, the compressed \_source is a bit bigger.

Changing field names is not where you would gain size advantages. Making unneeded fields not indexable, learning about the `index_options` of the `text` field, properly configuring the correct number based data types are the things that will have an impact long term from my experience.

---

<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 21, 2019, 8:06am UTC](https://discuss.elastic.co/t/how-to-add-application-metrics-to-elastic-apm-dashbords/201341/6 "2019-10-21T08:06:20Z")

</div>

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