-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add more metric dimensions to deployer * feat: add more metric dimensions to gateway * refactor: common metrics code * refactor: forward account name * refactor: add backend feature to deployer * refactor: standardize naming * refactor: cargo sort
- Loading branch information
Showing
11 changed files
with
121 additions
and
23 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use std::{collections::HashMap, convert::Infallible}; | ||
|
||
use async_trait::async_trait; | ||
use axum::extract::{FromRequest, Path, RequestParts}; | ||
use tracing::Span; | ||
|
||
/// Used to record a bunch of metrics info | ||
/// The tracing layer on the server should record a `request.params.<param>` field for each parameter | ||
/// that should be recorded | ||
pub struct Metrics; | ||
|
||
#[async_trait] | ||
impl<B> FromRequest<B> for Metrics | ||
where | ||
B: Send, | ||
{ | ||
type Rejection = Infallible; | ||
|
||
async fn from_request(req: &mut RequestParts<B>) -> Result<Self, Self::Rejection> { | ||
// Get path parameters if they exist | ||
let Path(path): Path<HashMap<String, String>> = match req.extract().await { | ||
Ok(path) => path, | ||
Err(_) => return Ok(Metrics), | ||
}; | ||
|
||
let span = Span::current(); | ||
|
||
for (param, value) in path { | ||
span.record(format!("request.params.{param}").as_str(), value); | ||
} | ||
Ok(Metrics) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod metrics; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#[cfg(feature = "backend")] | ||
pub mod backends; | ||
pub mod database; | ||
pub mod deployment; | ||
pub mod log; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters