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

Make the metrics registry configurable #134

Merged
merged 16 commits into from
Jul 31, 2023
Merged

Make the metrics registry configurable #134

merged 16 commits into from
Jul 31, 2023

Conversation

emschwartz
Copy link
Contributor

  • Switch to AutometricsSettingsBuilder
  • Include settings in PrometheusExporter
  • Enable prometheus_client Registry to be passed in
  • Document adding the prometheus client registry
  • Enable passing a prometheus::Registry to the settings

Resolves #20

@emschwartz emschwartz marked this pull request as ready for review July 28, 2023 08:30
@emschwartz emschwartz requested a review from a team July 28, 2023 08:32
Copy link
Member

@mellowagain mellowagain left a comment

Choose a reason for hiding this comment

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

nits

@@ -82,6 +82,7 @@ axum = { version = "0.6", features = ["tokio"] }
criterion = "0.5"
http = "0.2"
opentelemetry_sdk = "0.19"
prometheus-client = "0.21"
Copy link
Member

Choose a reason for hiding this comment

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

this isn't optional? you activate it with dep:prometheus-client like 60 lines above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It needs to be in the dev dependencies because it's used in the examples in the docs, which fail to compile without that being there

autometrics/tests/settings_service_name_test.rs Outdated Show resolved Hide resolved
CHANGELOG.md Outdated
Comment on lines 53 to 54
- `backends::prometheus_client::REGISTRY` was removed. The `Registry` can now be accessed as
a property on the `AutometricsSettings` struct
Copy link
Member

Choose a reason for hiding this comment

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

From the point of view of the users, the registry is only accessible if they chose the prometheus-client feature, I don't know if we should specify the feature in the CHANGELOG, or make the registry in AutometricsSettings::prometheus_registry pub instead of pub(crate), but it feels a little inconsistent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a getter method on the settings for the prometheus::Registry as well

@emschwartz emschwartz merged commit 15a7975 into main Jul 31, 2023
1 check passed
@emschwartz emschwartz deleted the registry-setting branch July 31, 2023 13:52
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.

Make the metrics registry configurable
3 participants