File tree 2 files changed +6
-8
lines changed
tracing-opentelemetry/src
2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -585,6 +585,7 @@ impl Timings {
585
585
#[ cfg( test) ]
586
586
mod tests {
587
587
use super :: * ;
588
+ use opentelemetry:: trace:: SpanKind ;
588
589
use std:: sync:: { Arc , Mutex } ;
589
590
use std:: time:: SystemTime ;
590
591
use tracing_subscriber:: prelude:: * ;
@@ -656,7 +657,7 @@ mod tests {
656
657
let subscriber = tracing_subscriber:: registry ( ) . with ( layer ( ) . with_tracer ( tracer. clone ( ) ) ) ;
657
658
658
659
tracing:: subscriber:: with_default ( subscriber, || {
659
- tracing:: debug_span!( "request" , otel. kind = " Server" ) ;
660
+ tracing:: debug_span!( "request" , otel. kind = % SpanKind :: Server ) ;
660
661
} ) ;
661
662
662
663
let recorded_kind = tracer. 0 . lock ( ) . unwrap ( ) . as_ref ( ) . unwrap ( ) . span_kind . clone ( ) ;
@@ -678,7 +679,7 @@ mod tests {
678
679
let _g = existing_cx. attach ( ) ;
679
680
680
681
tracing:: subscriber:: with_default ( subscriber, || {
681
- tracing:: debug_span!( "request" , otel. kind = " Server" ) ;
682
+ tracing:: debug_span!( "request" , otel. kind = % SpanKind :: Server ) ;
682
683
} ) ;
683
684
684
685
let recorded_trace_id = tracer
Original file line number Diff line number Diff line change 22
22
//! * `otel.name`: Override the span name sent to OpenTelemetry exporters.
23
23
//! Setting this field is useful if you want to display non-static information
24
24
//! in your span name.
25
- //! * `otel.kind`: Set the span kind to one of the supported OpenTelemetry
26
- //! [span kinds]. The value should be a string of any of the supported values:
27
- //! `SERVER`, `CLIENT`, `PRODUCER`, `CONSUMER` or `INTERNAL`. Other values are
28
- //! silently ignored.
25
+ //! * `otel.kind`: Set the span kind to one of the supported OpenTelemetry [span kinds].
29
26
//!
30
- //! [span kinds]: https://github.com/open-telemetry/ opentelemetry-specification/blob/master/specification/ trace/api.md#spankind
27
+ //! [span kinds]: https://docs.rs/ opentelemetry/latest/opentelemetry/ trace/enum.SpanKind.html
31
28
//!
32
29
//! ### Semantic Conventions
33
30
//!
34
31
//! OpenTelemetry defines conventional names for attributes of common
35
32
//! operations. These names can be assigned directly as fields, e.g.
36
- //! `trace_span!("request", "otel.kind" = "client" , "http.url" = ..)`, and they
33
+ //! `trace_span!("request", "otel.kind" = %SpanKind::Client , "http.url" = ..)`, and they
37
34
//! will be passed through to your configured OpenTelemetry exporter. You can
38
35
//! find the full list of the operations and their expected field names in the
39
36
//! [semantic conventions] spec.
You can’t perform that action at this time.
0 commit comments