-
Notifications
You must be signed in to change notification settings - Fork 105
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
Add prometheus exporter #619
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #619 +/- ##
==========================================
- Coverage 74.48% 67.98% -6.51%
==========================================
Files 56 61 +5
Lines 1862 2152 +290
==========================================
+ Hits 1387 1463 +76
- Misses 475 689 +214
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I'm very interested in use case 5, since we already have our own web server and do not want to export an additional port. |
Yea, I think this will be the most common use case, we need to find a way to make this easy for users |
I am also interested in use case 5. Will evaluate switching to otel collector but for now this would go in nicely on my current project 😄 |
@albertored are you able to update this PR? I'd like to get prometheus support in so we can get the technical committee to sign off on our metrics implementation so we can go GA. |
@tsloughter I'll try this weekend hoping things have not changed too much. Unfortunately in the last months I was not able to follow the project with constancy |
@albertored I've rebased and modified your version a bit main...travelping:opentelemetry-erlang:feature/prometheus-exporter-for-upstream The reader logic can now be used from a cowboy handler as well (sample included). |
This makes is possible to reuse the prometheus reader logic from other handlers. Add cowboy handler as sample.
88ba99c
to
af3826b
Compare
@tsloughter rebased and pushed with additions from @RoadRunnr, we should still resolve the points in my first comment before merging |
PS: this commit is causing failures in the pipeline since |
The ordering is only used for the tests to get defined ordering for comparing the results. It is therefore not to critical that they are super efficient. The simple sort of the map keys would be enough. I can supply a patch if you want?
point 5 (or use case 5) should be solved. A sample cowboy handler is included.
I do have additional changes pending in travelping/opentelemetry-erlang@bbcfe2f...0d5f677 |
First draft of the Prometheus exporter to collect some feedback.
Open points:
At the moment it is embedded in the
opentelemetry_experimental
app to speed up development, should it be a separate app?As suggested in the spec I used a reader and an exporter but from the user point of view the exporter is masked and its config parameters are on the reader, for example:
default_temporality_mapping
,export_interval_ms
andexporter
options on the reader are overridden, should we emit a warning if the user configures them?The encoding part works but it can be improved for sure, I still need to go through that module again and refactor it. Anyway, any suggestion is welcomed.
The
otel_metric_reader_prometheus
is in reality a supervisor that starts the reader itself and the httpd server if needed. The httpd server is started only if anendpoint_port
is given to the configuration. We can maybe have a more explicit configuration field for this?If the httpd server is not used it should be possible for the user to get the metrics in prometheus format so that he can expose them. This can be done by calling the
otel_metric_reader_prometheus:collect/1
function but it needs the reader pid as an argument, not so user-friendly.How to implement the same behavior of
erlang:float_to_binary(2.0, [short])
that was added in OTP 25? (tests failing for this reason)