Skip to content

Commit

Permalink
refactor: adjust prometheus metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
vicanso committed Dec 22, 2024
1 parent 3c27551 commit fefb2f3
Show file tree
Hide file tree
Showing 2 changed files with 203 additions and 131 deletions.
14 changes: 8 additions & 6 deletions src/proxy/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,12 +511,6 @@ impl ProxyHttp for Server {
}
}

// set perometheus stats
#[cfg(feature = "full")]
if let Some(prom) = &self.prometheus {
prom.before();
}

// locations not found
let Some(locations) = get_server_locations(&self.name) else {
return Ok(());
Expand All @@ -537,6 +531,14 @@ impl ProxyHttp for Server {
break;
}
}
// set perometheus stats
#[cfg(feature = "full")]
if let Some(prom) = &self.prometheus {
let location_name =
ctx.location.as_ref().map_or("", |item| &item.name);
prom.before(location_name);
}

if let Some(location) = &ctx.location {
location
.validate_content_length(header)
Expand Down
Loading

0 comments on commit fefb2f3

Please sign in to comment.