Samples for setting metrics parameters/values in GoLang/Java

,

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.

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

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 and apmprometheus package - go.elastic.co/apm/module/apmprometheus - Go Packages. You can use these to send metrics to Elastic APM using rcrowley/go-metrics, or the Prometheus Go client, 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 docs. In particular, take a look at Lens and TSVB.

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