File tree 2 files changed +8
-7
lines changed
2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -137,19 +137,19 @@ pub trait OpenTelemetrySpanExt {
137
137
/// Sets an OpenTelemetry status for this span.
138
138
/// This is useful for setting the status of a span that was created by a library that does not declare
139
139
/// the otel.status_code field of the span in advance.
140
+ ///
140
141
/// # Examples
141
- ///
142
+ ///
142
143
/// ```rust
143
144
/// use opentelemetry::trace::Status;
144
145
/// use tracing_opentelemetry::OpenTelemetrySpanExt;
145
146
/// use tracing::Span;
146
- ///
147
+ ///
147
148
/// /// // Generate a tracing span as usual
148
149
/// let app_root = tracing::span!(tracing::Level::INFO, "app_start");
149
150
///
150
151
/// // Set the Status of the span to `Status::Ok`.
151
152
/// app_root.set_status(Status::Ok);
152
- ///
153
153
/// ```
154
154
fn set_status ( & self , status : Status ) ;
155
155
}
Original file line number Diff line number Diff line change @@ -51,13 +51,14 @@ fn set_status_ok() {
51
51
52
52
#[ test]
53
53
fn set_status_error ( ) {
54
- let expected_error = Status :: Error { description : std:: borrow:: Cow :: Borrowed ( "Elon put in too much fuel in his rocket!" ) } ;
54
+ let expected_error = Status :: Error {
55
+ description : std:: borrow:: Cow :: Borrowed ( "Elon put in too much fuel in his rocket!" ) ,
56
+ } ;
55
57
let root_span = set_status_helper ( expected_error. clone ( ) ) ;
56
58
assert_eq ! ( expected_error, root_span. status) ;
57
59
}
58
60
59
- fn set_status_helper ( status : Status ) -> SpanData
60
- {
61
+ fn set_status_helper ( status : Status ) -> SpanData {
61
62
let ( _tracer, provider, exporter, subscriber) = test_tracer ( ) ;
62
63
63
64
tracing:: subscriber:: with_default ( subscriber, || {
@@ -72,4 +73,4 @@ fn set_status_helper(status: Status) -> SpanData
72
73
assert_eq ! ( spans. len( ) , 1 ) ;
73
74
74
75
spans. iter ( ) . find ( |s| s. name == "root" ) . unwrap ( ) . clone ( )
75
- }
76
+ }
You can’t perform that action at this time.
0 commit comments