How to gather more metrics (system and runtime metrics)

APM Agent language and version:
go/apm-agent-go-v1.8.0

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):
I want to add system and runtime metrics in addition to default metrics by calling GatherMetrics method (https://github.com/elastic/apm-agent-go/blob/95e54b2e24ea813e0d059e56dfe6c740681564cb/builtin_metrics.go#L46) from Tracer but it looks there is no way to access it unless I'm mistaken. Do you think I missed something or is the method not exposed for consumption?

Welcome to the forum @haile!

You can use Tracer.RegisterMetricsGatherer, passing in your own implementation of MetricsGatherer. There's GatherMetricsFunc for convenience, for simple cases.

You can see an example in https://github.com/elastic/apm-agent-go/blob/95e54b2e24ea813e0d059e56dfe6c740681564cb/metrics_test.go#L135-L165.

There's also integration with a couple of external metrics APIs, if you prefer that approach:

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