Skip to content

Commit

Permalink
feat(spans): Extract size metrics for all resource spans when needed (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
phacops authored Dec 1, 2023
1 parent a0c44d5 commit 855211e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Return global config ready status to downstream relays. ([#2765](https://github.com/getsentry/relay/pull/2765))
- Add Mixed JS/Android Profiles events processing. ([#2706](https://github.com/getsentry/relay/pull/2706))
- Allow to ingest measurements on a span. ([#2792](https://github.com/getsentry/relay/pull/2792))
- Extract size metrics for all resource spans when permitted. ([#2805](https://github.com/getsentry/relay/pull/2805))
- Add size limits on metric related envelope items. ([#2800](https://github.com/getsentry/relay/pull/2800))
- Include the size offending item in the size limit error message. ([#2801](https://github.com/getsentry/relay/pull/2801))

Expand Down
21 changes: 13 additions & 8 deletions relay-dynamic-config/src/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,29 @@ pub fn add_span_metrics(project_config: &mut ProjectConfig) {
return;
}

let resource_condition = RuleCondition::glob("span.op", RESOURCE_SPAN_OPS);

// Add conditions to filter spans if a specific module is enabled.
// By default, this will extract all spans.
let span_op_conditions = if project_config
let (span_op_conditions, resource_condition) = if project_config
.features
.has(Feature::SpanMetricsExtractionAllModules)
{
RuleCondition::all()
(
RuleCondition::all(),
RuleCondition::glob("span.op", "resource.*"),
)
} else {
let is_disabled = RuleCondition::glob("span.op", DISABLED_DATABASES);
let is_mongo = RuleCondition::eq("span.system", "mongodb")
| RuleCondition::glob("span.description", MONGODB_QUERIES);
let resource_condition = RuleCondition::glob("span.op", RESOURCE_SPAN_OPS);

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

// For mobile spans, only extract duration metrics when they are below a threshold.
Expand Down

0 comments on commit 855211e

Please sign in to comment.