Make /status less noisy (#2574)

This commit is contained in:
Firstyear 2024-02-22 17:34:46 +10:00 committed by GitHub
parent 8611bb7135
commit 3bf16d4253
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 7 deletions

View file

@ -24,7 +24,7 @@ pub async fn version_middleware<B>(request: Request<B>, next: Next<B>) -> Respon
#[cfg(any(test, debug_assertions))]
/// This is a debug middleware to ensure that /v1/ endpoints only return JSON
#[instrument(level = "debug", name = "are_we_json_yet", skip_all)]
#[instrument(level = "trace", name = "are_we_json_yet", skip_all)]
pub async fn are_we_json_yet<B>(request: Request<B>, next: Next<B>) -> Response {
let uri = request.uri().path().to_string();
@ -52,7 +52,7 @@ pub struct KOpId {
}
/// This runs at the start of the request, adding an extension with `KOpId` which has useful things inside it.
#[instrument(level = "debug", name = "kopid_middleware", skip_all)]
#[instrument(level = "trace", name = "kopid_middleware", skip_all)]
pub async fn kopid_middleware<B>(mut request: Request<B>, next: Next<B>) -> Response {
// generate the event ID
let eventid = sketching::tracing_forest::id();

View file

@ -25,8 +25,9 @@ impl Default for DefaultMakeSpanKanidmd {
}
impl<B> tower_http::trace::MakeSpan<B> for DefaultMakeSpanKanidmd {
#[instrument(name = "handle_request", skip_all, fields(latency, status_code))]
fn make_span(&mut self, request: &Request<B>) -> Span {
// Needs to be at info to ensure that there is always a span for each
// tracing event to hook into.
tracing::span!(
Level::INFO,
"request",
@ -77,7 +78,7 @@ impl<B> tower_http::trace::OnResponse<B> for DefaultOnResponseKanidmd {
};
let (level, msg) =
match response.status().is_success() || response.status().is_informational() {
true => (Level::INFO, "response sent"),
true => (Level::DEBUG, "response sent"),
false => {
if response.status().is_redirection() {
(Level::INFO, "client redirection sent")

View file

@ -2,8 +2,6 @@
use uuid::Uuid;
use crate::prelude::*;
// TODO: this should *totally* be running the OTEL metrics collector
pub struct StatusRequestEvent {
@ -21,7 +19,7 @@ impl StatusActor {
}
pub async fn handle_request(&self, _event: StatusRequestEvent) -> bool {
admin_info!("status handler complete");
trace!("status handler complete");
true
}
}