Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clarify that the inner function in the example also has the trace_id
  • Loading branch information
emschwartz committed May 24, 2023
commit 71d51fb4bc343ca5c2b4f1779fbf59db6bda15c5
4 changes: 3 additions & 1 deletion examples/tracing/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ use uuid::Uuid;
// Autometrics looks for a field called `trace_id` and attaches
// that as an exemplar for the metrics it generates.
#[autometrics]
#[instrument(fields(trace_id = %Uuid::new_v4(), foo = "bar"))]
#[instrument(fields(trace_id = %Uuid::new_v4()))]
fn outer_function() {
trace!("Outer function called");
inner_function("hello")
}

// This function will also have the `trace_id` attached as an exemplar
// because it is called within the same span as `outer_function`.
#[autometrics]
#[instrument]
fn inner_function(param: &str) {
Expand Down