Skip to content

Commit

Permalink
only log trace id if we actually have a valid trace id
Browse files Browse the repository at this point in the history
Signed-off-by: clux <[email protected]>
  • Loading branch information
clux committed Oct 9, 2024
1 parent 481b497 commit ed5e988
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ pub struct Context {
#[instrument(skip(ctx, doc), fields(trace_id))]
async fn reconcile(doc: Arc<Document>, ctx: Arc<Context>) -> Result<Action> {
let trace_id = telemetry::get_trace_id();
Span::current().record("trace_id", field::display(&trace_id));
if trace_id != opentelemetry::trace::TraceId::INVALID {
Span::current().record("trace_id", field::display(&trace_id));
}
let _timer = ctx.metrics.reconcile.count_and_measure(&trace_id);
ctx.diagnostics.write().await.last_event = Utc::now();
let ns = doc.namespace().unwrap(); // doc is namespace scoped
Expand Down

0 comments on commit ed5e988

Please sign in to comment.