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(perf): Add detection for render-blocking asset performance issues #37826

Merged
merged 2 commits into from Aug 16, 2022

Conversation

mjq-sentry
Copy link
Member

Tag transactions that have slow asset load spans before a slow FCP as having render-blocking assets. The thresholds are configurable, but currently we're looking for transactions with an FCP between 2s and 10s, where an asset load takes up at least 25% of that time.

The thresholds will be tuned before we start generating actual Performance Issues from this data - tagging the transactions will let us see what we're detecting it and validate/tune it before it becomes visible to users.

This detector's use of event properties is a little awkward given the current PerformanceDetector interface, but I thought it would be better to get the rest of our planned detectors in before we refactor too much.

Fixes PERF-1677

Tag transactions that have slow asset load spans before a slow FCP as having
render-blocking assets. The thresholds are configurable, but currently we're
looking for transactions with an FCP between 2s and 10s, where an asset load
takes up at least 25% of that time.

The thresholds will be tuned before we start generating
actual Performance Issues from this data - tagging the transactions will let us
see what we're detecting it and validate/tune it before it becomes visible to
users.

This detector's use of event properties is a little awkward given the current
`PerformanceDetector` interface, but I thought it would be better to get the
rest of our planned detectors in before we refactor too much.

Fixes PERF-1677
"fcp_maximum_threshold": 10000.0, # ms
"fcp_ratio_threshold": 0.25,
"allowed_span_ops": ["resource.link", "resource.script"],
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making this an array like the others is awkward: the settings aren't op-specific, but even a single-item array with settings_for_span can't work because the FCP min/max thresholds aren't used in the context of an individual span at all. Works fine as a hash read directly, but it's inconsistent with the rest of the settings.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we can address settings after all the other detectors are done

# Only concern ourselves with transactions where the FCP is within the
# range we care about.
fcp_hash = event.get("measurements", {}).get("fcp", {})
if "value" in fcp_hash and ("unit" not in fcp_hash or fcp_hash["unit"] == "millisecond"):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find anywhere where we're dealing with different units for measurement values. The browser SDK, which is the only thing generating these resource spans, uses millisecond.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to be more restrictive, the output inside our metrics will show us whether it was somehow too restrictive, and we can watch it over time.

Comment on lines +472 to +473
# Early return for all future span visits.
self.fcp = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we can either have visit_span return, or we set it up so visit_span is indirectly called from a base function which checks some base property like PerformanceDetector.isDisabled so each class has more control.

@@ -24,6 +24,7 @@ class DetectorType(Enum):
DUPLICATE_SPANS = "duplicates"
SEQUENTIAL_SLOW_SPANS = "sequential"
LONG_TASK_SPANS = "long_task"
RENDER_BLOCKING_ASSET_SPAN = "render_blocking_assets"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@k-fish Your comment above mentions tag key length limits - do you know what that limit is offhand? This name is probably too long 😬

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already counted when I did the review, it should be fine. (limit is 32, that sentence is 22, we add less than 10 elsewhere, it's close but 🤷 )

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tag keys have a maximum length of 32 characters and can contain only letters (a-zA-Z), numbers (0-9), underscores (_), periods (.), colons (:), and dashes (-).

Tag values have a maximum length of 200 characters and they cannot contain the newline (\n) character.

@mjq-sentry mjq-sentry merged commit cdca991 into master Aug 16, 2022
@mjq-sentry mjq-sentry deleted the mjq/perf-1677-render-blocking-assets branch August 16, 2022 13:27
@github-actions github-actions bot locked and limited conversation to collaborators Sep 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants