Skip to content

Commit b02d454

Browse files
chore!: update protobufs to be in sync with datadog-agent (#2180)
# What does this PR do? - Update protobufs to be in sync with datadog-agent * `containerDebug` * `additional_metric_tags` - Update `DATADOG_AGENT_TAG` for protobufs comparison to DataDog/datadog-agent@fdc29d4 # Motivation Out of sync protobufs with datadog-agent. Needed for #2170. # Additional Notes <img width="788" height="301" alt="Screenshot 2026-06-29 at 3 03 21 PM" src="https://github.com/user-attachments/assets/ac605731-2338-4919-a078-1cb31de9b2d0" /> # How to test the change? - Weekly test to compare protobufs to main: https://github.com/DataDog/libdatadog/actions/workflows/weekly-verify-proto-files.yml - Per PR test to compare protobugs to specified commit: https://github.com/DataDog/libdatadog/actions/workflows/verify-proto-files.yml Co-authored-by: duncan.harvey <duncan.harvey@datadoghq.com>
1 parent e6c84ae commit b02d454

14 files changed

Lines changed: 171 additions & 6 deletions

File tree

.github/workflows/verify-proto-files.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
pull_request:
44
types: [ opened, synchronize, reopened ]
55
env:
6-
DATADOG_AGENT_TAG: "bdcdd8cf1ba4090a29b96d5669cfab5dd81814b1"
6+
DATADOG_AGENT_TAG: "fdc29d4428db855950228a642c43a5595e56bb09"
77
CARGO_TERM_COLOR: always
88
CARGO_INCREMENTAL: 0
99
jobs:

datadog-ipc/src/shm_stats.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,7 @@ impl ShmSpanConcentrator {
814814
.unwrap_or_default(),
815815
service_source: read_str!(f.service_source),
816816
span_derived_primary_tags: vec![],
817+
additional_metric_tags: vec![],
817818
}
818819
}
819820
}

libdd-trace-protobuf/build.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,19 @@ fn generate_protobuf() {
5656
// intake expects the name ContainerID rather than the PascalCase ContainerId
5757

5858
config.type_attribute("TracerPayload", "#[derive(Deserialize, Serialize)]");
59+
config.field_attribute(
60+
".pb.TracerPayload.containerDebug",
61+
"#[serde(skip_serializing_if = \"Option::is_none\")]",
62+
);
63+
config.type_attribute(
64+
"ContainerDebug",
65+
"#[derive(Deserialize, Serialize, PartialOrd, Ord)]",
66+
);
67+
config.field_attribute("ContainerDebug.error", "#[serde(default)]");
68+
config.field_attribute("ContainerDebug.latencyMs", "#[serde(default)]");
69+
config.field_attribute("ContainerDebug.wasBuffered", "#[serde(default)]");
70+
config.field_attribute("ContainerDebug.bufferMs", "#[serde(default)]");
71+
config.field_attribute("ContainerDebug.bufferEvictionReason", "#[serde(default)]");
5972
config.type_attribute("TraceChunk", "#[derive(Deserialize, Serialize)]");
6073

6174
config.type_attribute("SpanLink", "#[derive(Deserialize, Serialize)]");
@@ -216,6 +229,10 @@ fn generate_protobuf() {
216229
"ClientGroupedStats.span_derived_primary_tags",
217230
"#[serde(default)]",
218231
);
232+
config.field_attribute(
233+
"ClientGroupedStats.additional_metric_tags",
234+
"#[serde(default)]",
235+
);
219236

220237
config.field_attribute(
221238
"ClientGroupedStats.okSummary",

libdd-trace-protobuf/src/pb.idx.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,4 +276,32 @@ pub struct TracerPayload {
276276
/// chunks specifies list of containing trace chunks.
277277
#[prost(message, repeated, tag = "11")]
278278
pub chunks: ::prost::alloc::vec::Vec<TraceChunk>,
279+
/// containerDebug holds debug information about the container tags resolution.
280+
#[prost(message, optional, tag = "12")]
281+
pub container_debug: ::core::option::Option<ContainerDebug>,
282+
}
283+
/// ContainerDebug holds debug information about the container tags resolution process.
284+
#[derive(Deserialize, Serialize, PartialOrd, Ord)]
285+
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
286+
pub struct ContainerDebug {
287+
/// error specifies any error that occurred during container tag resolution.
288+
#[prost(string, tag = "1")]
289+
#[serde(default)]
290+
pub error: ::prost::alloc::string::String,
291+
/// latencyMs specifies the latency in milliseconds of the container tag resolution.
292+
#[prost(int64, tag = "2")]
293+
#[serde(default)]
294+
pub latency_ms: i64,
295+
/// wasBuffered specifies whether the payload was buffered while waiting for container tags.
296+
#[prost(bool, tag = "3")]
297+
#[serde(default)]
298+
pub was_buffered: bool,
299+
/// bufferMs specifies how long the payload was buffered in milliseconds.
300+
#[prost(int64, tag = "4")]
301+
#[serde(default)]
302+
pub buffer_ms: i64,
303+
/// bufferEvictionReason specifies why the payload was evicted from the buffer.
304+
#[prost(string, tag = "5")]
305+
#[serde(default)]
306+
pub buffer_eviction_reason: ::prost::alloc::string::String,
279307
}

libdd-trace-protobuf/src/pb.rs

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,41 @@ pub struct TracerPayload {
426426
/// @gotags: json:"app_version" msg:"app_version"
427427
#[prost(string, tag = "10")]
428428
pub app_version: ::prost::alloc::string::String,
429+
/// containerDebug holds debug information about the container tags resolution.
430+
/// @gotags: json:"container_debug,omitempty" msg:"container_debug,omitempty"
431+
#[prost(message, optional, tag = "11")]
432+
#[serde(skip_serializing_if = "Option::is_none")]
433+
pub container_debug: ::core::option::Option<ContainerDebug>,
434+
}
435+
/// ContainerDebug holds debug information about the container tags resolution process.
436+
#[derive(Deserialize, Serialize, PartialOrd, Ord)]
437+
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
438+
pub struct ContainerDebug {
439+
/// error specifies any error that occurred during container tag resolution.
440+
/// @gotags: json:"error,omitempty" msg:"error,omitempty"
441+
#[prost(string, tag = "1")]
442+
#[serde(default)]
443+
pub error: ::prost::alloc::string::String,
444+
/// latencyMs specifies the latency in milliseconds of the container tag resolution.
445+
/// @gotags: json:"latency_ms,omitempty" msg:"latency_ms,omitempty"
446+
#[prost(int64, tag = "2")]
447+
#[serde(default)]
448+
pub latency_ms: i64,
449+
/// wasBuffered specifies whether the payload was buffered while waiting for container tags.
450+
/// @gotags: json:"was_buffered,omitempty" msg:"was_buffered,omitempty"
451+
#[prost(bool, tag = "3")]
452+
#[serde(default)]
453+
pub was_buffered: bool,
454+
/// bufferMs specifies how long the payload was buffered in milliseconds.
455+
/// @gotags: json:"buffer_ms,omitempty" msg:"buffer_ms,omitempty"
456+
#[prost(int64, tag = "4")]
457+
#[serde(default)]
458+
pub buffer_ms: i64,
459+
/// bufferEvictionReason specifies why the payload was evicted from the buffer.
460+
/// @gotags: json:"buffer_eviction_reason,omitempty" msg:"buffer_eviction_reason,omitempty"
461+
#[prost(string, tag = "5")]
462+
#[serde(default)]
463+
pub buffer_eviction_reason: ::prost::alloc::string::String,
429464
}
430465
/// AgentPayload represents payload the agent sends to the intake.
431466
#[derive(Clone, PartialEq, ::prost::Message)]
@@ -659,13 +694,16 @@ pub struct ClientGroupedStats {
659694
#[serde(rename = "srv_src")]
660695
pub service_source: ::prost::alloc::string::String,
661696
/// used to identify service override origin
662-
/// span_derived_primary_tags are user-configured tags that are extracted from spans and used for stats aggregation
663-
/// E.g., `aws.s3.bucket`, `http.url`, or any custom tag
697+
/// Deprecated: use additional_metric_tags (field 23) instead.
664698
#[prost(string, repeated, tag = "22")]
665699
#[serde(default)]
666700
pub span_derived_primary_tags: ::prost::alloc::vec::Vec<
667701
::prost::alloc::string::String,
668702
>,
703+
/// additional_metric_tags are tags sent by tracers to be used as additional dimensions for stats aggregation
704+
#[prost(string, repeated, tag = "23")]
705+
#[serde(default)]
706+
pub additional_metric_tags: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
669707
}
670708
/// Trilean is an expanded boolean type that is meant to differentiate between being unset and false.
671709
#[derive(Deserialize, Serialize)]

libdd-trace-protobuf/src/pb/idx/tracer_payload.proto

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,20 @@ message TracerPayload {
4848
map<uint32, AnyValue> attributes = 10;
4949
// chunks specifies list of containing trace chunks.
5050
repeated TraceChunk chunks = 11;
51+
// containerDebug holds debug information about the container tags resolution.
52+
ContainerDebug containerDebug = 12;
53+
}
54+
55+
// ContainerDebug holds debug information about the container tags resolution process.
56+
message ContainerDebug {
57+
// error specifies any error that occurred during container tag resolution.
58+
string error = 1;
59+
// latencyMs specifies the latency in milliseconds of the container tag resolution.
60+
int64 latencyMs = 2;
61+
// wasBuffered specifies whether the payload was buffered while waiting for container tags.
62+
bool wasBuffered = 3;
63+
// bufferMs specifies how long the payload was buffered in milliseconds.
64+
int64 bufferMs = 4;
65+
// bufferEvictionReason specifies why the payload was evicted from the buffer.
66+
string bufferEvictionReason = 5;
5167
}

libdd-trace-protobuf/src/pb/stats.proto

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ message ClientGroupedStats {
105105
string HTTP_endpoint = 20; // Http route or quantized/simplified URL path
106106
string service_source = 21; // @inject_tag: msg:"srv_src"
107107
// used to identify service override origin
108-
// span_derived_primary_tags are user-configured tags that are extracted from spans and used for stats aggregation
109-
// E.g., `aws.s3.bucket`, `http.url`, or any custom tag
108+
// Deprecated: use additional_metric_tags (field 23) instead.
110109
repeated string span_derived_primary_tags = 22;
110+
// additional_metric_tags are tags sent by tracers to be used as additional dimensions for stats aggregation
111+
repeated string additional_metric_tags = 23;
111112
}

libdd-trace-protobuf/src/pb/tracer_payload.proto

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,26 @@ message TracerPayload {
5757
// version specifies `version` tag that set with the tracer.
5858
// @gotags: json:"app_version" msg:"app_version"
5959
string appVersion = 10;
60+
// containerDebug holds debug information about the container tags resolution.
61+
// @gotags: json:"container_debug,omitempty" msg:"container_debug,omitempty"
62+
ContainerDebug containerDebug = 11;
63+
}
64+
65+
// ContainerDebug holds debug information about the container tags resolution process.
66+
message ContainerDebug {
67+
// error specifies any error that occurred during container tag resolution.
68+
// @gotags: json:"error,omitempty" msg:"error,omitempty"
69+
string error = 1;
70+
// latencyMs specifies the latency in milliseconds of the container tag resolution.
71+
// @gotags: json:"latency_ms,omitempty" msg:"latency_ms,omitempty"
72+
int64 latencyMs = 2;
73+
// wasBuffered specifies whether the payload was buffered while waiting for container tags.
74+
// @gotags: json:"was_buffered,omitempty" msg:"was_buffered,omitempty"
75+
bool wasBuffered = 3;
76+
// bufferMs specifies how long the payload was buffered in milliseconds.
77+
// @gotags: json:"buffer_ms,omitempty" msg:"buffer_ms,omitempty"
78+
int64 bufferMs = 4;
79+
// bufferEvictionReason specifies why the payload was evicted from the buffer.
80+
// @gotags: json:"buffer_eviction_reason,omitempty" msg:"buffer_eviction_reason,omitempty"
81+
string bufferEvictionReason = 5;
6082
}

libdd-trace-protobuf/src/pb_test.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ mod tests {
114114
http_method: "GET".to_string(),
115115
service_source: "".to_string(),
116116
span_derived_primary_tags: vec![],
117+
additional_metric_tags: vec![],
117118
}],
118119
agent_time_shift: 0,
119120
}],
@@ -133,4 +134,38 @@ mod tests {
133134

134135
assert_eq!(deserialized_stats_json, client_stats_payload)
135136
}
137+
138+
#[test]
139+
fn test_deserialize_tracer_payload_partial_container_debug() {
140+
use crate::pb::{ContainerDebug, TracerPayload};
141+
142+
let json = r#"{
143+
"container_id": "cid",
144+
"language_name": "go",
145+
"language_version": "1.22",
146+
"tracer_version": "1.0",
147+
"runtime_id": "runtime",
148+
"chunks": [],
149+
"tags": {},
150+
"env": "prod",
151+
"hostname": "host",
152+
"app_version": "2.0",
153+
"container_debug": {
154+
"latency_ms": 42,
155+
"was_buffered": true
156+
}
157+
}"#;
158+
159+
let decoded: TracerPayload = serde_json::from_str(json).unwrap();
160+
assert_eq!(
161+
decoded.container_debug,
162+
Some(ContainerDebug {
163+
error: String::new(),
164+
latency_ms: 42,
165+
was_buffered: true,
166+
buffer_ms: 0,
167+
buffer_eviction_reason: String::new(),
168+
})
169+
);
170+
}
136171
}

libdd-trace-stats/src/span_concentrator/aggregation.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,8 @@ fn encode_grouped_stats(key: OwnedAggregationKey, group: GroupedStats) -> pb::Cl
550550
.map(|c| c.to_string())
551551
.unwrap_or_default(),
552552
service_source: f.service_source,
553-
span_derived_primary_tags: vec![], // Todo
553+
span_derived_primary_tags: vec![],
554+
additional_metric_tags: vec![],
554555
}
555556
}
556557

0 commit comments

Comments
 (0)