Skip to content

Commit

Permalink
Merge branch 'master' into martinl/viewhierarchy-scrubbing
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
  • Loading branch information
Litarnus committed Jan 23, 2025
2 parents 4d82dff + f06b99a commit befd934
Show file tree
Hide file tree
Showing 23 changed files with 336 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ jobs:
runs-on: |-
${{fromJson('{
"x86_64-unknown-linux-gnu": "ubuntu-20.04",
"aarch64-unknown-linux-gnu": "ubuntu-22.04-arm64-relay"
"aarch64-unknown-linux-gnu": "ubuntu-22.04-arm"
}')[matrix.target] }}
if: "!startsWith(github.ref, 'refs/heads/release-library/')"
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
**Features**:

- Add configuration option to limit the amount of concurrent http connections. ([#4453](https://github.com/getsentry/relay/pull/4453))
- Add flags context to event schema. ([#4458](https://github.com/getsentry/relay/pull/4458))
- Add support for view hierarchy attachment scrubbing. ([#4452](https://github.com/getsentry/relay/pull/4452))

**Internal**:
Expand All @@ -13,6 +14,10 @@

## 25.1.0

**Features**:

- Use a separate rate-limit enforcement category for replay-video envelope items. ([#4459](https://github.com/getsentry/relay/pull/4459))

**Internal**:

- Updates performance score calculation on spans and events to also store cdf values as measurements. ([#4438](https://github.com/getsentry/relay/pull/4438))
Expand Down
38 changes: 14 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ smallvec = { version = "1.13.2", features = ["serde"] }
socket2 = "0.5.8"
sqlparser = "0.44.0"
sqlx = { version = "0.8.2", default-features = false }
statsdproxy = { version = "0.2.0", default-features = false }
# See statsdproxy PR: https://github.com/getsentry/statsdproxy/pull/55
statsdproxy = { git = "https://github.com/getsentry/statsdproxy", rev = "50155c5c5dc103fb1557e5ccde6b2cf6dfe82b9f", default-features = false}
symbolic-common = { version = "12.12.3", default-features = false }
symbolic-unreal = { version = "12.12.3", default-features = false }
syn = { version = "2.0.90" }
Expand Down
6 changes: 5 additions & 1 deletion py/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog

## Unreleased
## 0.9.6

- Add a new data category for UI profiling. ([#4468](https://github.com/getsentry/relay/pull/4468))

## 0.9.5

- Add data categories for LogItem and LogByte. ([#4455](https://github.com/getsentry/relay/pull/4455))

Expand Down
1 change: 1 addition & 0 deletions py/sentry_relay/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class DataCategory(IntEnum):
ATTACHMENT_ITEM = 22
LOG_ITEM = 23
LOG_BYTE = 24
PROFILE_DURATION_UI = 25
UNKNOWN = -1
# end generated

Expand Down
12 changes: 10 additions & 2 deletions relay-base-schema/src/data_category.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ pub enum DataCategory {
SpanIndexed = 16,
/// ProfileDuration
///
/// This data category is used to count the number of milliseconds we have per indexed profile chunk.
/// We will then bill per second.
/// This data category is used to count the number of milliseconds per indexed profile chunk,
/// excluding UI profile chunks.
ProfileDuration = 17,
/// ProfileChunk
///
Expand Down Expand Up @@ -101,6 +101,12 @@ pub enum DataCategory {
///
/// This is the category for logs for which we store log event total bytes for users.
LogByte = 24,
/// ProfileDurationUi
///
/// This data category is used to count the number of milliseconds per indexed UI profile
/// chunk.
ProfileDurationUi = 25,

//
// 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 @@ -137,6 +143,7 @@ impl DataCategory {
"metric_bucket" => Self::MetricBucket,
"span_indexed" => Self::SpanIndexed,
"profile_duration" => Self::ProfileDuration,
"profile_duration_ui" => Self::ProfileDurationUi,
"profile_chunk" => Self::ProfileChunk,
"metric_second" => Self::MetricSecond,
"replay_video" => Self::ReplayVideo,
Expand Down Expand Up @@ -170,6 +177,7 @@ impl DataCategory {
Self::MetricBucket => "metric_bucket",
Self::SpanIndexed => "span_indexed",
Self::ProfileDuration => "profile_duration",
Self::ProfileDurationUi => "profile_duration_ui",
Self::ProfileChunk => "profile_chunk",
Self::MetricSecond => "metric_second",
Self::ReplayVideo => "replay_video",
Expand Down
2 changes: 1 addition & 1 deletion relay-cabi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "relay-cabi"
version = "0.9.4"
version = "0.9.6"
authors = ["Sentry <[email protected]>"]
homepage = "https://getsentry.github.io/relay/"
repository = "https://github.com/getsentry/relay"
Expand Down
17 changes: 12 additions & 5 deletions relay-cabi/include/relay.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#ifndef RELAY_H_INCLUDED
#define RELAY_H_INCLUDED

/* Generated with cbindgen:0.27.0 */
/* Generated with cbindgen:0.28.0 */

/* Warning, this file is autogenerated. Do not modify this manually. */

Expand Down Expand Up @@ -109,8 +109,8 @@ enum RelayDataCategory {
/**
* ProfileDuration
*
* This data category is used to count the number of milliseconds we have per indexed profile chunk.
* We will then bill per second.
* This data category is used to count the number of milliseconds per indexed profile chunk,
* excluding UI profile chunks.
*/
RELAY_DATA_CATEGORY_PROFILE_DURATION = 17,
/**
Expand Down Expand Up @@ -143,18 +143,25 @@ enum RelayDataCategory {
*/
RELAY_DATA_CATEGORY_ATTACHMENT_ITEM = 22,
/**
* LogCount
* LogItem
*
* This is the category for logs for which we store the count log events for users for measuring
* missing breadcrumbs, and count of logs for rate limiting purposes.
*/
RELAY_DATA_CATEGORY_LOG_ITEM = 23,
/**
* LogBytes
* LogByte
*
* This is the category for logs for which we store log event total bytes for users.
*/
RELAY_DATA_CATEGORY_LOG_BYTE = 24,
/**
* ProfileDurationUi
*
* This data category is used to count the number of milliseconds per indexed UI profile
* chunk.
*/
RELAY_DATA_CATEGORY_PROFILE_DURATION_UI = 25,
/**
* Any other data category not known by this Relay.
*/
Expand Down
109 changes: 109 additions & 0 deletions relay-event-schema/src/protocol/contexts/flags.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
use crate::processor::ProcessValue;
use relay_protocol::{Annotated, Empty, FromValue, IntoValue, Object, Value};

/// Flags context.
///
/// The flags context is a collection of flag evaluations performed during the lifetime
/// of a process. The flags are submitted in the order they were evaluated to preserve
/// the state transformations taking place in the application.
#[derive(Clone, Debug, Default, PartialEq, Empty, FromValue, IntoValue, ProcessValue)]
pub struct FlagsContext {
/// An list of flag evaluation results in the order they were evaluated.
pub values: Annotated<Vec<Annotated<FlagsContextItem>>>,
/// Additional arbitrary fields for forwards compatibility.
#[metastructure(additional_properties, retain = true, pii = "maybe")]
pub other: Object<Value>,
}

/// Flags context item.
///
/// A flag context item represents an individual flag evaluation result. It contains
/// the name of the flag and its evaluation result.
#[derive(Clone, Debug, Default, PartialEq, Empty, FromValue, IntoValue, ProcessValue)]
pub struct FlagsContextItem {
/// The name of the evaluated flag.
#[metastructure(max_chars = 200, allow_chars = "a-zA-Z0-9_.:-")]
pub flag: Annotated<String>,
/// The result of the flag evaluation. Evaluation results can be any valid JSON
/// type.
#[metastructure(max_chars = 200, deny_chars = "\n")]
pub result: Annotated<Value>,
/// Additional arbitrary fields for forwards compatibility.
#[metastructure(additional_properties, retain = true, pii = "maybe")]
pub other: Object<Value>,
}

impl super::DefaultContext for FlagsContext {
fn default_key() -> &'static str {
"flags"
}

fn from_context(context: super::Context) -> Option<Self> {
match context {
super::Context::Flags(c) => Some(*c),
_ => None,
}
}

fn cast(context: &super::Context) -> Option<&Self> {
match context {
super::Context::Flags(c) => Some(c),
_ => None,
}
}

fn cast_mut(context: &mut super::Context) -> Option<&mut Self> {
match context {
super::Context::Flags(c) => Some(c),
_ => None,
}
}

fn into_context(self) -> super::Context {
super::Context::Flags(Box::new(self))
}
}

#[cfg(test)]
mod test {
use super::*;
use crate::protocol::Context;

#[test]
fn test_deserializing_flag_context() {
let json = r#"{
"values": [
{
"flag": "abc",
"result": true
},
{
"flag": "def",
"result": false
}
],
"type": "flags"
}"#;

let flags = vec![
Annotated::new(FlagsContextItem {
flag: Annotated::new("abc".to_string()),
result: Annotated::new(Value::Bool(true)),
other: Object::default(),
}),
Annotated::new(FlagsContextItem {
flag: Annotated::new("def".to_string()),
result: Annotated::new(Value::Bool(false)),
other: Object::default(),
}),
];

let context = Annotated::new(Context::Flags(Box::new(FlagsContext {
values: Annotated::new(flags),
other: Object::default(),
})));

assert_eq!(context, Annotated::from_json(json).unwrap());
assert_eq!(json, context.to_json_pretty().unwrap());
}
}
3 changes: 3 additions & 0 deletions relay-event-schema/src/protocol/contexts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ mod app;
mod browser;
mod cloud_resource;
mod device;
mod flags;
mod gpu;
mod monitor;
mod nel;
Expand Down Expand Up @@ -69,6 +70,8 @@ pub enum Context {
Profile(Box<ProfileContext>),
/// Information related to Replay.
Replay(Box<ReplayContext>),
/// Information related to Feature flags.
Flags(Box<flags::FlagsContext>),
/// Information related to User Report V2. TODO:(jferg): rename to UserFeedbackContext
#[metastructure(tag = "feedback")]
UserReportV2(Box<UserReportV2Context>),
Expand Down
Loading

0 comments on commit befd934

Please sign in to comment.