Skip to content

Commit

Permalink
editoast: reduce logging level to trace for some verbose events
Browse files Browse the repository at this point in the history
Are demoted to trace level:

* Query payloads sent to core
* PG connection instrumentation

Signed-off-by: Leo Valais <[email protected]>
  • Loading branch information
leovalais committed Dec 16, 2024
1 parent 4edb1b4 commit 5d127e0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl Instrumentation for TracingInstrumentation {
match event {
InstrumentationEvent::StartEstablishConnection { url, .. } => {
let url = Url::parse(url).unwrap();
let span = tracing::info_span!(
let span = tracing::trace_span!(
"connection",
// opentelemetry_semantic_conventions::attribute::DB_SYSTEM
"db.system" = "postgresql",
Expand All @@ -40,7 +40,7 @@ impl Instrumentation for TracingInstrumentation {
);
{
let _guard = span.enter();
tracing::debug!("establishing a connection");
tracing::trace!("establishing a connection");
}
self.connection_span = span;
}
Expand All @@ -54,7 +54,7 @@ impl Instrumentation for TracingInstrumentation {
);
tracing::warn!("failed to establish a connection");
} else {
tracing::debug!("connection established");
tracing::trace!("connection established");
}
}
self.connection_span = tracing::Span::none();
Expand All @@ -69,15 +69,15 @@ impl Instrumentation for TracingInstrumentation {
);
{
let _guard = span.enter();
tracing::debug!("starting query");
tracing::trace!("starting query");
}
if let Some(_existing_span) = self.query_spans.take() {
tracing::warn!("a query was already started: are you pipelining queries on the same connection?");
}
self.query_spans = Some(span);
}
InstrumentationEvent::CacheQuery { .. } => {
tracing::debug!("caching query");
tracing::trace!("caching query");
}
InstrumentationEvent::FinishQuery { query, error, .. } => {
let span = self
Expand All @@ -96,7 +96,7 @@ impl Instrumentation for TracingInstrumentation {
);
tracing::warn!("failed to execute the query");
} else {
tracing::debug!("query finished");
tracing::trace!("query finished");
}
}
InstrumentationEvent::BeginTransaction { depth, .. } => {
Expand All @@ -110,7 +110,7 @@ impl Instrumentation for TracingInstrumentation {
);
{
let _guard = span.enter();
tracing::debug!("beginning transaction");
tracing::trace!("beginning transaction");
}
self.transaction_spans.push_back(span);
}
Expand All @@ -125,7 +125,7 @@ impl Instrumentation for TracingInstrumentation {
opentelemetry_semantic_conventions::attribute::DB_OPERATION_NAME,
"commit_transaction",
);
tracing::debug!("committing transaction");
tracing::trace!("committing transaction");
}
InstrumentationEvent::RollbackTransaction { depth, .. } => {
debug_assert_eq!(self.transaction_spans.len(), depth.get() as usize);
Expand All @@ -138,7 +138,7 @@ impl Instrumentation for TracingInstrumentation {
opentelemetry_semantic_conventions::attribute::DB_OPERATION_NAME,
"rollback_transaction",
);
tracing::debug!("rollbacking transaction");
tracing::trace!("rollbacking transaction");
}
_ => {
tracing::warn!("unknown instrumentation event, maybe 'InstrumentationEvent' evolved since last time this code was updated?");
Expand Down
4 changes: 2 additions & 2 deletions editoast/src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ use serde::Deserialize;
use serde::Serialize;
use serde_json::Value;
use thiserror::Error;
use tracing::debug;
use tracing::error;
use tracing::trace;

#[cfg(test)]
use crate::core::mocking::MockingError;
Expand Down Expand Up @@ -95,7 +95,7 @@ impl CoreClient {
body: Option<&B>,
infra_id: Option<i64>,
) -> Result<R::Response> {
debug!(
trace!(
target: "editoast::coreclient",
body = body.and_then(|b| serde_json::to_string_pretty(b).ok()).unwrap_or_default(),
"Request content");
Expand Down

0 comments on commit 5d127e0

Please sign in to comment.