fix(metrics): Remove use_metrics_layer from query builder core#108755
Merged
fix(metrics): Remove use_metrics_layer from query builder core#108755
Conversation
Contributor
|
🚨 Warning: This pull request contains Frontend and Backend changes! It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently. Have questions? Please ask in the |
c075459 to
5e20e2c
Compare
cc7672a to
a750983
Compare
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
wmak
approved these changes
Feb 20, 2026
Base automatically changed from
flag-burner/dead/use-metrics-layer-pr1
to
master
February 23, 2026 17:42
Remove all metrics layer infrastructure from the query builder: - Delete `MetricsLayerDatasetConfig` (670 lines) - Remove `use_metrics_layer` and `insights_metrics_override_metric_layer` from `QueryBuilderConfig` - Remove `use_metrics_layer` property, `is_unsupported_metrics_layer_query` property, and `metrics_layer_functions` list from `MetricsQueryBuilder` - Remove `snql_metric_layer` from `MetricsFunction` - Simplify all conditionals that checked `use_metrics_layer` — keep only the `use_on_demand` paths where applicable - Remove orphaned `resolve_metrics_layer_percentile` helper - Clean up entity_subscription.py and test references PR 2 of 3, depends on PR 1.
Remove the organizations:use-metrics-layer flag from temporary.py since all code referencing it has been removed.
82078d1 to
45e7b2d
Compare
wedamija
added a commit
that referenced
this pull request
Feb 23, 2026
Master already removed use_metrics_layer from the query builder in #108755. Remove the references that were incorrectly preserved during rebase conflict resolution. Also remove now-dead get_features method and batch_features variable from events_meta endpoint. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mchen-sentry
pushed a commit
that referenced
this pull request
Feb 24, 2026
## Summary Removes all metrics layer infrastructure from the query builder core: - **Deleted** `MetricsLayerDatasetConfig` (`datasets/metrics_layer.py`, 670 lines) — the entire dataset config class only used when `use_metrics_layer=True` - **Removed from `QueryBuilderConfig`**: `use_metrics_layer` and `insights_metrics_override_metric_layer` fields - **Removed from `MetricsQueryBuilder`**: `use_metrics_layer` property, `is_unsupported_metrics_layer_query` property, `metrics_layer_functions` list, `_is_unsupported_metrics_layer_query_cache` - **Removed from `MetricsFunction`**: `snql_metric_layer` field - **Simplified conditionals**: All `if self.use_metrics_layer or self.use_on_demand:` simplified to `if self.use_on_demand:`, removing dead `elif self.use_metrics_layer:` branches in `run_query` methods across `MetricsQueryBuilder`, `TimeseriesMetricQueryBuilder`, `TopEventsMetricsQueryBuilder`, and `AlertMetricsQueryBuilder` - **Removed orphaned code**: `resolve_metrics_layer_percentile` helper in `function_aliases.py` - **Cleaned up**: `entity_subscription.py` (removed `insights_metrics_override_metric_layer=True` kwarg), test file references **PR 2 of 3** — based on PR 1 (`flag-burner/dead/use-metrics-layer-pr1`). Follow-up PR 3 will remove the flag registration. Net: **-981 lines**, +61 lines ## Test plan - [x] `pre-commit run --files` passes on all changed files - [x] No remaining `use_metrics_layer` references in `src/sentry/` - [ ] CI passes --------- Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
mrduncan
added a commit
that referenced
this pull request
Mar 7, 2026
Remove 10 entries for deleted files/dirs and update 11 entries for files/dirs that were moved. Removed (deleted from codebase): - /src/sentry/search/events/datasets/metrics_layer.py (removed in #108755) - /src/sentry/utils/relocation.py (removed in #101738) - requirements*.txt (removed in #97627, uv migration) - babel.config.* (removed in #93303, jest 30 migration) - jest-balance.json (never existed as tracked file) - /src/sentry/api/endpoints/user_social_identity* (removed in #77231) - /src/sentry/tasks/check_new_issue_threshold_met.py (removed in #97894) - /tests/sentry/tasks/test_backfill_seer_grouping_records.py (removed in #102364) - /tests/sentry/tasks/test_check_new_issue_threshold_met.py (removed in #97894) - /src/sentry/api/endpoints/check_am2_compatibility.py (removed in #104288) Updated (moved to new locations): - event_reprocessable.py → /src/sentry/issues/endpoints/ (#97900) - organization_event_details.py → /src/sentry/issues/endpoints/ (#97428) - /static/app/{components,views}/codecov/ → .../prevent/ (#97485) - organizationoption.py → models/options/organization_option.py (#31615) - projectoption.py → models/options/project_option.py (#31615) - useroption.py → users/models/user_option.py (#76231) - organization_projects_experiment.py → /src/sentry/core/endpoints/ (#97407) - release_threshold*.py → release_thresholds/ directory (#57085) - test_organization_projects_experiment.py → /tests/sentry/core/endpoints/ (#97407) - test_scim*.py → /tests/sentry/core/endpoints/scim/ (core migration)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes all metrics layer infrastructure from the query builder core:
MetricsLayerDatasetConfig(datasets/metrics_layer.py, 670 lines) — the entire dataset config class only used whenuse_metrics_layer=TrueQueryBuilderConfig:use_metrics_layerandinsights_metrics_override_metric_layerfieldsMetricsQueryBuilder:use_metrics_layerproperty,is_unsupported_metrics_layer_queryproperty,metrics_layer_functionslist,_is_unsupported_metrics_layer_query_cacheMetricsFunction:snql_metric_layerfieldif self.use_metrics_layer or self.use_on_demand:simplified toif self.use_on_demand:, removing deadelif self.use_metrics_layer:branches inrun_querymethods acrossMetricsQueryBuilder,TimeseriesMetricQueryBuilder,TopEventsMetricsQueryBuilder, andAlertMetricsQueryBuilderresolve_metrics_layer_percentilehelper infunction_aliases.pyentity_subscription.py(removedinsights_metrics_override_metric_layer=Truekwarg), test file referencesPR 2 of 3 — based on PR 1 (
flag-burner/dead/use-metrics-layer-pr1). Follow-up PR 3 will remove the flag registration.Net: -981 lines, +61 lines
Test plan
pre-commit run --filespasses on all changed filesuse_metrics_layerreferences insrc/sentry/