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

Implement prometheus exporter provider #5053

Merged
merged 5 commits into from
Dec 21, 2022

Conversation

jack-berg
Copy link
Member

Related to #4949.

Prometheus is implemented as a MetricReader rather than MetricExporter so implementing ConfigurableMetricExporterProvider isn't an option. This PR takes a different approach and implements the AutoConfigurationCustomizerProvider, which allows PrometheusCustomizerProvider to customize the SdkMeterProviderBuilder with PrometheusHttpServer when otel.metrics.exporter=prometheus.

We could also add a new SPI for providing named MetricReaders, but we don't actually support custom implementations of MetricReader right now so I don't think that's a good idea.

@jack-berg jack-berg requested a review from a team as a code owner December 19, 2022 22:27
@@ -14,8 +14,6 @@ dependencies {

implementation(project(":semconv"))

compileOnly(project(":exporters:prometheus"))
Copy link
Member Author

Choose a reason for hiding this comment

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

Last exporter compile dependency is gone! Woot!

@codecov
Copy link

codecov bot commented Dec 19, 2022

Codecov Report

Base: 91.17% // Head: 91.21% // Increases project coverage by +0.04% 🎉

Coverage data is based on head (1a02013) compared to base (7f0889a).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5053      +/-   ##
============================================
+ Coverage     91.17%   91.21%   +0.04%     
- Complexity     4871     4877       +6     
============================================
  Files           553      553              
  Lines         14396    14402       +6     
  Branches       1374     1375       +1     
============================================
+ Hits          13125    13137      +12     
+ Misses          883      878       -5     
+ Partials        388      387       -1     
Impacted Files Coverage Δ
...metheus/internal/PrometheusCustomizerProvider.java 100.00% <100.00%> (ø)
.../sdk/autoconfigure/MeterProviderConfiguration.java 78.26% <100.00%> (+0.98%) ⬆️
...sdk/autoconfigure/MetricExporterConfiguration.java 100.00% <100.00%> (ø)
...etry/exporter/prometheus/PrometheusHttpServer.java 81.00% <0.00%> (+2.00%) ⬆️
...nfigure/AutoConfiguredOpenTelemetrySdkBuilder.java 97.31% <0.00%> (+2.68%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@jack-berg jack-berg merged commit 9dfb002 into open-telemetry:main Dec 21, 2022
dmarkwat pushed a commit to dmarkwat/opentelemetry-java that referenced this pull request Dec 30, 2022
* Implement prometheus exporter provider

* Remove stray comment

* Adjust method visibility

* Delete ClasspathUtil
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