File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
opentelemetry-zipkin/src/exporter/model Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -34,12 +34,13 @@ impl Into<annotation::Annotation> for Event {
34
34
}
35
35
}
36
36
37
- /// Converts StatusCode to str
38
- fn from_statuscode_to_str ( status_code : StatusCode ) -> & ' static str {
37
+ /// Converts StatusCode to Option<&'static str>
38
+ /// `Unset` status code is unused.
39
+ fn from_statuscode_to_str ( status_code : StatusCode ) -> Option < & ' static str > {
39
40
match status_code {
40
- StatusCode :: Ok => "OK" ,
41
- StatusCode :: Unset => "UNSET" ,
42
- StatusCode :: Error => "ERROR" ,
41
+ StatusCode :: Ok => Some ( "OK" ) ,
42
+ StatusCode :: Unset => None ,
43
+ StatusCode :: Error => Some ( "ERROR" ) ,
43
44
}
44
45
}
45
46
@@ -90,10 +91,10 @@ pub(crate) fn into_zipkin_span(local_endpoint: Endpoint, span_data: trace::SpanD
90
91
) ,
91
92
) ;
92
93
93
- tags . insert (
94
- "otel.status_code" . into ( ) ,
95
- from_statuscode_to_str ( span_data . status_code ) . into ( ) ,
96
- ) ;
94
+ if let Some ( status_code ) = from_statuscode_to_str ( span_data . status_code ) {
95
+ tags . insert ( "otel.status_code" . into ( ) , status_code . into ( ) ) ;
96
+ }
97
+
97
98
tags. insert ( "otel.status_description" . into ( ) , span_data. status_message ) ;
98
99
99
100
span:: Span :: builder ( )
You can’t perform that action at this time.
0 commit comments