File tree Expand file tree Collapse file tree 2 files changed +11
-14
lines changed
opentelemetry-api/src/trace
opentelemetry-jaeger/src/exporter Expand file tree Collapse file tree 2 files changed +11
-14
lines changed Original file line number Diff line number Diff line change 1
1
use crate :: { trace:: SpanContext , KeyValue } ;
2
2
use std:: borrow:: Cow ;
3
3
use std:: error:: Error ;
4
- use std:: fmt;
5
4
use std:: time:: SystemTime ;
6
5
7
6
/// The interface for a single operation within a trace.
@@ -226,18 +225,6 @@ pub enum SpanKind {
226
225
Internal ,
227
226
}
228
227
229
- impl fmt:: Display for SpanKind {
230
- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
231
- match self {
232
- SpanKind :: Client => write ! ( f, "client" ) ,
233
- SpanKind :: Server => write ! ( f, "server" ) ,
234
- SpanKind :: Producer => write ! ( f, "producer" ) ,
235
- SpanKind :: Consumer => write ! ( f, "consumer" ) ,
236
- SpanKind :: Internal => write ! ( f, "internal" ) ,
237
- }
238
- }
239
- }
240
-
241
228
/// The code representation of the status of a [`Span`].
242
229
///
243
230
/// These values form a total order: Ok > Error > Unset. This means that setting
Original file line number Diff line number Diff line change @@ -764,7 +764,7 @@ fn build_span_tags(
764
764
}
765
765
766
766
if !user_overrides. span_kind && kind != SpanKind :: Internal {
767
- tags. push ( Key :: new ( SPAN_KIND ) . string ( kind . to_string ( ) ) . into ( ) ) ;
767
+ tags. push ( Key :: new ( SPAN_KIND ) . string ( format_span_kind ( kind ) ) . into ( ) ) ;
768
768
}
769
769
770
770
if status_code != StatusCode :: Unset {
@@ -792,6 +792,16 @@ fn build_span_tags(
792
792
tags
793
793
}
794
794
795
+ fn format_span_kind ( kind : SpanKind ) -> & ' static str {
796
+ match kind {
797
+ SpanKind :: Client => "client" ,
798
+ SpanKind :: Server => "server" ,
799
+ SpanKind :: Producer => "producer" ,
800
+ SpanKind :: Consumer => "consumer" ,
801
+ SpanKind :: Internal => "internal" ,
802
+ }
803
+ }
804
+
795
805
const ERROR : & str = "error" ;
796
806
const SPAN_KIND : & str = "span.kind" ;
797
807
const OTEL_STATUS_CODE : & str = "otel.status_code" ;
You can’t perform that action at this time.
0 commit comments