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

Update version of metrics to fix integration with other tools #40

Closed
wants to merge 1 commit into from

Conversation

bltavares
Copy link

@bltavares bltavares commented Jan 22, 2024

The current version of metrics (0.21.0) uses an older version of macros that point to different global allocators than the current latest version (0.22.0) causing metrics to not be reported by other tools integrating with the metrics facade.

Since metrics-rs/metrics#414, the metrics project now can have different registries, and such, the macros (eg: counter!) have been refactored.

As this is a pre-1.0 project, including axum-prometheus into a project with metrics:0.22.0 register 2 different versions of the metrics crate. So metrics reported by axum-prometheus will be registered on the metrics:0.21.0 global collector, while the project's metrics will use the metrics:0.22.0 global collector.

While the current suggested method of exporting the let (_, handle) as a route will work, as it's pointing to the metrics:0.21.0 collectors, other integrations such as the push-based background task will miss out the layer metrics.

By upgrading this project to metrics:0.22.0 we can ensure it's reporting to the same global collector, and thus integrated with other metrics-based tools.

This commit bumps the metrics version to 0.22.0 as well as fix the macro invocations introduced on the new version.


Thanks for the project :)

The current version of metrics (0.21.0) uses an older version of macros that
point to different global allocators than the current latest version (0.22.0)
causing metrics to not be reported by other tools integrating with the
`metrics` facade.

Since metrics-rs/metrics#414, the `metrics` project now
can have different registries, and such, the macros (eg: `counter!`) have been refactored.

As this is a pre-1.0 project, including axum-prometheus into a project with
`metrics:0.22.0` register 2 different versions of the metrics crate. So metrics
reported by `axum-prometheus` will be registered on the `metrics:0.21.0` global
collector, while the project's metrics will use the `metrics:0.22.0` global
collector.

While the current suggested method of exporting the `let (_, handle)` as a
route will work, as it's pointing to the `metrics:0.21.0` collectors, other
integrations such as the push-based background task will miss out the layer
metrics.

By upgrading this project to `metrics:0.22.0` we can ensure it's reporting to
the same global collector, and thus integrated with other `metrics`-based
tools.

This commit bumps the metrics version to 0.22.0 as well as fix the macro
invocations introduced on the new version.
@Ptrskay3
Copy link
Owner

Appreciate the detailed explanation and all the efforts, but the update did happen in #39. I'll release a new minor version of this crate soon. Thanks again.

@Ptrskay3 Ptrskay3 closed this Jan 22, 2024
@bltavares
Copy link
Author

Oh, cool. I did not notice the other PR when I've started using the lib. Thanks for the release :)

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.

2 participants