Skip to content

Commit d71c525

Browse files
committed
💡 fix doctest syntax
1 parent ae0ab07 commit d71c525

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/tools/mod.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ pub fn init_tracer(
4646
/// call with service name and version
4747
///
4848
/// ```rust
49-
/// make_resource(env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"))
49+
/// use axum_tracing_opentelemetry::make_resource;
50+
/// # fn main() {
51+
/// let r = make_resource(env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"));
52+
/// # }
53+
///
5054
/// ```
5155
#[cfg(any(feature = "jaeger", feature = "otlp"))]
5256
pub fn make_resource<S>(service_name: S, service_version: S) -> Resource
@@ -61,6 +65,12 @@ where
6165

6266
/// Search the current opentelemetry trace id into the Context from the current tracing'span.
6367
/// This function can be used to report the trace id into the error message send back to user.
68+
///
69+
/// ```rust
70+
/// let trace_id = axum_tracing_opentelemetry::find_current_trace_id();
71+
/// // json!({ "error" : "xxxxxx", "trace_id": trace_id})
72+
///
73+
/// ```
6474
pub fn find_current_trace_id() -> Option<String> {
6575
use opentelemetry::trace::TraceContextExt;
6676
use tracing_opentelemetry::OpenTelemetrySpanExt;

0 commit comments

Comments
 (0)