From 7ebc359a236d3f2b47fcefb197bb4af0c98915ce Mon Sep 17 00:00:00 2001 From: Yann Simon Date: Sat, 5 Oct 2024 17:38:48 +0200 Subject: [PATCH 1/3] axum 0.8 https://github.com/tokio-rs/axum/releases/tag/axum-v0.8.0-alpha.1 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 9a32783..8181239 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ categories = ["asynchronous", "network-programming", "web-programming", "develop repository = "https://github.com/Ptrskay3/axum-prometheus" [dependencies] -axum = "0.7.1" +axum = "0.8.0-alpha.1" http = "1.0.0" http-body = "1.0.0" metrics = "0.23.0" From 26ec3af3c4a7d6d3843eb453d57db9e1f8ee01fb Mon Sep 17 00:00:00 2001 From: Yann Simon Date: Mon, 7 Oct 2024 10:47:01 +0200 Subject: [PATCH 2/3] update matchit and examples --- Cargo.toml | 2 +- examples/base-metric-layer-example/Cargo.toml | 3 +-- examples/builder-example/Cargo.toml | 3 +-- examples/builder-example/src/main.rs | 10 +++++----- examples/endpoint-type-example/Cargo.toml | 3 +-- examples/endpoint-type-example/src/main.rs | 8 ++++---- examples/exporter-statsd-example/Cargo.toml | 3 +-- examples/simple-example/Cargo.toml | 3 +-- 8 files changed, 15 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index aa0ae07..1f26ab9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ tokio = { version = "1.20.1", features = ["rt-multi-thread", "macros"] } tower-http = "0.6.1" bytes = "1.2.1" futures-core = "0.3.24" -matchit = "0.7" +matchit = "0.8" once_cell = "1.17.0" [dev-dependencies] diff --git a/examples/base-metric-layer-example/Cargo.toml b/examples/base-metric-layer-example/Cargo.toml index 7a83347..1d2a84a 100644 --- a/examples/base-metric-layer-example/Cargo.toml +++ b/examples/base-metric-layer-example/Cargo.toml @@ -5,9 +5,8 @@ edition = "2021" publish = false [dependencies] -axum = "0.7.1" +axum = "0.8.0-alpha.1" tokio = { version = "1.0", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } axum-prometheus = { path = "../../", features = ["push-gateway"] } - diff --git a/examples/builder-example/Cargo.toml b/examples/builder-example/Cargo.toml index 62d7133..1aee61c 100644 --- a/examples/builder-example/Cargo.toml +++ b/examples/builder-example/Cargo.toml @@ -5,9 +5,8 @@ edition = "2021" publish = false [dependencies] -axum = "0.7.1" +axum = "0.8.0-alpha.1" tokio = { version = "1.0", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } axum-prometheus = { path = "../../" } - diff --git a/examples/builder-example/src/main.rs b/examples/builder-example/src/main.rs index cf7dd4b..0d3162c 100644 --- a/examples/builder-example/src/main.rs +++ b/examples/builder-example/src/main.rs @@ -28,7 +28,7 @@ async fn main() { // ignore reporting requests that match "/metrics" .with_ignore_pattern("/metrics") // if the any of the second argument matches, report them at the `/foo` endpoint - .with_group_patterns_as("/foo", &["/foo/:bar", "/foo/:bar/:baz"]) + .with_group_patterns_as("/foo", &["/foo/{bar}", "/foo/{bar}/{baz}"]) // build a custom PrometheusHandle .with_metrics_from_fn(|| { PrometheusBuilder::new() @@ -44,15 +44,15 @@ async fn main() { let app = Router::new() .route( - "/foo/:bar", + "/foo/{bar}", get(|| async { - tracing::debug!("calling /foo/:bar"); + tracing::debug!("calling /foo/{{bar}}"); }), ) .route( - "/foo/:bar/:baz", + "/foo/{bar}/{baz}", get(|| async { - tracing::debug!("calling /foo/:bar/:baz"); + tracing::debug!("calling /foo/{{bar}}/{{baz}}"); }), ) .route( diff --git a/examples/endpoint-type-example/Cargo.toml b/examples/endpoint-type-example/Cargo.toml index 397103f..6947efd 100644 --- a/examples/endpoint-type-example/Cargo.toml +++ b/examples/endpoint-type-example/Cargo.toml @@ -5,9 +5,8 @@ edition = "2021" publish = false [dependencies] -axum = "0.7.1" +axum = "0.8.0-alpha.1" tokio = { version = "1.0", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } axum-prometheus = { path = "../../" } - diff --git a/examples/endpoint-type-example/src/main.rs b/examples/endpoint-type-example/src/main.rs index 4fb22d6..0a1c68f 100644 --- a/examples/endpoint-type-example/src/main.rs +++ b/examples/endpoint-type-example/src/main.rs @@ -28,18 +28,18 @@ async fn main() { let app = Router::new() .route( - "/foo/:bar", + "/foo/{bar}", get(|| async { - tracing::debug!("calling /foo/:bar"); + tracing::debug!("calling /foo/{{bar}}"); }), ) .nest( "/baz", Router::new().route( - "/qux/:a", + "/qux/{a}", get(|| async { // Calling `/baz/qux/2`, this'll show up as `endpoint="/baz/qux/2_changed` because of the fallback function. - tracing::debug!("calling /baz/qux/:a"); + tracing::debug!("calling /baz/qux/{{a}}"); }), ), ) diff --git a/examples/exporter-statsd-example/Cargo.toml b/examples/exporter-statsd-example/Cargo.toml index 428ab49..dc3a6a1 100644 --- a/examples/exporter-statsd-example/Cargo.toml +++ b/examples/exporter-statsd-example/Cargo.toml @@ -5,10 +5,9 @@ edition = "2021" publish = false [dependencies] -axum = "0.7.1" +axum = "0.8.0-alpha.1" tokio = { version = "1.0", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } metrics-exporter-statsd = "0.8.0" axum-prometheus = { path = "../../", default-features = false } - diff --git a/examples/simple-example/Cargo.toml b/examples/simple-example/Cargo.toml index 37406a5..69d371b 100644 --- a/examples/simple-example/Cargo.toml +++ b/examples/simple-example/Cargo.toml @@ -5,9 +5,8 @@ edition = "2021" publish = false [dependencies] -axum = "0.7.1" +axum = "0.8.0-alpha.1" tokio = { version = "1.0", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } axum-prometheus = { path = "../../" } - From 9de885d0f655e83c2b7cfb4c04d91bbeba779655 Mon Sep 17 00:00:00 2001 From: Yann Simon Date: Thu, 10 Oct 2024 09:47:12 +0200 Subject: [PATCH 3/3] add changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf00b83..cf27699 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. # [Unreleased] +- Compatibility with `axum = "0.8"`. This also updates `matchit` to `0.8`, changing how group pattern are described: + for example, `with_group_patterns_as("/foo", &["/foo/:bar"])` needs to be changed to `with_group_patterns_as("/foo", &["/foo/{bar}"])`. + The metrics values are also impacted: for example, the value `"/foo/:bar"` is now `"/foo/{bar}"`. [\#69] + # [0.7.0] - 2024-07-20 ### Changed