Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(spans): Move resource span ingestion to GA #2713

Merged
merged 4 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- Add context for NEL (Network Error Logging) reports to the event schema. ([#2421](https://github.com/getsentry/relay/pull/2421))
- Add `validate_pii_selector` to CABI for safe fields validation. ([#2687](https://github.com/getsentry/relay/pull/2687))
- Do not scrub Prisma spans. ([#2711](https://github.com/getsentry/relay/pull/2711))
- Move resource span ingestion to GA. ([#2713](https://github.com/getsentry/relay/pull/2713))
phacops marked this conversation as resolved.
Show resolved Hide resolved

**Bug Fixes**:

Expand Down
14 changes: 3 additions & 11 deletions relay-dynamic-config/src/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,10 @@ pub fn add_span_metrics(project_config: &mut ProjectConfig) {
let is_mongo = RuleCondition::eq("span.system", "mongodb")
| RuleCondition::glob("span.description", MONGODB_QUERIES);

let mut conditions = RuleCondition::eq("span.op", "http.client")
RuleCondition::eq("span.op", "http.client")
| RuleCondition::glob("span.op", MOBILE_OPS)
| (RuleCondition::glob("span.op", "db*") & !is_disabled & !is_mongo);

if project_config
.features
.has(Feature::SpanMetricsExtractionResource)
{
conditions = conditions | resource_condition.clone();
}

conditions
| (RuleCondition::glob("span.op", "db*") & !is_disabled & !is_mongo)
| resource_condition.clone()
};

// For mobile spans, only extract duration metrics when they are below a threshold.
Expand Down
6 changes: 3 additions & 3 deletions relay-dynamic-config/src/feature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ pub enum Feature {
/// Enable processing profiles
#[serde(rename = "organizations:profiling")]
Profiling,
/// Enable extracting resource spans.
#[serde(rename = "projects:span-metrics-extraction-resource")]
SpanMetricsExtractionResource,

/// Deprecated, still forwarded for older downstream Relays.
#[serde(rename = "organizations:transaction-name-mark-scrubbed-as-sanitized")]
Expand All @@ -46,6 +43,9 @@ pub enum Feature {
/// Deprecated, still forwarded for older downstream Relays.
#[serde(rename = "projects:extract-standalone-spans")]
Deprecated4,
/// Deprecated, still forwarded for older downstream Relays.
#[serde(rename = "projects:span-metrics-extraction-resource")]
Deprecated5,
/// Forward compatibility.
#[serde(other)]
Unknown,
Expand Down
13 changes: 4 additions & 9 deletions relay-server/src/actors/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2326,7 +2326,7 @@ impl EnvelopeProcessorService {
}

#[cfg(feature = "processing")]
fn is_span_allowed(&self, span: &Span, resource_span_extraction_enabled: bool) -> bool {
fn is_span_allowed(&self, span: &Span) -> bool {
let Some(op) = span.op.value() else {
return false;
};
Expand All @@ -2339,8 +2339,8 @@ impl EnvelopeProcessorService {
.and_then(|v| v.get("span.system"))
.and_then(|system| system.as_str())
.unwrap_or_default();
(resource_span_extraction_enabled
&& (op.contains("resource.script") || op.contains("resource.css")))
op.contains("resource.script")
|| op.contains("resource.css")
|| op == "http.client"
|| op.starts_with("app.")
|| op.starts_with("ui.load")
Expand Down Expand Up @@ -2404,9 +2404,6 @@ impl EnvelopeProcessorService {
let all_modules_enabled = state
.project_state
.has_feature(Feature::SpanMetricsExtractionAllModules);
let resource_span_extraction_enabled = state
.project_state
.has_feature(Feature::SpanMetricsExtractionResource);

// Add child spans as envelope items.
if let Some(child_spans) = event.spans.value() {
Expand All @@ -2415,9 +2412,7 @@ impl EnvelopeProcessorService {
continue;
};
// HACK: filter spans based on module until we figure out grouping.
if !all_modules_enabled
&& !self.is_span_allowed(inner_span, resource_span_extraction_enabled)
{
if !all_modules_enabled && !self.is_span_allowed(inner_span) {
continue;
}
// HACK: clone the span to set the segment_id. This should happen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,51 @@ expression: metrics
"transaction.op": "myop",
},
},
Bucket {
timestamp: UnixTimestamp(1597976302),
width: 0,
name: "d:spans/exclusive_time@millisecond",
value: Distribution(
[
2000.0,
],
),
tags: {
"environment": "fake_environment",
"http.status_code": "500",
"span.category": "resource",
"span.description": "http://domain/*/myscript-*.js",
"span.domain": "domain",
"span.group": "ea1af0b8d5f734c5",
"span.op": "resource.script",
"span.status": "ok",
"transaction": "gEt /api/:version/users/",
"transaction.method": "POST",
"transaction.op": "myop",
},
},
Bucket {
timestamp: UnixTimestamp(1597976302),
width: 0,
name: "d:spans/exclusive_time_light@millisecond",
value: Distribution(
[
2000.0,
],
),
tags: {
"environment": "fake_environment",
"http.status_code": "500",
"span.category": "resource",
"span.description": "http://domain/*/myscript-*.js",
"span.domain": "domain",
"span.group": "ea1af0b8d5f734c5",
"span.op": "resource.script",
"span.status": "ok",
"transaction.method": "POST",
"transaction.op": "myop",
},
},
Bucket {
timestamp: UnixTimestamp(1597976302),
width: 0,
Expand Down Expand Up @@ -1117,4 +1162,106 @@ expression: metrics
"transaction.op": "myop",
},
},
Bucket {
timestamp: UnixTimestamp(1694732408),
width: 0,
name: "d:spans/exclusive_time@millisecond",
value: Distribution(
[
477.800131,
],
),
tags: {
"environment": "fake_environment",
"http.status_code": "500",
"resource.render_blocking_status": "blocking",
"span.category": "resource",
"span.description": "https://*.domain.com/*/*.css",
"span.domain": "*.domain.com",
"span.group": "d744fa0716ef1142",
"span.op": "resource.css",
"transaction": "gEt /api/:version/users/",
"transaction.method": "POST",
"transaction.op": "myop",
},
},
Bucket {
timestamp: UnixTimestamp(1694732408),
width: 0,
name: "d:spans/exclusive_time_light@millisecond",
value: Distribution(
[
477.800131,
],
),
tags: {
"environment": "fake_environment",
"http.status_code": "500",
"resource.render_blocking_status": "blocking",
"span.category": "resource",
"span.description": "https://*.domain.com/*/*.css",
"span.domain": "*.domain.com",
"span.group": "d744fa0716ef1142",
"span.op": "resource.css",
"transaction.method": "POST",
"transaction.op": "myop",
},
},
Bucket {
timestamp: UnixTimestamp(1694732408),
width: 0,
name: "d:spans/http.response_content_length@byte",
value: Distribution(
[
36170.0,
],
),
tags: {
"environment": "fake_environment",
"resource.render_blocking_status": "blocking",
"span.description": "https://*.domain.com/*/*.css",
"span.domain": "*.domain.com",
"span.group": "d744fa0716ef1142",
"span.op": "resource.css",
"transaction": "gEt /api/:version/users/",
},
},
Bucket {
timestamp: UnixTimestamp(1694732408),
width: 0,
name: "d:spans/http.decoded_response_content_length@byte",
value: Distribution(
[
128950.0,
],
),
tags: {
"environment": "fake_environment",
"resource.render_blocking_status": "blocking",
"span.description": "https://*.domain.com/*/*.css",
"span.domain": "*.domain.com",
"span.group": "d744fa0716ef1142",
"span.op": "resource.css",
"transaction": "gEt /api/:version/users/",
},
},
Bucket {
timestamp: UnixTimestamp(1694732408),
width: 0,
name: "d:spans/http.response_transfer_size@byte",
value: Distribution(
[
36470.0,
],
),
tags: {
"environment": "fake_environment",
"resource.render_blocking_status": "blocking",
"span.description": "https://*.domain.com/*/*.css",
"span.domain": "*.domain.com",
"span.group": "d744fa0716ef1142",
"span.op": "resource.css",
"transaction": "gEt /api/:version/users/",
},
},
]