File tree 3 files changed +9
-0
lines changed
exporter/opentelemetry-exporter-otlp-proto-common
src/opentelemetry/exporter/otlp/proto/common/_internal
3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
27
27
([ #4103 ] ( https://github.com/open-telemetry/opentelemetry-python/pull/4103 ) )
28
28
- Update semantic conventions to version 1.27.0
29
29
([ #4104 ] ( https://github.com/open-telemetry/opentelemetry-python/pull/4104 ) )
30
+ - Add support to type bytes for OTLP AnyValue
31
+ ([ #4128 ] ( https://github.com/open-telemetry/opentelemetry-python/pull/4128 ) )
30
32
- Export ExponentialHistogram and ExponentialHistogramDataPoint
31
33
([ #4134 ] ( https://github.com/open-telemetry/opentelemetry-python/pull/4134 ) )
32
34
- Implement Client Key and Certificate File Support for All OTLP Exporters
Original file line number Diff line number Diff line change @@ -75,6 +75,8 @@ def _encode_value(value: Any) -> PB2AnyValue:
75
75
return PB2AnyValue (int_value = value )
76
76
if isinstance (value , float ):
77
77
return PB2AnyValue (double_value = value )
78
+ if isinstance (value , bytes ):
79
+ return PB2AnyValue (bytes_value = value )
78
80
if isinstance (value , Sequence ):
79
81
return PB2AnyValue (
80
82
array_value = PB2ArrayValue (values = [_encode_value (v ) for v in value ])
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ def test_encode_attributes_all_kinds(self):
36
36
"greet" : ["hola" , "bonjour" ], # Sequence[str]
37
37
"data" : [1 , 2 ], # Sequence[int]
38
38
"data_granular" : [1.4 , 2.4 ], # Sequence[float]
39
+ "binary_data" : b"x00\x01 \x02 " , # bytes
39
40
}
40
41
)
41
42
self .assertEqual (
@@ -80,6 +81,10 @@ def test_encode_attributes_all_kinds(self):
80
81
)
81
82
),
82
83
),
84
+ PB2KeyValue (
85
+ key = "binary_data" ,
86
+ value = PB2AnyValue (bytes_value = b"x00\x01 \x02 " ),
87
+ ),
83
88
],
84
89
)
85
90
You can’t perform that action at this time.
0 commit comments