Skip to content
Merged
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

- Add experimental `/upload` endpoint for large file uploads. ([#5638](https://github.com/getsentry/relay/pull/5638))

**Internal**:

- Introduce additional and separate data categories for backend and ui transaction profiles. ([#5648](https://github.com/getsentry/relay/pull/5648))

## 26.2.0

**Bug Fixes**:
Expand All @@ -34,6 +38,7 @@
- Add EAP double-write for session data. ([#5588](https://github.com/getsentry/relay/pull/5588))
- Always process OTLP spans with the span streaming pipeline. ([#5631](https://github.com/getsentry/relay/pull/5631))
- Embed AI operation type mappings into Relay. ([#5555](https://github.com/getsentry/relay/pull/5555))
- Apply continuous profiling rate limits to transaction profiles. ([#5614](https://github.com/getsentry/relay/pull/5614)
- Use new processor architecture to process transactions. ([#5379](https://github.com/getsentry/relay/pull/5379))
- Add `gen_ai_response_time_to_first_token` as a `SpanData` attribute. ([#5575](https://github.com/getsentry/relay/pull/5575))
- Add sampling to expensive envelope buffer statsd metrics. ([#5576](https://github.com/getsentry/relay/pull/5576))
Expand Down
2 changes: 2 additions & 0 deletions py/sentry_relay/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class DataCategory(IntEnum):
INSTALLABLE_BUILD = 32
TRACE_METRIC = 33
SEER_USER = 34
PROFILE_BACKEND = 35
PROFILE_UI = 36
UNKNOWN = -1
# end generated

Expand Down
32 changes: 29 additions & 3 deletions relay-base-schema/src/data_category.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,24 @@ pub enum DataCategory {
///
/// SDK rate limiting behavior: ignore.
SeerUser = 34,
/// Transaction profiles for backend platforms.
///
/// This is an extension of [`Self::Profile`], but additionally discriminates on the profile
/// platform, see also [`Self::ProfileUi`].
///
/// Continuous profiling uses [`Self::ProfileChunk`] and [`Self::ProfileChunkUi`].
///
/// SDK rate limiting behavior: optional, apply to transaction profiles on "backend platforms".
ProfileBackend = 35,
/// Transaction profiles for ui platforms.
///
/// This is an extension of [`Self::Profile`], but additionally discriminates on the profile
/// platform, see also [`Self::ProfileBackend`].
///
/// Continuous profiling uses [`Self::ProfileChunk`] and [`Self::ProfileChunkUi`].
///
/// SDK rate limiting behavior: optional, apply to transaction profiles on "ui platforms".
ProfileUi = 36,
//
// IMPORTANT: After adding a new entry to DataCategory, go to the `relay-cabi` subfolder and run
// `make header` to regenerate the C-binding. This allows using the data category from Python.
Expand Down Expand Up @@ -272,6 +290,8 @@ impl DataCategory {
"installable_build" => Self::InstallableBuild,
"trace_metric" => Self::TraceMetric,
"seer_user" => Self::SeerUser,
"profile_backend" => Self::ProfileBackend,
"profile_ui" => Self::ProfileUi,
_ => Self::Unknown,
}
}
Expand Down Expand Up @@ -314,6 +334,8 @@ impl DataCategory {
Self::InstallableBuild => "installable_build",
Self::TraceMetric => "trace_metric",
Self::SeerUser => "seer_user",
Self::ProfileBackend => "profile_backend",
Self::ProfileUi => "profile_ui",
Self::Unknown => "unknown",
}
}
Expand Down Expand Up @@ -420,6 +442,8 @@ impl TryFrom<u8> for DataCategory {
32 => Ok(Self::InstallableBuild),
33 => Ok(Self::TraceMetric),
34 => Ok(Self::SeerUser),
35 => Ok(Self::ProfileBackend),
36 => Ok(Self::ProfileUi),
other => Err(UnknownDataCategory(other as u32)),
}
}
Expand Down Expand Up @@ -516,7 +540,9 @@ impl CategoryUnit {
| DataCategory::SizeAnalysis
| DataCategory::InstallableBuild
| DataCategory::TraceMetric
| DataCategory::SeerUser => Some(Self::Count),
| DataCategory::SeerUser
| DataCategory::ProfileBackend
| DataCategory::ProfileUi => Some(Self::Count),

DataCategory::Attachment | DataCategory::LogByte => Some(Self::Bytes),

Expand Down Expand Up @@ -552,8 +578,8 @@ mod tests {
// If this test fails, update the numeric bounds so that the first assertion
// maps to the last variant in the enum and the second assertion produces an error
// that the DataCategory does not exist.
assert_eq!(DataCategory::try_from(34u8), Ok(DataCategory::SeerUser));
assert_eq!(DataCategory::try_from(35u8), Err(UnknownDataCategory(35)));
assert_eq!(DataCategory::try_from(36u8), Ok(DataCategory::ProfileUi));
assert_eq!(DataCategory::try_from(37u8), Err(UnknownDataCategory(37)));
}

#[test]
Expand Down
22 changes: 22 additions & 0 deletions relay-cabi/include/relay.h
Comment thread
Dav1dde marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,28 @@ enum RelayDataCategory {
* SDK rate limiting behavior: ignore.
*/
RELAY_DATA_CATEGORY_SEER_USER = 34,
/**
* Transaction profiles for backend platforms.
*
* This is an extension of [`Self::Profile`], but additional discriminates on the profile
* platform, see also [`Self::ProfileUi`].
*
* Continuous profiling uses [`Self::ProfileChunk`] and [`Self::ProfileChunkUi`].
*
* SDK rate limiting behavior: optional, apply to transaction profiles on "backend platforms'.
*/
RELAY_DATA_CATEGORY_PROFILE_BACKEND = 35,
/**
* Transaction profiles for ui platforms.
*
* This is an extension of [`Self::Profile`], but additional discriminates on the profile
* platform, see also [`Self::ProfileBackend`].
*
* Continuous profiling uses [`Self::ProfileChunk`] and [`Self::ProfileChunkUi`].
*
* SDK rate limiting behavior: optional, apply to transaction profiles on "ui platforms'.
*/
RELAY_DATA_CATEGORY_PROFILE_UI = 36,
/**
* Any other data category not known by this Relay.
*/
Expand Down
37 changes: 27 additions & 10 deletions relay-server/src/envelope/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,33 @@ impl Item {
ItemType::FormData => smallvec![],
ItemType::UserReport => smallvec![(DataCategory::UserReportV2, item_count)],
ItemType::UserReportV2 => smallvec![(DataCategory::UserReportV2, item_count)],
ItemType::Profile => smallvec![
(DataCategory::Profile, item_count),
(DataCategory::ProfileIndexed, item_count)
],
ItemType::Profile => match self.profile_type() {
Some(ProfileType::Backend) => smallvec![
(DataCategory::Profile, item_count),
(DataCategory::ProfileIndexed, item_count),
(DataCategory::ProfileBackend, item_count),
],
Some(ProfileType::Ui) => smallvec![
(DataCategory::Profile, item_count),
(DataCategory::ProfileIndexed, item_count),
(DataCategory::ProfileUi, item_count)
],
// Note: parsing the profile type (and validity) requires parsing the payload,
// which makes this semantically wrong but it is too expensive here to parse the
// payload.
None => smallvec![
(DataCategory::Profile, item_count),
(DataCategory::ProfileIndexed, item_count),
],
},
ItemType::ProfileChunk => match self.profile_type() {
Some(ProfileType::Backend) => smallvec![(DataCategory::ProfileChunk, item_count)],
Some(ProfileType::Ui) => smallvec![(DataCategory::ProfileChunkUi, item_count)],
// Note: parsing the profile type (and validity) requires parsing the payload,
// which makes this semantically wrong but it is too expensive here to parse the
// payload.
None => smallvec![],
},
ItemType::ReplayEvent | ItemType::ReplayRecording | ItemType::ReplayVideo => {
smallvec![(DataCategory::Replay, item_count)]
}
Expand All @@ -160,12 +183,6 @@ impl Item {
(DataCategory::Span, item_count),
(DataCategory::SpanIndexed, item_count),
],
// NOTE: semantically wrong, but too expensive to parse.
ItemType::ProfileChunk => match self.profile_type() {
Some(ProfileType::Backend) => smallvec![(DataCategory::ProfileChunk, item_count)],
Some(ProfileType::Ui) => smallvec![(DataCategory::ProfileChunkUi, item_count)],
None => smallvec![],
},
ItemType::Integration => match self.integration() {
Some(Integration::Logs(LogsIntegration::OtelV1 { .. })) => smallvec![
(DataCategory::LogByte, self.len().max(1)),
Expand Down
6 changes: 4 additions & 2 deletions relay-server/src/managed/counted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ impl Counted for EnvelopeSummary {
DataCategory::AttachmentItem,
self.attachment_quantities.count(),
),
(DataCategory::Profile, self.profile_quantity),
(DataCategory::ProfileIndexed, self.profile_quantity),
(DataCategory::Profile, self.profile_quantity.total),
(DataCategory::ProfileBackend, self.profile_quantity.backend),
(DataCategory::ProfileUi, self.profile_quantity.ui),
(DataCategory::ProfileIndexed, self.profile_quantity.total),
(DataCategory::Span, self.span_quantity),
(DataCategory::SpanIndexed, self.span_quantity),
(
Expand Down
2 changes: 1 addition & 1 deletion relay-server/src/managed/envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ impl ManagedEnvelope {
tags.project_key = self.scoping().project_key.to_string(),
tags.has_attachments = summary.attachment_quantities.bytes() > 0,
tags.has_sessions = summary.session_quantity > 0,
tags.has_profiles = summary.profile_quantity > 0,
tags.has_profiles = summary.profile_quantity.total > 0,
tags.has_transactions = summary.secondary_transaction_quantity > 0,
tags.has_span_metrics = summary.secondary_span_quantity > 0,
tags.has_replays = summary.replay_quantity > 0,
Expand Down
13 changes: 12 additions & 1 deletion relay-server/src/processing/transactions/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use relay_base_schema::events::EventType;
use relay_dynamic_config::ErrorBoundary;
use relay_event_normalization::GeoIpLookup;
use relay_event_schema::protocol::{Event, Metrics};
use relay_profiling::ProfileError;
use relay_profiling::{ProfileError, ProfileType};
use relay_protocol::Annotated;
use relay_quotas::DataCategory;
use relay_redis::AsyncRedisClient;
Expand Down Expand Up @@ -123,6 +123,17 @@ fn expand_profile(
}
};

// If the profile type is new information, we now count the profile in an additional data category.
if profile.profile_type().is_none() {
record_keeper.modify_by(
match meta.kind {
ProfileType::Backend => DataCategory::ProfileBackend,
ProfileType::Ui => DataCategory::ProfileUi,
},
1,
);
}

Some(ExpandedProfile {
meta,
item: profile,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use either::Either;
use relay_event_schema::protocol::Event;
use relay_profiling::ProfileMetadata;
use relay_profiling::{ProfileMetadata, ProfileType};
use relay_protocol::Annotated;
use relay_quotas::DataCategory;
use relay_sampling::evaluation::SamplingDecision;
Expand Down Expand Up @@ -293,6 +293,13 @@ impl Counted for ExpandedProfile {
smallvec![
(DataCategory::Profile, 1),
(DataCategory::ProfileIndexed, 1),
(
match self.meta.kind {
ProfileType::Backend => DataCategory::ProfileBackend,
ProfileType::Ui => DataCategory::ProfileUi,
},
1
),
]
}
}
Loading
Loading