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

axum 0.8 #69

Merged
merged 4 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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]
Expand Down
3 changes: 1 addition & 2 deletions examples/base-metric-layer-example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }

3 changes: 1 addition & 2 deletions examples/builder-example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "../../" }

10 changes: 5 additions & 5 deletions examples/builder-example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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(
Expand Down
3 changes: 1 addition & 2 deletions examples/endpoint-type-example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "../../" }

8 changes: 4 additions & 4 deletions examples/endpoint-type-example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}}");
}),
),
)
Expand Down
3 changes: 1 addition & 2 deletions examples/exporter-statsd-example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

3 changes: 1 addition & 2 deletions examples/simple-example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "../../" }

Loading