Add otel tracing #2

Merged
dln merged 2 commits from dln/push-mnxrspotsqqk into main 2024-11-26 22:46:02 +01:00
Showing only changes of commit f9b7ee8479 - Show all commits

View file

@ -41,7 +41,16 @@ struct VersionInfo {
method = GET,
path = "/version",
}]
#[tracing::instrument()]
#[tracing::instrument(
skip(rqctx),
fields(
http.method=rqctx.request.method().as_str(),
http.path=rqctx.request.uri().path(),
http.remote_ip=rqctx.request.remote_addr().ip().to_string(),
request_id = rqctx.request_id,
),
err(Debug),
)]
async fn api_version(
rqctx: RequestContext<Arc<()>>,
) -> Result<HttpResponseOk<VersionInfo>, HttpError> {
@ -49,6 +58,8 @@ async fn api_version(
name: env!("CARGO_PKG_NAME").to_string(),
version: env!("CARGO_PKG_VERSION").to_string(),
};
tracing::info!("Someone made a request to /version");
Ok(HttpResponseOk(ver))
}