# Samples for setting metrics parameters/values in GoLang/Java

**URL:** <https://discuss.elastic.co/t/samples-for-setting-metrics-parameters-values-in-golang-java/216475>\
**Category:** APM\
**Tags:** go, java\
**Created:** [January 24, 2020, 6:07pm UTC](https://discuss.elastic.co/t/samples-for-setting-metrics-parameters-values-in-golang-java/216475 "2020-01-24T18:07:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rbkumar88](https://avatars.discourse-cdn.com/v4/letter/r/ec9cab/32.png) [@rbkumar88](https://discuss.elastic.co/u/rbkumar88)\
**Post date:** [January 24, 2020, 6:07pm UTC](https://discuss.elastic.co/t/samples-for-setting-metrics-parameters-values-in-golang-java/216475/1 "2020-01-24T18:07:03Z")

</div>

Would be nice if we can have code snippets showing how to set application level perf metrics and have that sent to APM server for visualization.

---

<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:** [January 30, 2020, 3:36pm UTC](https://discuss.elastic.co/t/samples-for-setting-metrics-parameters-values-in-golang-java/216475/2 "2020-01-30T15:36:47Z")

</div>

For the Java agent, there's currently no API to manually track metrics. We plan to integrate with Micrometer and possible Dropwizard metrics in the future.

There's an API for go but I'm not sure how stable it is: [https://github.com/elastic/apm-agent-go/blob/master/metrics.go](https://github.com/elastic/apm-agent-go/blob/master/metrics.go)

---

<div class="post-metadata">

**Author:** ![axw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axw/32/28197_2.png) [@axw](https://discuss.elastic.co/u/axw)\
**Post date:** [January 31, 2020, 5:56am UTC](https://discuss.elastic.co/t/samples-for-setting-metrics-parameters-values-in-golang-java/216475/3 "2020-01-31T05:56:19Z")

</div>

> [@felixbarny](#):
>
> There's an API for go but I'm not sure how stable it is: [https://github.com/elastic/apm-agent-go/blob/master/metrics.go](https://github.com/elastic/apm-agent-go/blob/master/metrics.go)

The Go agent's API won't be changed for the v1.x version series. We may change it in a future major revision, but it's safe to use for now.

That said, the API isn't really meant for end users, but for integration with existing metrics APIs (conceptually similar to Micrometer/Dropwizard integration that Felix mentions.)

For example, take a look at [apmgometrics package - go.elastic.co/apm/module/apmgometrics - Go Packages](https://godoc.org/go.elastic.co/apm/module/apmgometrics) and [apmprometheus package - go.elastic.co/apm/module/apmprometheus - Go Packages](https://godoc.org/go.elastic.co/apm/module/apmprometheus). You can use these to send metrics to Elastic APM using [rcrowley/go-metrics](https://github.com/rcrowley/go-metrics), or the [Prometheus Go client](https://github.com/prometheus/client_golang), respectively.

These are undocumented because they're incomplete. Later when they're complete, then you should expect to see documentation, including examples and pointers on visualisation. For now, please refer to the [Kibana Visualize](https://www.elastic.co/guide/en/kibana/current/visualize.html) docs. In particular, take a look at Lens and TSVB.

---

<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:** [February 21, 2020, 1:56am UTC](https://discuss.elastic.co/t/samples-for-setting-metrics-parameters-values-in-golang-java/216475/4 "2020-02-21T01:56:26Z")

</div>

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