Skip to content

Commit 7e909c0

Browse files
authored
feat(trace-protobuf)!: Add two fields to ClientGroupedStats [SVLS-8627] (#1630)
# What does this PR do? Add two fields to `ClientGroupedStats`: 1. `service_source` 2. `span_derived_primary_tags` It syncs the changes on datadog-agent. See pkg/proto/datadog/trace/stats.proto in DataDog/datadog-agent#42996. # Motivation To support span derived primary tags for trace stats generated in Lambda extension. # Additional Notes @Sam-Maya is driving this effort. # How to test the change? This PR only includes struct changes in this PR. Will set and test the struct in future PRs. Co-authored-by: yiming.luo <yiming.luo@datadoghq.com>
1 parent bd94dd9 commit 7e909c0

7 files changed

Lines changed: 30 additions & 2 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: "7f6d07c93ba087f23f80a3f0c2da4b1f3dc664d7"
6+
DATADOG_AGENT_TAG: "bdcdd8cf1ba4090a29b96d5669cfab5dd81814b1"
77
rust_version: "1.84.1"
88
CARGO_TERM_COLOR: always
99
CARGO_INCREMENTAL: 0

libdd-trace-protobuf/build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,11 @@ fn generate_protobuf() {
176176
"ClientGroupedStats.HTTP_endpoint",
177177
"#[serde(default)] #[serde(rename = \"HTTPEndpoint\")]",
178178
);
179+
config.field_attribute("ClientGroupedStats.service_source", "#[serde(default)]");
180+
config.field_attribute(
181+
"ClientGroupedStats.span_derived_primary_tags",
182+
"#[serde(default)]",
183+
);
179184

180185
config.field_attribute(
181186
"ClientGroupedStats.okSummary",

libdd-trace-protobuf/src/pb.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,18 @@ pub struct ClientGroupedStats {
646646
#[serde(default)]
647647
#[serde(rename = "HTTPEndpoint")]
648648
pub http_endpoint: ::prost::alloc::string::String,
649+
/// @inject_tag: msg:"srv_src"
650+
#[prost(string, tag = "21")]
651+
#[serde(default)]
652+
pub service_source: ::prost::alloc::string::String,
653+
/// used to identify service override origin
654+
/// span_derived_primary_tags are user-configured tags that are extracted from spans and used for stats aggregation
655+
/// E.g., `aws.s3.bucket`, `http.url`, or any custom tag
656+
#[prost(string, repeated, tag = "22")]
657+
#[serde(default)]
658+
pub span_derived_primary_tags: ::prost::alloc::vec::Vec<
659+
::prost::alloc::string::String,
660+
>,
649661
}
650662
/// Trilean is an expanded boolean type that is meant to differentiate between being unset and false.
651663
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,9 @@ message ClientGroupedStats {
103103
string GRPC_status_code = 18;
104104
string HTTP_method = 19; // HTTP method of the request
105105
string HTTP_endpoint = 20; // Http route or quantized/simplified URL path
106+
string service_source = 21; // @inject_tag: msg:"srv_src"
107+
// 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
110+
repeated string span_derived_primary_tags = 22;
106111
}

libdd-trace-protobuf/src/pb_test.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ mod tests {
112112
grpc_status_code: "0".to_string(),
113113
http_endpoint: "/test".to_string(),
114114
http_method: "GET".to_string(),
115+
service_source: "".to_string(),
116+
span_derived_primary_tags: vec![],
115117
}],
116118
agent_time_shift: 0,
117119
}],

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,9 @@ fn encode_grouped_stats(key: OwnedAggregationKey, group: GroupedStats) -> pb::Cl
295295
},
296296
http_method: key.http_method,
297297
http_endpoint: key.http_endpoint,
298-
grpc_status_code: String::new(), // currently not used
298+
grpc_status_code: String::new(), // currently not used
299+
service_source: String::new(), // set by the agent
300+
span_derived_primary_tags: vec![], // set by the agent
299301
}
300302
}
301303

libdd-trace-utils/src/stats_utils.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ mod mini_agent_tests {
209209
grpc_status_code: "0".to_string(),
210210
http_endpoint: "/test".to_string(),
211211
http_method: "GET".to_string(),
212+
service_source: "".to_string(),
213+
span_derived_primary_tags: vec![],
212214
}],
213215
agent_time_shift: 0,
214216
}],

0 commit comments

Comments
 (0)