Skip to content

Commit

Permalink
Update build script
Browse files Browse the repository at this point in the history
  • Loading branch information
hwrdtm committed Jun 3, 2024
1 parent a6a4e5c commit ee14669
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion opentelemetry-proto/tests/grpc_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,22 @@ fn build_tonic() {
}

// add custom serializer and deserializer for AnyValue
for path in ["common.v1.KeyValue.value", "logs.v1.LogRecord.body"] {
for path in ["logs.v1.LogRecord.body"] {
builder = builder
.field_attribute(path, "#[cfg_attr(feature =\"with-serde\", serde(serialize_with = \"crate::proto::serializers::serialize_to_value\", deserialize_with = \"crate::proto::serializers::deserialize_from_value\"))]");
}

// flatten
for path in [
"common.v1.AnyValue.value",
"metrics.v1.Metric.data",
"metrics.v1.NumberDataPoint.value",
"metrics.v1.Exemplar.value",
] {
builder =
builder.field_attribute(path, "#[cfg_attr(feature =\"with-serde\", serde(flatten))]");
}

builder
.out_dir(out_dir.path())
.compile(TONIC_PROTO_FILES, TONIC_INCLUDES)
Expand Down

0 comments on commit ee14669

Please sign in to comment.