Skip to content

Commit

Permalink
Prefix metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
jennydaman committed Oct 6, 2023
1 parent 0b95e8c commit 8a4c1b1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pypx-DICOMweb/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pypx_dicomweb"
version = "0.1.0"
version = "0.2.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
8 changes: 6 additions & 2 deletions pypx-DICOMweb/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::router::get_router;
use axum::{http::Method, routing::get, Router};
use std::path::PathBuf;
use tower_http::cors::{Any, CorsLayer};
use axum_prometheus::PrometheusMetricLayer;
use axum_prometheus::PrometheusMetricLayerBuilder;

#[tokio::main]
async fn main() {
Expand All @@ -29,7 +29,11 @@ async fn main() {
.allow_methods([Method::GET])
.allow_origin(Any);

let (prometheus_layer, metric_handle) = PrometheusMetricLayer::pair();
let (prometheus_layer, metric_handle) = PrometheusMetricLayerBuilder::new()
.with_prefix("pypx_dicomweb_axum")
.with_ignore_pattern("/metrics")
.with_default_metrics()
.build_pair();
let pypx_dicomweb_router = get_router(pypx)
.layer(prometheus_layer);

Expand Down

0 comments on commit 8a4c1b1

Please sign in to comment.