mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 20:47:01 +01:00
Make /status less noisy (#2574)
This commit is contained in:
parent
8611bb7135
commit
3bf16d4253
|
@ -24,7 +24,7 @@ pub async fn version_middleware<B>(request: Request<B>, next: Next<B>) -> Respon
|
||||||
|
|
||||||
#[cfg(any(test, debug_assertions))]
|
#[cfg(any(test, debug_assertions))]
|
||||||
/// This is a debug middleware to ensure that /v1/ endpoints only return JSON
|
/// 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 {
|
pub async fn are_we_json_yet<B>(request: Request<B>, next: Next<B>) -> Response {
|
||||||
let uri = request.uri().path().to_string();
|
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.
|
/// 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 {
|
pub async fn kopid_middleware<B>(mut request: Request<B>, next: Next<B>) -> Response {
|
||||||
// generate the event ID
|
// generate the event ID
|
||||||
let eventid = sketching::tracing_forest::id();
|
let eventid = sketching::tracing_forest::id();
|
||||||
|
|
|
@ -25,8 +25,9 @@ impl Default for DefaultMakeSpanKanidmd {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<B> tower_http::trace::MakeSpan<B> 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 {
|
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!(
|
tracing::span!(
|
||||||
Level::INFO,
|
Level::INFO,
|
||||||
"request",
|
"request",
|
||||||
|
@ -77,7 +78,7 @@ impl<B> tower_http::trace::OnResponse<B> for DefaultOnResponseKanidmd {
|
||||||
};
|
};
|
||||||
let (level, msg) =
|
let (level, msg) =
|
||||||
match response.status().is_success() || response.status().is_informational() {
|
match response.status().is_success() || response.status().is_informational() {
|
||||||
true => (Level::INFO, "response sent"),
|
true => (Level::DEBUG, "response sent"),
|
||||||
false => {
|
false => {
|
||||||
if response.status().is_redirection() {
|
if response.status().is_redirection() {
|
||||||
(Level::INFO, "client redirection sent")
|
(Level::INFO, "client redirection sent")
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::prelude::*;
|
|
||||||
|
|
||||||
// TODO: this should *totally* be running the OTEL metrics collector
|
// TODO: this should *totally* be running the OTEL metrics collector
|
||||||
|
|
||||||
pub struct StatusRequestEvent {
|
pub struct StatusRequestEvent {
|
||||||
|
@ -21,7 +19,7 @@ impl StatusActor {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn handle_request(&self, _event: StatusRequestEvent) -> bool {
|
pub async fn handle_request(&self, _event: StatusRequestEvent) -> bool {
|
||||||
admin_info!("status handler complete");
|
trace!("status handler complete");
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue