-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pyth-rng] A few small improvements (#1114)
* more stuff * build * cleanup * Update pyth-rng/src/command/generate.rs Co-authored-by: Reisen <[email protected]> * Update pyth-rng/src/command/generate.rs Co-authored-by: Reisen <[email protected]> * Update pyth-rng/src/command/generate.rs Co-authored-by: Reisen <[email protected]> * tracing --------- Co-authored-by: Reisen <[email protected]>
- Loading branch information
Showing
16 changed files
with
305 additions
and
62 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
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,11 @@ | ||
use axum::{ | ||
http::StatusCode, | ||
response::{ | ||
IntoResponse, | ||
Response, | ||
}, | ||
}; | ||
|
||
pub async fn live() -> Response { | ||
(StatusCode::OK, "OK").into_response() | ||
} |
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,20 @@ | ||
//! Exposing prometheus metrics via HTTP in openmetrics format. | ||
use { | ||
axum::{ | ||
extract::State, | ||
response::IntoResponse, | ||
}, | ||
prometheus_client::encoding::text::encode, | ||
}; | ||
|
||
pub async fn metrics(State(state): State<crate::api::ApiState>) -> impl IntoResponse { | ||
let registry = state.metrics.registry.read().await; | ||
let mut buffer = String::new(); | ||
|
||
// Should not fail if the metrics are valid and there is memory available | ||
// to write to the buffer. | ||
encode(&mut buffer, ®istry).unwrap(); | ||
|
||
buffer | ||
} |
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,13 @@ | ||
use axum::{ | ||
http::StatusCode, | ||
response::{ | ||
IntoResponse, | ||
Response, | ||
}, | ||
}; | ||
|
||
pub async fn ready() -> Response { | ||
// TODO: are there useful checks here? At the moment, everything important (specifically hash | ||
// chain computation) occurs synchronously on startup. | ||
(StatusCode::OK, "OK").into_response() | ||
} |
Oops, something went wrong.