-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
ref(querybuilder): Remove ParamsType from tasks #74570
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,7 +34,7 @@ | |
| from sentry.models.project import Project | ||
| from sentry.models.statistical_detectors import RegressionType | ||
| from sentry.profiles.utils import get_from_profiling_service | ||
| from sentry.search.events.types import ParamsType | ||
| from sentry.search.events.types import SnubaParams | ||
| from sentry.seer.breakpoints import BreakpointData | ||
| from sentry.sentry_metrics import indexer | ||
| from sentry.sentry_metrics.use_case_id_registry import UseCaseID | ||
|
|
@@ -503,12 +503,11 @@ def emit_function_regression_issue( | |
| project_ids = [int(regression["project"]) for regression in regressions] | ||
| projects = [projects_by_id[project_id] for project_id in project_ids] | ||
|
|
||
| params: ParamsType = { | ||
| "start": start, | ||
| "end": start + timedelta(minutes=1), | ||
| "project_id": project_ids, | ||
| "project_objects": projects, | ||
| } | ||
| params = SnubaParams( | ||
| start=start, | ||
| end=start + timedelta(minutes=1), | ||
| projects=projects, | ||
| ) | ||
|
|
||
| conditions = [ | ||
| And( | ||
|
|
@@ -523,7 +522,8 @@ def emit_function_regression_issue( | |
| result = functions.query( | ||
| selected_columns=["project.id", "fingerprint", "examples()"], | ||
| query="is_application:1", | ||
| params=params, | ||
| params={}, | ||
| snuba_params=params, | ||
| orderby=["project.id"], | ||
| limit=len(regressions), | ||
| referrer=Referrer.API_PROFILING_FUNCTIONS_STATISTICAL_DETECTOR_EXAMPLE.value, | ||
|
|
@@ -878,12 +878,11 @@ def query_functions(projects: list[Project], start: datetime) -> list[DetectorPa | |
| # we just need to query for the 1 minute of data. | ||
| start = start - timedelta(hours=1) | ||
| start = start.replace(minute=0, second=0, microsecond=0) | ||
| params: ParamsType = { | ||
| "start": start, | ||
| "end": start + timedelta(minutes=1), | ||
| "project_id": [project.id for project in projects], | ||
| "project_objects": projects, | ||
| } | ||
| params = SnubaParams( | ||
| start=start, | ||
| end=start + timedelta(minutes=1), | ||
| projects=projects, | ||
| ) | ||
|
|
||
| # TODOs: handle any errors | ||
| query_results = functions.query( | ||
|
|
@@ -895,7 +894,8 @@ def query_functions(projects: list[Project], start: datetime) -> list[DetectorPa | |
| "p95()", | ||
| ], | ||
| query="is_application:1", | ||
| params=params, | ||
| params={}, | ||
| snuba_params=params, | ||
| orderby=["project.id", "-count()"], | ||
| limitby=("project.id", FUNCTIONS_PER_PROJECT), | ||
| limit=FUNCTIONS_PER_PROJECT * len(projects), | ||
|
|
@@ -924,16 +924,14 @@ def query_functions_timeseries( | |
| agg_function: str, | ||
| ) -> Generator[tuple[int, int | str, SnubaTSResult], None, None]: | ||
| projects = [project for project, _ in functions_list] | ||
| project_ids = [project.id for project in projects] | ||
|
|
||
| # take the last 14 days as our window | ||
| end = start.replace(minute=0, second=0, microsecond=0) + timedelta(hours=1) | ||
| params: ParamsType = { | ||
| "start": end - timedelta(days=14), | ||
| "end": end, | ||
| "project_id": project_ids, | ||
| "project_objects": projects, | ||
| } | ||
| params = SnubaParams( | ||
| start=end - timedelta(days=14), | ||
| end=end, | ||
| projects=projects, | ||
| ) | ||
|
Comment on lines
+930
to
+934
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't use |
||
| interval = 3600 # 1 hour | ||
|
|
||
| chunk: list[dict[str, Any]] = [ | ||
|
|
@@ -948,7 +946,8 @@ def query_functions_timeseries( | |
| timeseries_columns=[agg_function], | ||
| selected_columns=["project.id", "fingerprint"], | ||
| user_query="is_application:1", | ||
| params=params, | ||
| params={}, | ||
| snuba_params=params, | ||
| orderby=None, # unused because top events is specified | ||
| rollup=interval, | ||
| limit=len(chunk), | ||
|
|
||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.