Add trace endpoint for testing traces
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
d99024d27a
commit
41dd742407
1 changed files with 5 additions and 0 deletions
|
@ -37,6 +37,10 @@ async fn stats(Path(rsn): Path<String>) -> impl IntoResponse {
|
||||||
(StatusCode::OK, convert_into_metrics(resp))
|
(StatusCode::OK, convert_into_metrics(resp))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn get_trace() -> impl IntoResponse {
|
||||||
|
let trace_id = axum_tracing_opentelemetry::find_current_trace_id();
|
||||||
|
axum::Json(serde_json::json!({ "my_trace_id": trace_id }))
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<(), BoxError> {
|
async fn main() -> Result<(), BoxError> {
|
||||||
|
@ -45,6 +49,7 @@ async fn main() -> Result<(), BoxError> {
|
||||||
let app = Router::new()
|
let app = Router::new()
|
||||||
.route("/worlds", get(worlds))
|
.route("/worlds", get(worlds))
|
||||||
.route("/stats/:rsn", get(stats))
|
.route("/stats/:rsn", get(stats))
|
||||||
|
.route("/trace", get(get_trace))
|
||||||
.layer(response_with_trace_layer())
|
.layer(response_with_trace_layer())
|
||||||
.layer(opentelemetry_tracing_layer());
|
.layer(opentelemetry_tracing_layer());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue