@@ -42,21 +42,47 @@ pub mod tonic {
42
42
#[ cfg( any( feature = "trace" , feature = "logs" ) ) ]
43
43
use opentelemetry_sdk:: Resource ;
44
44
45
- impl From < opentelemetry_sdk:: InstrumentationLibrary > for InstrumentationScope {
46
- fn from ( library : opentelemetry_sdk:: InstrumentationLibrary ) -> Self {
45
+ impl
46
+ From < (
47
+ opentelemetry_sdk:: InstrumentationLibrary ,
48
+ Option < Cow < ' static , str > > ,
49
+ ) > for InstrumentationScope
50
+ {
51
+ fn from (
52
+ data : (
53
+ opentelemetry_sdk:: InstrumentationLibrary ,
54
+ Option < Cow < ' static , str > > ,
55
+ ) ,
56
+ ) -> Self {
57
+ let ( library, target) = data;
47
58
InstrumentationScope {
48
- name : library. name . into_owned ( ) ,
59
+ name : target
60
+ . map ( |t| t. replace ( "::" , "." ) )
61
+ . unwrap_or_else ( || library. name . into_owned ( ) ) ,
49
62
version : library. version . map ( Cow :: into_owned) . unwrap_or_default ( ) ,
50
63
attributes : Attributes :: from ( library. attributes ) . 0 ,
51
64
..Default :: default ( )
52
65
}
53
66
}
54
67
}
55
68
56
- impl From < & opentelemetry_sdk:: InstrumentationLibrary > for InstrumentationScope {
57
- fn from ( library : & opentelemetry_sdk:: InstrumentationLibrary ) -> Self {
69
+ impl
70
+ From < (
71
+ & opentelemetry_sdk:: InstrumentationLibrary ,
72
+ Option < Cow < ' static , str > > ,
73
+ ) > for InstrumentationScope
74
+ {
75
+ fn from (
76
+ data : (
77
+ & opentelemetry_sdk:: InstrumentationLibrary ,
78
+ Option < Cow < ' static , str > > ,
79
+ ) ,
80
+ ) -> Self {
81
+ let ( library, target) = data;
58
82
InstrumentationScope {
59
- name : library. name . to_string ( ) ,
83
+ name : target
84
+ . map ( |t| t. replace ( "::" , "." ) )
85
+ . unwrap_or_else ( || library. name . to_string ( ) ) ,
60
86
version : library
61
87
. version
62
88
. as_ref ( )
0 commit comments