Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
- Remove continuous-profiling-beta feature flags. ([#5762](https://github.com/getsentry/relay/pull/5762))
- Playstation: Do not upload attachments if quota is 0. ([#5770](https://github.com/getsentry/relay/pull/5770))
- Add payload byte size to trace metrics. ([#5764](https://github.com/getsentry/relay/pull/5764))
- Remove transaction metrics extraction. ([#5792](https://github.com/getsentry/relay/pull/5792))
- Mix kafka partition key with org id. ([#5772](https://github.com/getsentry/relay/pull/5772))

## 26.3.1
Expand Down
14 changes: 2 additions & 12 deletions relay-base-schema/src/metrics/mri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ impl Error for ParseMetricError {}
pub enum MetricNamespace {
/// Metrics extracted from sessions.
Sessions,
/// Metrics extracted from transaction events.
Transactions,
/// Metrics extracted from spans.
Spans,
/// User-defined metrics directly sent by SDKs and applications.
Expand All @@ -128,21 +126,14 @@ pub enum MetricNamespace {

impl MetricNamespace {
/// Returns all namespaces/variants of this enum.
pub fn all() -> [Self; 5] {
[
Self::Sessions,
Self::Transactions,
Self::Spans,
Self::Custom,
Self::Unsupported,
]
pub fn all() -> [Self; 4] {
[Self::Sessions, Self::Spans, Self::Custom, Self::Unsupported]
}

/// Returns the string representation for this metric type.
pub fn as_str(&self) -> &'static str {
match self {
Self::Sessions => "sessions",
Self::Transactions => "transactions",
Self::Spans => "spans",
Self::Custom => "custom",
Self::Unsupported => "unsupported",
Expand All @@ -156,7 +147,6 @@ impl std::str::FromStr for MetricNamespace {
fn from_str(ns: &str) -> Result<Self, Self::Err> {
match ns {
"sessions" => Ok(Self::Sessions),
"transactions" => Ok(Self::Transactions),
"spans" => Ok(Self::Spans),
"custom" => Ok(Self::Custom),
_ => Ok(Self::Unsupported),
Expand Down
14 changes: 7 additions & 7 deletions relay-cardinality/src/limiter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,8 @@ mod tests {
let limiter = CardinalityLimiter::new(RejectAllLimiter);

let items = vec![
Item::new(0, MetricNamespace::Transactions),
Item::new(1, MetricNamespace::Transactions),
Item::new(0, MetricNamespace::Sessions),
Item::new(1, MetricNamespace::Sessions),
Comment on lines -509 to +510
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In these tests, is there something particular about the Sessions namespace or do you just need something to replace the deleted Transactions one?

];
let limits = build_limits();
let result = limiter
Expand Down Expand Up @@ -550,7 +550,7 @@ mod tests {
let limiter = CardinalityLimiter::new(AcceptAllLimiter);

let items = vec![
Item::new(0, MetricNamespace::Transactions),
Item::new(0, MetricNamespace::Sessions),
Item::new(1, MetricNamespace::Spans),
];
let limits = build_limits();
Expand Down Expand Up @@ -598,11 +598,11 @@ mod tests {

let items = vec![
Item::new(0, MetricNamespace::Sessions),
Item::new(1, MetricNamespace::Transactions),
Item::new(1, MetricNamespace::Unsupported),
Item::new(2, MetricNamespace::Spans),
Item::new(3, MetricNamespace::Custom),
Item::new(4, MetricNamespace::Custom),
Item::new(5, MetricNamespace::Transactions),
Item::new(5, MetricNamespace::Unsupported),
Item::new(6, MetricNamespace::Spans),
];
let limits = build_limits();
Expand All @@ -624,9 +624,9 @@ mod tests {
assert_eq!(
split.accepted,
vec![
Item::new(1, MetricNamespace::Transactions),
Item::new(1, MetricNamespace::Unsupported),
Item::new(3, MetricNamespace::Custom),
Item::new(5, MetricNamespace::Transactions),
Item::new(5, MetricNamespace::Unsupported),
]
);
}
Expand Down
8 changes: 4 additions & 4 deletions relay-cardinality/src/redis/limiter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ mod tests {

let entries1 = [Entry::new(EntryId(0), Custom, &m0, 0)];
let entries2 = [Entry::new(EntryId(0), Spans, &m1, 1)];
let entries3 = [Entry::new(EntryId(0), Transactions, &m2, 2)];
let entries3 = [Entry::new(EntryId(0), Sessions, &m2, 2)];

let rejected = limiter.test_limits(scoping, limits, entries1).await;
assert_eq!(rejected.len(), 0);
Expand Down Expand Up @@ -908,7 +908,7 @@ mod tests {
},
limit: 1,
scope: CardinalityScope::Unknown,
namespace: Some(Transactions),
namespace: Some(Sessions),
},
];

Expand All @@ -924,8 +924,8 @@ mod tests {
Entry::new(EntryId(1), Custom, &m1, 1),
Entry::new(EntryId(2), Spans, &m2, 2),
Entry::new(EntryId(3), Spans, &m3, 3),
Entry::new(EntryId(4), Transactions, &m4, 4),
Entry::new(EntryId(5), Transactions, &m5, 5),
Entry::new(EntryId(4), Sessions, &m4, 4),
Entry::new(EntryId(5), Sessions, &m5, 5),
];

// Run multiple times to make sure caching does not interfere.
Expand Down
3 changes: 0 additions & 3 deletions relay-cogs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@ pub enum AppFeature {
/// User Reports
UserReports,

/// Metrics in the transactions namespace.
MetricsTransactions,
/// Metrics in the spans namespace.
MetricsSpans,
/// Metrics in the sessions namespace.
Expand Down Expand Up @@ -208,7 +206,6 @@ impl AppFeature {
Self::CheckIns => "check_ins",
Self::Replays => "replays",
Self::UserReports => "user_reports",
Self::MetricsTransactions => "metrics_transactions",
Self::MetricsSpans => "metrics_spans",
Self::MetricsSessions => "metrics_sessions",
Self::MetricsCustom => "metrics_custom",
Expand Down
2 changes: 1 addition & 1 deletion relay-config/src/aggregator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,6 @@ mod tests {
let condition = serde_json::from_value::<Condition>(json).unwrap();
assert!(condition.matches(Some(MetricNamespace::Spans)));
assert!(condition.matches(Some(MetricNamespace::Custom)));
assert!(!condition.matches(Some(MetricNamespace::Transactions)));
assert!(!condition.matches(Some(MetricNamespace::Sessions)));
}
}
6 changes: 0 additions & 6 deletions relay-dynamic-config/src/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ pub enum CardinalityLimiterMode {
#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq)]
#[serde(default)]
pub struct BucketEncodings {
transactions: BucketEncoding,
spans: BucketEncoding,
profiles: BucketEncoding,
custom: BucketEncoding,
Expand All @@ -216,7 +215,6 @@ impl BucketEncodings {
/// Returns the configured encoding for a specific namespace.
pub fn for_namespace(&self, namespace: MetricNamespace) -> BucketEncoding {
match namespace {
MetricNamespace::Transactions => self.transactions,
MetricNamespace::Spans => self.spans,
MetricNamespace::Custom => self.custom,
// Always force the legacy encoding for sessions,
Expand Down Expand Up @@ -250,7 +248,6 @@ where
{
let encoding = BucketEncoding::deserialize(de::value::StrDeserializer::new(v))?;
Ok(BucketEncodings {
transactions: encoding,
spans: encoding,
profiles: encoding,
custom: encoding,
Expand Down Expand Up @@ -453,7 +450,6 @@ mod tests {
assert_eq!(
o.metric_bucket_set_encodings,
BucketEncodings {
transactions: BucketEncoding::Legacy,
spans: BucketEncoding::Legacy,
profiles: BucketEncoding::Legacy,
custom: BucketEncoding::Legacy,
Expand All @@ -462,7 +458,6 @@ mod tests {
assert_eq!(
o.metric_bucket_dist_encodings,
BucketEncodings {
transactions: BucketEncoding::Zstd,
spans: BucketEncoding::Zstd,
profiles: BucketEncoding::Zstd,
custom: BucketEncoding::Zstd,
Expand All @@ -473,7 +468,6 @@ mod tests {
#[test]
fn test_metric_bucket_encodings_de_from_obj() {
let original = BucketEncodings {
transactions: BucketEncoding::Base64,
spans: BucketEncoding::Zstd,
profiles: BucketEncoding::Base64,
custom: BucketEncoding::Zstd,
Expand Down
62 changes: 0 additions & 62 deletions relay-dynamic-config/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,68 +102,6 @@ pub struct CustomMeasurementConfig {
limit: usize,
}

/// Maximum supported version of metrics extraction from transactions.
///
/// The version is an integer scalar, incremented by one on each new version:
/// - 1: Initial version.
/// - 2: Moves `acceptTransactionNames` to global config.
/// - 3:
/// - Emit a `usage` metric and use it for rate limiting.
/// - Delay metrics extraction for indexed transactions.
/// - 4: Adds support for `RuleConfigs` with string comparisons.
/// - 5: No change, bumped together with [`MetricExtractionConfig::MAX_SUPPORTED_VERSION`].
/// - 6: Bugfix to make transaction metrics extraction apply globally defined tag mappings.
const TRANSACTION_EXTRACT_MAX_SUPPORTED_VERSION: u16 = 6;

/// Minimum supported version of metrics extraction from transaction.
const TRANSACTION_EXTRACT_MIN_SUPPORTED_VERSION: u16 = 3;

/// Deprecated. Defines whether URL transactions should be considered low cardinality.
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
#[derive(Default)]
pub enum AcceptTransactionNames {
/// Only accept transaction names with a low-cardinality source.
Strict,

/// For some SDKs, accept all transaction names, while for others, apply strict rules.
#[serde(other)]
#[default]
ClientBased,
}

/// Configuration for extracting metrics from transaction payloads.
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct TransactionMetricsConfig {
/// The required version to extract transaction metrics.
pub version: u16,
/// Custom event tags that are transferred from the transaction to metrics.
pub extract_custom_tags: BTreeSet<String>,
/// Deprecated in favor of top-level config field. Still here to be forwarded to external relays.
pub custom_measurements: CustomMeasurementConfig,
/// Deprecated. Defines whether URL transactions should be considered low cardinality.
/// Keep this around for external Relays.
#[serde(rename = "acceptTransactionNames")]
pub deprecated1: AcceptTransactionNames,
}

impl TransactionMetricsConfig {
/// Creates an enabled configuration with empty defaults.
pub fn new() -> Self {
Self {
version: TRANSACTION_EXTRACT_MAX_SUPPORTED_VERSION,
..Self::default()
}
}

/// Returns `true` if metrics extraction is enabled and compatible with this Relay.
pub fn is_enabled(&self) -> bool {
self.version >= TRANSACTION_EXTRACT_MIN_SUPPORTED_VERSION
&& self.version <= TRANSACTION_EXTRACT_MAX_SUPPORTED_VERSION
}
}

/// Combined view of global and project-specific metrics extraction configs.
#[derive(Debug, Clone, Copy)]
pub struct CombinedMetricExtractionConfig<'a> {
Expand Down
11 changes: 1 addition & 10 deletions relay-dynamic-config/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ use serde_json::Value;

use crate::error_boundary::ErrorBoundary;
use crate::feature::FeatureSet;
use crate::metrics::{
self, MetricExtractionConfig, Metrics, SessionMetricsConfig, TaggingRule,
TransactionMetricsConfig,
};
use crate::metrics::{self, MetricExtractionConfig, Metrics, SessionMetricsConfig, TaggingRule};
use crate::trusted_relay::TrustedRelayConfig;
use crate::{GRADUATED_FEATURE_FLAGS, defaults};

Expand Down Expand Up @@ -72,9 +69,6 @@ pub struct ProjectConfig {
/// Configuration for extracting metrics from sessions.
#[serde(skip_serializing_if = "SessionMetricsConfig::is_disabled")]
pub session_metrics: SessionMetricsConfig,
/// Configuration for extracting metrics from transaction events.
#[serde(skip_serializing_if = "Option::is_none")]
pub transaction_metrics: Option<ErrorBoundary<TransactionMetricsConfig>>,
/// Configuration for generic metrics extraction from all data categories.
#[serde(default, skip_serializing_if = "skip_metrics_extraction")]
pub metric_extraction: ErrorBoundary<MetricExtractionConfig>,
Expand Down Expand Up @@ -169,7 +163,6 @@ impl Default for ProjectConfig {
breakdowns_v2: None,
performance_score: Default::default(),
session_metrics: SessionMetricsConfig::default(),
transaction_metrics: None,
metric_extraction: Default::default(),
metric_conditional_tagging: Vec::new(),
features: Default::default(),
Expand Down Expand Up @@ -215,8 +208,6 @@ pub struct LimitedProjectConfig {
pub sampling: Option<ErrorBoundary<SamplingConfig>>,
#[serde(skip_serializing_if = "SessionMetricsConfig::is_disabled")]
pub session_metrics: SessionMetricsConfig,
#[serde(skip_serializing_if = "Option::is_none")]
pub transaction_metrics: Option<ErrorBoundary<TransactionMetricsConfig>>,
#[serde(default, skip_serializing_if = "skip_metrics_extraction")]
pub metric_extraction: ErrorBoundary<MetricExtractionConfig>,
#[serde(skip_serializing_if = "Vec::is_empty")]
Expand Down
Loading
Loading