Skip to content
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 (WIP) #31

Closed
wants to merge 6 commits into from
Closed

Metrics support (WIP) #31

wants to merge 6 commits into from

Conversation

axw
Copy link
Member

@axw axw commented Mar 28, 2018

Support for metrics, including bridges for Prometheus and go-metrics. See commit messages for any non-obvious details.

@axw axw force-pushed the stats-prototype branch 2 times, most recently from debbbef to bb7821e Compare April 3, 2018 02:27
@codecov-io
Copy link

codecov-io commented Apr 3, 2018

Codecov Report

Merging #31 into master will decrease coverage by 3.8%.
The diff coverage is 43.73%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #31      +/-   ##
==========================================
- Coverage   74.32%   70.51%   -3.81%     
==========================================
  Files          60       56       -4     
  Lines        3131     3229      +98     
==========================================
- Hits         2327     2277      -50     
- Misses        620      777     +157     
+ Partials      184      175       -9
Impacted Files Coverage Δ
model/marshal.go 59.28% <0%> (-6.05%) ⬇️
model/maps.go 0% <0%> (ø) ⬆️
model/marshal_fastjson.go 60.69% <0%> (-10.69%) ⬇️
transport/debug.go 0% <0%> (ø) ⬆️
transport/discard.go 33.33% <25%> (-16.67%) ⬇️
tracer.go 76.84% <69.38%> (-4.12%) ⬇️
contrib/apmgometrics/gatherer.go 76.92% <76.92%> (ø)
contrib/apmprometheus/gatherer.go 80.64% <80.64%> (ø)
transport/http.go 88.23% <9.09%> (+0.48%) ⬆️
metrics.go 96.29% <96.29%> (ø)
... and 71 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cb5aab9...34ef24e. Read the comment docs.

@axw axw self-assigned this Apr 27, 2018
@axw axw force-pushed the stats-prototype branch 2 times, most recently from 5af695b to 57c45c6 Compare April 27, 2018 02:36
@axw axw changed the title [spike] metrics Metrics support Apr 27, 2018
@axw
Copy link
Member Author

axw commented Apr 27, 2018

Minimal program to send Prometheus's builtin Go metrics:

package main

import (
        "github.com/elastic/apm-agent-go"
        "github.com/elastic/apm-agent-go/contrib/apmprometheus"
        "github.com/prometheus/client_golang/prometheus"
)

func main() {
        elasticapm.DefaultTracer.AddMetricsGatherer(apmprometheus.Wrap(prometheus.DefaultGatherer))
        elasticapm.DefaultTracer.SendMetrics(nil)
}

@axw axw changed the title Metrics support Metrics support (WIP) May 2, 2018
tracer.go Outdated
}
}
}
timestamp := model.Time(time.Now())
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jalvz points out that we need to convert to UTC here

@alvarolobato alvarolobato added this to the 1.0 milestone May 9, 2018
axw added 5 commits May 18, 2018 12:58
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.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants