From 23baea89b6a6651eb6e31f13b4164fe2e30c319a Mon Sep 17 00:00:00 2001 From: miniduikboot Date: Tue, 15 Oct 2024 22:59:45 +0200 Subject: [PATCH] Update metrics to 0.24 --- .github/workflows/ci.yml | 6 +++--- CHANGELOG.md | 5 ++++- autometrics/Cargo.toml | 8 ++++---- autometrics/build.rs | 4 ++-- autometrics/src/README.md | 2 +- examples/custom-metrics/README.md | 2 +- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ff1b90..f243f28 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,21 +19,21 @@ jobs: # Lint # Note: GitHub hosted runners using the latest stable version of Rust have Clippy pre-installed. - - run: cargo clippy --features=metrics-0_21,prometheus-exporter + - run: cargo clippy --features=metrics-0_24,prometheus-exporter - run: cargo clippy --features=prometheus-0_13 - run: cargo clippy --features=prometheus-client-0_22 - run: cargo clippy --features=opentelemetry-0_24 # Run the tests with each of the different metrics libraries - run: cargo test --features=prometheus-exporter - - run: cargo test --features=prometheus-exporter,metrics-0_21 + - run: cargo test --features=prometheus-exporter,metrics-0_24 - run: cargo test --features=prometheus-exporter,prometheus-0_13 - run: cargo test --features=prometheus-exporter,prometheus-client-0_22,exemplars-tracing - run: cargo test --features=prometheus-exporter,prometheus-client-0_22,exemplars-tracing-opentelemetry-0_25 - run: cargo test --features=prometheus-exporter,opentelemetry-0_24 # Build the crate using the other optional features - - run: cargo build --features=metrics-0_21,custom-objective-percentile,custom-objective-latency + - run: cargo build --features=metrics-0_24,custom-objective-percentile,custom-objective-latency # Install protoc for the examples - uses: arduino/setup-protoc@v3 diff --git a/CHANGELOG.md b/CHANGELOG.md index b79ef56..f09c9fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased -- +### Breaking changes +- `metrics` has been updated to v0.24 (#183) + New feature flag: `metrics-0_24` + Removed feature flag: `metrics-0_21` ## [2.0.0](https://github.com/autometrics-dev/autometrics-rs/releases/tag/v2.0.0) - 2024-07-25 diff --git a/autometrics/Cargo.toml b/autometrics/Cargo.toml index 98f4a91..72dddd2 100644 --- a/autometrics/Cargo.toml +++ b/autometrics/Cargo.toml @@ -14,13 +14,13 @@ readme = "README.md" [features] # Metrics backends -metrics-0_21 = ["dep:metrics"] +metrics-0_24 = ["dep:metrics"] opentelemetry-0_24 = ["opentelemetry/metrics", "dep:prometheus"] prometheus-0_13 = ["dep:prometheus"] prometheus-client-0_22 = ["dep:prometheus-client"] # Deprecated feature flags -metrics = ["metrics-0_21"] +metrics = ["metrics-0_24"] opentelemetry = ["opentelemetry-0_24"] prometheus = ["prometheus-0_13"] prometheus-client = ["prometheus-client-0_22"] @@ -94,11 +94,11 @@ thiserror = "1" opentelemetry = { version = "0.24", default-features = false, optional = true } # Use for metrics feature -metrics = { version = "0.21", default-features = false, optional = true } +metrics = { version = "0.24", default-features = false, optional = true } # Used for prometheus-exporter feature http = { version = "1.0.0", optional = true } -metrics-exporter-prometheus = { version = "0.12", default-features = false, optional = true } +metrics-exporter-prometheus = { version = "0.16", default-features = false, optional = true } opentelemetry-prometheus = { version = "0.17", optional = true } opentelemetry_sdk = { version = "0.24.1", default-features = false, features = [ "metrics", diff --git a/autometrics/build.rs b/autometrics/build.rs index dfea867..99105e4 100644 --- a/autometrics/build.rs +++ b/autometrics/build.rs @@ -4,7 +4,7 @@ pub fn main() { println!("cargo:rerun-if-changed=build.rs"); #[cfg(feature = "metrics")] - println!("cargo:warning=The `metrics` feature is deprecated and will be removed in the next version. Please use `metrics-0_21` instead."); + println!("cargo:warning=The `metrics` feature is deprecated and will be removed in the next version. Please use `metrics-0_24` instead."); #[cfg(feature = "opentelemetry")] println!("cargo:warning=The `opentelemetry` feature is deprecated and will be removed in the next version. Please use `opentelemetry-0_24` instead."); #[cfg(feature = "prometheus")] @@ -16,7 +16,7 @@ pub fn main() { cfg_aliases! { // Backends - metrics: { any(feature = "metrics", feature = "metrics-0_21") }, + metrics: { any(feature = "metrics", feature = "metrics-0_24") }, opentelemetry: { any(feature = "opentelemetry", feature = "opentelemetry-0_24") }, prometheus: { any(feature = "prometheus", feature = "prometheus-0_13") }, prometheus_client_feature: { any(feature = "prometheus-client", feature = "prometheus-client-0_22") }, diff --git a/autometrics/src/README.md b/autometrics/src/README.md index 582ffc2..5e61b74 100644 --- a/autometrics/src/README.md +++ b/autometrics/src/README.md @@ -154,7 +154,7 @@ If you require more customization than these offered feature flags, enable just > If you are exporting metrics yourself rather than using the `prometheus-exporter`, you must ensure that you are using the exact same version of the metrics library as `autometrics` (and it must come from `crates.io` rather than git or another source). If not, the autometrics metrics will not appear in your exported metrics. - `opentelemetry-0_24` - use the [opentelemetry](https://crates.io/crates/opentelemetry) crate for producing metrics. -- `metrics-0_21` - use the [metrics](https://crates.io/crates/metrics) crate for producing metrics +- `metrics-0_24` - use the [metrics](https://crates.io/crates/metrics) crate for producing metrics - `prometheus-0_13` - use the [prometheus](https://crates.io/crates/prometheus) crate for producing metrics - `prometheus-client-0_22` - use the official [prometheus-client](https://crates.io/crates/prometheus-client) crate for producing metrics diff --git a/examples/custom-metrics/README.md b/examples/custom-metrics/README.md index e2a47e6..551659b 100644 --- a/examples/custom-metrics/README.md +++ b/examples/custom-metrics/README.md @@ -13,7 +13,7 @@ cargo run -p example-custom-metrics --features=opentelemetry-0_20 ### Using the `metrics` crate ```shell -cargo run -p example-custom-metrics --features=metrics-0_21 +cargo run -p example-custom-metrics --features=metrics-0_24 ``` ### Using the `prometheus` crate