-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metrics support #94
Metrics support #94
Conversation
2cbe000
to
dbb7206
Compare
Codecov Report
@@ Coverage Diff @@
## master #94 +/- ##
==========================================
+ Coverage 75.37% 75.94% +0.56%
==========================================
Files 57 61 +4
Lines 3099 3558 +459
==========================================
+ Hits 2336 2702 +366
- Misses 581 660 +79
- Partials 182 196 +14
Continue to review full report at Codecov.
|
sender.go
Outdated
System: s.tracer.system, | ||
Metrics: s.metrics.metrics, | ||
} | ||
if err := s.tracer.Transport.SendMetrics(ctx, &payload); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can race with the other Send methods in the main tracer goroutine. We should probably make it so SendMetrics is called from the tracer goroutine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed by splitting the method into two: gatherMetrics and sendMetrics; gatherMetrics kicks off goroutines to gather metrics and sends on a channel when they're all done, sendMetrics is called afterwards to send from the main tracer goroutine.
90fa286
to
dcca228
Compare
Testing with elastic/apm-server#1000, slightly modified to accept "unit" in the samples: |
e8de2a8
to
18d2c74
Compare
457702f
to
f60dcf1
Compare
810bc55
to
acad4ca
Compare
MetricsGatherer is an interface for gathering metrics. You add one to a Tracer using AddMetricsGatherer, and it is periodically called to gather all the metrics. Once they are gathered, they are sent in a payload to the Elastic APM server. Mostly for testing purposes, you can force metrics to be gathered and sent at any given time by calling Tracer.SendMetrics. It has the same sort of behaviour as Tracer.Flush, blocking until the metrics are sent or the abort channel is signaled. Each tracer is created with a builtin metrics gatherer, which gathers basic process metrics like memstats, number of goroutines, and the like.
Package apmprometheus provides a method for wrapping a prometheus.Gatherer to adapt it to the elasticapm.MetricsGatherer interface. Untyped, Gauge and Counter metric types are supported; Histogram and and Summary metrics are silently ignored for now.
Add API for adding summary metrics. Also add go.mem.gc builtin summary metric, which exposes GC pause quantiles, count, and sum (total).
We introduce support for publishing application metrics to the APM server. The server-side endpoint is still under development, so this is disabled by default. You can enable metrics sending by setting the collection interval, e.g.
ELASTIC_APM_METRICS_INTERVAL=30s
The tracer has a builtin metrics gatherer which reports some basic process statistics (memory usage, garbage collection stats), and tracer statistics (number of transactions and errors sent, dropped, and failed sending.) We'll extend this over time, e.g. process CPU usage. There will be some overlap with metricbeat.
Supersedes #31.
Closes #67.