Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 8 additions & 1 deletion relay-conventions/build/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ pub enum DeprecationStatus {
Backfill,
/// Only write the replacement name.
Normalize,
/// Dedicated transformation code handles the move-and-reshape.
///
/// Produces `WriteBehavior::CurrentName` so the generic renaming logic
/// leaves these attributes alone.
Transform,
Comment thread
constantinius marked this conversation as resolved.
}

/// Information about an attribute's deprecation.
Expand Down Expand Up @@ -123,7 +128,9 @@ fn format_write_behavior(deprecation: Option<&Deprecation>) -> String {
DeprecationStatus::Backfill => {
format!("WriteBehavior::BothNames({name})")
}
DeprecationStatus::Normalize => {
// Transform is treated as Normalize until dedicated transformation
// code is added.
DeprecationStatus::Normalize | DeprecationStatus::Transform => {
Comment thread
constantinius marked this conversation as resolved.
format!("WriteBehavior::NewName({name})")
Comment thread
constantinius marked this conversation as resolved.
}
}
Expand Down
2 changes: 1 addition & 1 deletion relay-conventions/sentry-conventions
Submodule sentry-conventions updated 99 files
+9 −0 .github/CODEOWNERS
+26 −1 CONTRIBUTING.md
+3 −3 docs/package.json
+8 −3 docs/src/components/AttributeCard.astro
+45 −32 docs/src/content.config.ts
+1 −1 docs/src/pages/index.astro
+9 −3 docs/src/pages/llms-full.txt.ts
+1,683 −96 javascript/sentry-conventions/src/attributes.ts
+209 −4 javascript/sentry-conventions/src/op.ts
+64 −0 model/attribute_transformations/gen_ai_request_messages_to_input_messages.json
+80 −0 model/attribute_transformations/gen_ai_response_to_output_messages.json
+24 −0 model/attributes/address.json
+19 −0 model/attributes/app/app__vitals__frames__frozen__rate.json
+19 −0 model/attributes/app/app__vitals__frames__slow__rate.json
+19 −0 model/attributes/app/app__vitals__stall__duration.json
+19 −0 model/attributes/app/app__vitals__stall__percentage.json
+24 −0 model/attributes/aws/aws__operation_name.json
+23 −0 model/attributes/aws/aws__request__url.json
+23 −0 model/attributes/aws_region.json
+5 −0 model/attributes/cloud/cloud__region.json
+5 −1 model/attributes/cloudflare/cloudflare__d1__query_type.json
+23 −0 model/attributes/code.json
+5 −1 model/attributes/code/code__function.json
+5 −1 model/attributes/code/code__function__name.json
+5 −0 model/attributes/db/db__collection__name.json
+23 −0 model/attributes/db/db__mongodb__collection.json
+5 −1 model/attributes/db/db__operation.json
+5 −1 model/attributes/db/db__operation__name.json
+23 −0 model/attributes/db/db__params.json
+6 −1 model/attributes/db/db__query__summary.json
+5 −1 model/attributes/db/db__query__text.json
+5 −0 model/attributes/db/db__redis__key.json
+9 −3 model/attributes/db/db__statement.json
+24 −0 model/attributes/django/django__function_name.json
+24 −0 model/attributes/django/django__middleware_name.json
+12 −1 model/attributes/frames_frozen_rate.json
+12 −1 model/attributes/frames_slow_rate.json
+23 −0 model/attributes/gcp_region.json
+3 −2 model/attributes/gen_ai/gen_ai__request__messages.json
+4 −3 model/attributes/gen_ai/gen_ai__response__text.json
+3 −2 model/attributes/gen_ai/gen_ai__response__tool_calls.json
+5 −1 model/attributes/http/http__host.json
+11 −2 model/attributes/http/http__route.json
+5 −1 model/attributes/http/http__server_name.json
+1 −1 model/attributes/http/http__url.json
+23 −0 model/attributes/litestar/litestar__middleware_name.json
+18 −0 model/attributes/messaging/messaging__destination__partition__id.json
+21 −0 model/attributes/messaging/messaging__destination_kind.json
+18 −0 model/attributes/messaging/messaging__kafka__message__key.json
+18 −0 model/attributes/messaging/messaging__kafka__message__tombstone.json
+18 −0 model/attributes/messaging/messaging__kafka__offset.json
+10 −0 model/attributes/middleware/middleware__name.json
+5 −1 model/attributes/net/net__host__name.json
+5 −1 model/attributes/net/net__host__port.json
+24 −0 model/attributes/port.json
+5 −0 model/attributes/process/process__pid.json
+24 −0 model/attributes/query.json
+23 −0 model/attributes/redis/redis__command.json
+23 −0 model/attributes/redis/redis__key.json
+10 −0 model/attributes/rpc/rpc__grpc__status_code.json
+5 −0 model/attributes/rpc/rpc__method.json
+5 −0 model/attributes/rpc/rpc__response__status_code.json
+9 −1 model/attributes/sentry/sentry__kind.json
+22 −0 model/attributes/sentry/sentry__segment__name__source.json
+6 −3 model/attributes/sentry/sentry__source.json
+8 −0 model/attributes/sentry/sentry__span__source.json
+5 −1 model/attributes/server/server__address.json
+5 −1 model/attributes/server/server__port.json
+5 −1 model/attributes/server_name.json
+11 −0 model/attributes/stall_percentage.json
+11 −0 model/attributes/stall_total_time.json
+23 −0 model/attributes/starlette/starlette__middleware_name.json
+24 −0 model/attributes/starlite/starlite__middleware_name.json
+23 −0 model/attributes/subprocess/subprocess__pid.json
+1 −1 model/attributes/url.json
+5 −1 model/attributes/url/url__full.json
+11 −3 model/attributes/url/url__template.json
+1 −0 model/description/http.json
+1 −1 model/measurements/frames_frozen_rate.json
+1 −1 model/measurements/frames_slow_rate.json
+2 −2 model/measurements/stall_percentage.json
+1 −1 model/measurements/stall_total_time.json
+108 −0 model/op/browser.json
+16 −4 model/op/gen_ai.json
+42 −0 model/op/object.json
+4 −0 model/op/web_server.json
+1 −1 package.json
+1,234 −58 python/src/sentry_conventions/attributes.py
+128 −4 rust/src/op.rs
+219 −4 schemas/attribute.schema.json
+84 −0 schemas/attribute_transformation.schema.json
+21 −0 scripts/attribute_examples.ts
+24 −7 scripts/create_attribute.ts
+85 −26 scripts/generate_attributes.ts
+26 −2 scripts/types.ts
+132 −0 test/attribute-transformations.test.ts
+144 −32 test/attributes.test.ts
+70 −0 test/generate_attributes.test.ts
+1,265 −904 yarn.lock
11 changes: 7 additions & 4 deletions relay-event-normalization/src/eap/mobile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,27 +101,30 @@ pub fn normalize_mobile_measurements(
.and_then(|v| v.as_f64())
{
let frames_frozen_rate = frames_frozen / frames_total;
attributes.insert(FRAMES_FROZEN_RATE.to_owned(), frames_frozen_rate);
attributes.insert(
APP__VITALS__FRAMES__FROZEN__RATE.to_owned(),
frames_frozen_rate,
);
}

if let Some(frames_slow) = attributes
.get_value(APP__VITALS__FRAMES__SLOW__COUNT)
.and_then(|v| v.as_f64())
{
let frames_slow_rate = frames_slow / frames_total;
attributes.insert(FRAMES_SLOW_RATE.to_owned(), frames_slow_rate);
attributes.insert(APP__VITALS__FRAMES__SLOW__RATE.to_owned(), frames_slow_rate);
}
}

// Get stall_percentage
if let Some(span_duration) = span_duration
&& !span_duration.is_zero()
&& let Some(stall_total_time_ms) = attributes
.get_value(STALL_TOTAL_TIME)
.get_value(APP__VITALS__STALL__DURATION)
.and_then(|v| v.as_f64())
{
let stall_percentage = stall_total_time_ms / (span_duration.as_millis() as f64);
attributes.insert(STALL_PERCENTAGE.to_owned(), stall_percentage);
attributes.insert(APP__VITALS__STALL__PERCENTAGE.to_owned(), stall_percentage);
}
}

Expand Down
32 changes: 18 additions & 14 deletions relay-event-normalization/src/eap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3099,20 +3099,36 @@ mod tests {
normalize_attribute_names(&mut attributes);
normalize_mobile_measurements(&mut attributes, Some(Duration::from_secs(5)));

insta::assert_json_snapshot!(SerializableAnnotated(&attributes), @r###"
insta::assert_json_snapshot!(SerializableAnnotated(&attributes), @r#"
{
"app.vitals.frames.frozen.count": {
"type": "integer",
"value": 2
},
"app.vitals.frames.frozen.rate": {
"type": "double",
"value": 0.5
},
"app.vitals.frames.slow.count": {
"type": "integer",
"value": 1
},
"app.vitals.frames.slow.rate": {
"type": "double",
"value": 0.25
},
"app.vitals.frames.total.count": {
"type": "integer",
"value": 4
},
"app.vitals.stall.duration": {
"type": "integer",
"value": 4000
},
"app.vitals.stall.percentage": {
"type": "double",
"value": 0.8
},
"frames.slow": {
"type": "integer",
"value": 1
Expand All @@ -3121,23 +3137,11 @@ mod tests {
"type": "integer",
"value": 4
},
"frames_frozen_rate": {
"type": "double",
"value": 0.5
},
"frames_slow_rate": {
"type": "double",
"value": 0.25
},
"stall_percentage": {
"type": "double",
"value": 0.8
},
"stall_total_time": {
"type": "integer",
"value": 4000
}
}
"###);
"#);
}
}
1 change: 0 additions & 1 deletion tests/integration/test_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,6 @@ def test_ai_spans_example_transaction(
"sentry.segment.id": {"type": "string", "value": "657cf984a6a4e59b"},
"sentry.segment.name": {"type": "string", "value": "main"},
"sentry.source": {"type": "string", "value": "custom"},
"sentry.span.source": {"type": "string", "value": "custom"},
"sentry.status": {"type": "string", "value": "ok"},
"sentry.trace.status": {"type": "string", "value": "ok"},
"sentry.transaction.op": {
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/test_spans_standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,13 +851,13 @@ def test_mobile_measurements(
"type": "string",
"value": time_within_delta(expect_resolution="ns"),
},
"stall_total_time": {"value": 4000.0, "type": "double"},
"stall_percentage": {"value": 0.8, "type": "double"},
"app.vitals.stall.duration": {"value": 4000.0, "type": "double"},
"app.vitals.stall.percentage": {"value": 0.8, "type": "double"},
"app.vitals.frames.slow.count": {"value": 1.0, "type": "double"},
"app.vitals.frames.frozen.count": {"value": 2.0, "type": "double"},
"app.vitals.frames.total.count": {"value": 4.0, "type": "double"},
"frames_frozen_rate": {"value": 0.5, "type": "double"},
"frames_slow_rate": {"value": 0.25, "type": "double"},
"app.vitals.frames.frozen.rate": {"value": 0.5, "type": "double"},
"app.vitals.frames.slow.rate": {"value": 0.25, "type": "double"},
"app.vitals.start.cold.value": {"value": 0.123, "type": "double"},
"app.vitals.start.value": {"value": 0.123, "type": "double"},
"app.vitals.start.type": {"value": "cold", "type": "string"},
Expand Down
Loading