Skip to content

Commit a6a4e5c

Browse files
committed
Fix serde
Make compatible with Collector serde shape
1 parent 54b807f commit a6a4e5c

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

opentelemetry-proto/src/proto/tonic/opentelemetry.proto.common.v1.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub struct AnyValue {
1111
/// The value is one of the listed fields. It is valid for all values to be unspecified
1212
/// in which case this AnyValue is considered to be "empty".
1313
#[prost(oneof = "any_value::Value", tags = "1, 2, 3, 4, 5, 6, 7")]
14+
#[cfg_attr(feature = "with-serde", serde(flatten))]
1415
pub value: ::core::option::Option<any_value::Value>,
1516
}
1617
/// Nested message and enum types in `AnyValue`.
@@ -80,13 +81,6 @@ pub struct KeyValue {
8081
#[prost(string, tag = "1")]
8182
pub key: ::prost::alloc::string::String,
8283
#[prost(message, optional, tag = "2")]
83-
#[cfg_attr(
84-
feature = "with-serde",
85-
serde(
86-
serialize_with = "crate::proto::serializers::serialize_to_value",
87-
deserialize_with = "crate::proto::serializers::deserialize_from_value"
88-
)
89-
)]
9084
pub value: ::core::option::Option<AnyValue>,
9185
}
9286
/// InstrumentationScope is a message representing the instrumentation scope information

opentelemetry-proto/src/proto/tonic/opentelemetry.proto.metrics.v1.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ pub struct Metric {
181181
/// reported value type for the data points, as well as the relatationship to
182182
/// the time interval over which they are reported.
183183
#[prost(oneof = "metric::Data", tags = "5, 7, 9, 10, 11")]
184+
#[cfg_attr(feature = "with-serde", serde(flatten))]
184185
pub data: ::core::option::Option<metric::Data>,
185186
}
186187
/// Nested message and enum types in `Metric`.
@@ -325,6 +326,7 @@ pub struct NumberDataPoint {
325326
/// The value itself. A point is considered invalid when one of the recognized
326327
/// value fields is not present inside this oneof.
327328
#[prost(oneof = "number_data_point::Value", tags = "4, 6")]
329+
#[cfg_attr(feature = "with-serde", serde(flatten))]
328330
pub value: ::core::option::Option<number_data_point::Value>,
329331
}
330332
/// Nested message and enum types in `NumberDataPoint`.
@@ -674,6 +676,7 @@ pub struct Exemplar {
674676
/// considered invalid when one of the recognized value fields is not present
675677
/// inside this oneof.
676678
#[prost(oneof = "exemplar::Value", tags = "3, 6")]
679+
#[cfg_attr(feature = "with-serde", serde(flatten))]
677680
pub value: ::core::option::Option<exemplar::Value>,
678681
}
679682
/// Nested message and enum types in `Exemplar`.

0 commit comments

Comments
 (0)