File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,11 @@ pub fn init_tracer(
46
46
/// call with service name and version
47
47
///
48
48
/// ```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
+ ///
50
54
/// ```
51
55
#[ cfg( any( feature = "jaeger" , feature = "otlp" ) ) ]
52
56
pub fn make_resource < S > ( service_name : S , service_version : S ) -> Resource
61
65
62
66
/// Search the current opentelemetry trace id into the Context from the current tracing'span.
63
67
/// 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
+ /// ```
64
74
pub fn find_current_trace_id ( ) -> Option < String > {
65
75
use opentelemetry:: trace:: TraceContextExt ;
66
76
use tracing_opentelemetry:: OpenTelemetrySpanExt ;
You can’t perform that action at this time.
0 commit comments