diff --git a/Cargo.lock b/Cargo.lock index 7c9b280..44bef97 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -722,7 +722,7 @@ checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "sentry_protos" -version = "0.5.0" +version = "0.6.0" dependencies = [ "prost", "prost-types", diff --git a/proto/sentry_protos/snuba/v1/trace_item.proto b/proto/sentry_protos/snuba/v1/trace_item.proto index b8628e5..a0263e0 100644 --- a/proto/sentry_protos/snuba/v1/trace_item.proto +++ b/proto/sentry_protos/snuba/v1/trace_item.proto @@ -30,6 +30,17 @@ message KeyValue { AnyValue value = 2; } +message CategoryCount { + // DataCategory that defined in Relay + uint32 data_category = 1; + uint64 quantity = 2; +} + +message Outcomes { + repeated CategoryCount category_count = 1; + uint64 key_id = 2; +} + message TraceItem { uint64 organization_id = 1; uint64 project_id = 2; @@ -47,4 +58,5 @@ message TraceItem { uint32 retention_days = 100; google.protobuf.Timestamp received = 101; uint32 downsampled_retention_days = 102; + Outcomes outcomes = 110; } diff --git a/rust/src/sentry_protos.snuba.v1.rs b/rust/src/sentry_protos.snuba.v1.rs index fe0246d..0f40a07 100644 --- a/rust/src/sentry_protos.snuba.v1.rs +++ b/rust/src/sentry_protos.snuba.v1.rs @@ -489,6 +489,76 @@ pub struct ExistsFilter { #[prost(message, optional, tag = "1")] pub key: ::core::option::Option, } +/// Filter that matches trace items where ANY attribute matches the given value. +/// Use this for searching across all attributes without specifying a key. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AnyAttributeFilter { + #[prost(enumeration = "any_attribute_filter::Op", tag = "1")] + pub op: i32, + #[prost(message, optional, tag = "2")] + pub value: ::core::option::Option, + #[prost(bool, tag = "3")] + pub ignore_case: bool, + /// Optional: Restrict search to specific attribute types. + /// If empty, searches all string-type attributes by default. + #[prost(enumeration = "attribute_key::Type", repeated, tag = "4")] + pub attribute_types: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `AnyAttributeFilter`. +pub mod any_attribute_filter { + /// Restricted set of operations that make sense for all-attribute search + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum Op { + Unspecified = 0, + Equals = 1, + NotEquals = 2, + Like = 3, + NotLike = 4, + In = 5, + NotIn = 6, + } + impl Op { + /// 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 { + Self::Unspecified => "OP_UNSPECIFIED", + Self::Equals => "OP_EQUALS", + Self::NotEquals => "OP_NOT_EQUALS", + Self::Like => "OP_LIKE", + Self::NotLike => "OP_NOT_LIKE", + Self::In => "OP_IN", + Self::NotIn => "OP_NOT_IN", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "OP_UNSPECIFIED" => Some(Self::Unspecified), + "OP_EQUALS" => Some(Self::Equals), + "OP_NOT_EQUALS" => Some(Self::NotEquals), + "OP_LIKE" => Some(Self::Like), + "OP_NOT_LIKE" => Some(Self::NotLike), + "OP_IN" => Some(Self::In), + "OP_NOT_IN" => Some(Self::NotIn), + _ => None, + } + } + } +} /// a condition used to filter for matching "trace items" /// /// ex: "exists span.duration" would mean @@ -499,7 +569,7 @@ pub struct ExistsFilter { /// trace items contain attributes like 'span.duration' ) #[derive(Clone, PartialEq, ::prost::Message)] pub struct TraceItemFilter { - #[prost(oneof = "trace_item_filter::Value", tags = "1, 2, 3, 4, 5")] + #[prost(oneof = "trace_item_filter::Value", tags = "1, 2, 3, 4, 5, 6")] pub value: ::core::option::Option, } /// Nested message and enum types in `TraceItemFilter`. @@ -516,6 +586,8 @@ pub mod trace_item_filter { ComparisonFilter(super::ComparisonFilter), #[prost(message, tag = "5")] ExistsFilter(super::ExistsFilter), + #[prost(message, tag = "6")] + AnyAttributeFilter(super::AnyAttributeFilter), } } #[derive(Clone, PartialEq, ::prost::Message)] @@ -1975,7 +2047,7 @@ pub mod aggregation_filter { pub struct Column { #[prost(string, tag = "3")] pub label: ::prost::alloc::string::String, - #[prost(oneof = "column::Column", tags = "1, 2, 5, 4, 6")] + #[prost(oneof = "column::Column", tags = "1, 2, 5, 4, 6, 7")] pub column: ::core::option::Option, } /// Nested message and enum types in `Column`. @@ -2050,6 +2122,80 @@ pub mod column { DefaultValueInt64(i64), } } + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct FormulaCondition { + #[prost(message, optional, boxed, tag = "1")] + pub left: ::core::option::Option<::prost::alloc::boxed::Box>, + #[prost(enumeration = "formula_condition::Op", tag = "2")] + pub op: i32, + #[prost(message, optional, boxed, tag = "3")] + pub right: ::core::option::Option<::prost::alloc::boxed::Box>, + } + /// Nested message and enum types in `FormulaCondition`. + pub mod formula_condition { + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum Op { + Unspecified = 0, + LessThan = 1, + GreaterThan = 2, + LessThanOrEquals = 3, + GreaterThanOrEquals = 4, + Equals = 5, + NotEquals = 6, + } + impl Op { + /// 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 { + Self::Unspecified => "OP_UNSPECIFIED", + Self::LessThan => "OP_LESS_THAN", + Self::GreaterThan => "OP_GREATER_THAN", + Self::LessThanOrEquals => "OP_LESS_THAN_OR_EQUALS", + Self::GreaterThanOrEquals => "OP_GREATER_THAN_OR_EQUALS", + Self::Equals => "OP_EQUALS", + Self::NotEquals => "OP_NOT_EQUALS", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "OP_UNSPECIFIED" => Some(Self::Unspecified), + "OP_LESS_THAN" => Some(Self::LessThan), + "OP_GREATER_THAN" => Some(Self::GreaterThan), + "OP_LESS_THAN_OR_EQUALS" => Some(Self::LessThanOrEquals), + "OP_GREATER_THAN_OR_EQUALS" => Some(Self::GreaterThanOrEquals), + "OP_EQUALS" => Some(Self::Equals), + "OP_NOT_EQUALS" => Some(Self::NotEquals), + _ => None, + } + } + } + } + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct ConditionalFormula { + #[prost(message, optional, boxed, tag = "1")] + pub condition: ::core::option::Option< + ::prost::alloc::boxed::Box, + >, + #[prost(message, optional, boxed, tag = "2")] + pub r#match: ::core::option::Option<::prost::alloc::boxed::Box>, + #[prost(message, optional, boxed, tag = "3")] + pub default: ::core::option::Option<::prost::alloc::boxed::Box>, + } #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Column { #[prost(message, tag = "1")] @@ -2062,6 +2208,8 @@ pub mod column { Formula(::prost::alloc::boxed::Box), #[prost(message, tag = "6")] Literal(super::Literal), + #[prost(message, tag = "7")] + ConditionalFormula(::prost::alloc::boxed::Box), } } #[derive(Clone, PartialEq, ::prost::Message)] @@ -2145,6 +2293,21 @@ pub struct KeyValue { #[prost(message, optional, tag = "2")] pub value: ::core::option::Option, } +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct CategoryCount { + /// DataCategory that defined in Relay + #[prost(uint32, tag = "1")] + pub data_category: u32, + #[prost(uint64, tag = "2")] + pub quantity: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Outcomes { + #[prost(message, repeated, tag = "1")] + pub category_count: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "2")] + pub key_id: u64, +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct TraceItem { #[prost(uint64, tag = "1")] @@ -2176,6 +2339,8 @@ pub struct TraceItem { pub received: ::core::option::Option<::prost_types::Timestamp>, #[prost(uint32, tag = "102")] pub downsampled_retention_days: u32, + #[prost(message, optional, tag = "110")] + pub outcomes: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ExportTraceItemsRequest {