Skip to content

Commit

Permalink
Update protobuf files for stats for new trilean type (#480)
Browse files Browse the repository at this point in the history
  • Loading branch information
bantonsson authored Jun 10, 2024
1 parent b584007 commit 29c7824
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/verify-proto-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
types: [ opened, synchronize, reopened ]

env:
DATADOG_AGENT_TAG: "7.53.0-rc.1"
DATADOG_AGENT_TAG: "7.55.0-rc.3"

jobs:
verify-proto-files:
Expand Down
42 changes: 36 additions & 6 deletions trace-protobuf/src/pb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,26 +426,27 @@ pub struct ClientGroupedStats {
#[prost(string, repeated, tag = "16")]
pub peer_tags: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// this field's value is equal to span's ParentID == 0.
#[prost(enumeration = "TraceRootFlag", tag = "17")]
#[prost(enumeration = "Trilean", tag = "17")]
pub is_trace_root: i32,
}
/// Trilean is an expanded boolean type that is meant to differentiate between being unset and false.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum TraceRootFlag {
pub enum Trilean {
NotSet = 0,
True = 1,
False = 2,
}
impl TraceRootFlag {
impl Trilean {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
TraceRootFlag::NotSet => "NOT_SET",
TraceRootFlag::True => "TRUE",
TraceRootFlag::False => "FALSE",
Trilean::NotSet => "NOT_SET",
Trilean::True => "TRUE",
Trilean::False => "FALSE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
Expand All @@ -458,3 +459,32 @@ impl TraceRootFlag {
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum TraceRootFlag {
DeprecatedNotSet = 0,
DeprecatedTrue = 1,
DeprecatedFalse = 2,
}
impl TraceRootFlag {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
TraceRootFlag::DeprecatedNotSet => "DEPRECATED_NOT_SET",
TraceRootFlag::DeprecatedTrue => "DEPRECATED_TRUE",
TraceRootFlag::DeprecatedFalse => "DEPRECATED_FALSE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"DEPRECATED_NOT_SET" => Some(Self::DeprecatedNotSet),
"DEPRECATED_TRUE" => Some(Self::DeprecatedTrue),
"DEPRECATED_FALSE" => Some(Self::DeprecatedFalse),
_ => None,
}
}
}
11 changes: 9 additions & 2 deletions trace-protobuf/src/pb/stats.proto
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,19 @@ message ClientStatsBucket {
int64 agentTimeShift = 4;
}

enum TraceRootFlag {
// Trilean is an expanded boolean type that is meant to differentiate between being unset and false.
enum Trilean {
NOT_SET = 0;
TRUE = 1;
FALSE = 2;
}

enum TraceRootFlag {
DEPRECATED_NOT_SET = 0;
DEPRECATED_TRUE = 1;
DEPRECATED_FALSE = 2;
}

// ClientGroupedStats aggregate stats on spans grouped by service, name, resource, status_code, type
message ClientGroupedStats {
string service = 1;
Expand All @@ -88,5 +95,5 @@ message ClientGroupedStats {
// peer_tags are supplementary tags that further describe a peer entity
// E.g., `grpc.target` to describe the name of a gRPC peer, or `db.hostname` to describe the name of peer DB
repeated string peer_tags = 16;
TraceRootFlag is_trace_root = 17; // this field's value is equal to span's ParentID == 0.
Trilean is_trace_root = 17; // this field's value is equal to span's ParentID == 0.
}

0 comments on commit 29c7824

Please sign in to comment.