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

ref(discover): Use snake case for dataset variable #74215

Merged
Merged
Changes from all 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
26 changes: 13 additions & 13 deletions src/sentry/api/endpoints/organization_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ def get(self, request: Request, organization) -> Response:
elif referrer not in ALLOWED_EVENTS_REFERRERS:
referrer = Referrer.API_ORGANIZATION_EVENTS.value

def _data_fn(scopedDataset, offset, limit, query) -> dict[str, Any]:
return scopedDataset.query(
def _data_fn(scoped_dataset, offset, limit, query) -> dict[str, Any]:
return scoped_dataset.query(
selected_columns=self.get_field_list(organization, request),
query=query,
params=params,
Expand All @@ -378,7 +378,7 @@ def _data_fn(scopedDataset, offset, limit, query) -> dict[str, Any]:
)

@sentry_sdk.tracing.trace
def _dashboards_data_fn(scopedDataset, offset, limit, scoped_query, dashboard_widget_id):
def _dashboards_data_fn(scoped_dataset, offset, limit, scoped_query, dashboard_widget_id):
try:
widget = DashboardWidget.objects.get(id=dashboard_widget_id)
does_widget_have_split = widget.discover_widget_split is not None
Expand All @@ -394,7 +394,7 @@ def _dashboards_data_fn(scopedDataset, offset, limit, scoped_query, dashboard_wi
split_dataset = errors
elif widget.discover_widget_split == DashboardWidgetTypes.TRANSACTION_LIKE:
# We can't add event.type:transaction for now because of on-demand.
split_dataset = scopedDataset
split_dataset = scoped_dataset
else:
split_dataset = discover

Expand All @@ -408,7 +408,7 @@ def _dashboards_data_fn(scopedDataset, offset, limit, scoped_query, dashboard_wi
has_errors = False
error_results = None

original_results = _data_fn(scopedDataset, offset, limit, scoped_query)
original_results = _data_fn(scoped_dataset, offset, limit, scoped_query)
if original_results.get("data"):
dataset_meta = original_results.get("meta", {})
else:
Expand Down Expand Up @@ -445,10 +445,10 @@ def _dashboards_data_fn(scopedDataset, offset, limit, scoped_query, dashboard_wi
except Exception as e:
# Swallow the exception if it was due to the discover split, and try again one more time.
sentry_sdk.capture_exception(e)
return _data_fn(scopedDataset, offset, limit, scoped_query)
return _data_fn(scoped_dataset, offset, limit, scoped_query)

@sentry_sdk.tracing.trace
def _discover_data_fn(scopedDataset, offset, limit, scoped_query, discover_saved_query_id):
def _discover_data_fn(scoped_dataset, offset, limit, scoped_query, discover_saved_query_id):
try:
discover_query = DiscoverSavedQuery.objects.get(
id=discover_saved_query_id, organization=organization
Expand All @@ -457,7 +457,7 @@ def _discover_data_fn(scopedDataset, offset, limit, scoped_query, discover_saved
discover_query.dataset is not DiscoverSavedQueryTypes.DISCOVER
)
if does_widget_have_split:
return _data_fn(scopedDataset, offset, limit, scoped_query)
return _data_fn(scoped_dataset, offset, limit, scoped_query)

dataset_inferred_from_query = dataset_split_decision_inferred_from_query(
self.get_field_list(organization, request),
Expand Down Expand Up @@ -547,9 +547,9 @@ def _discover_data_fn(scopedDataset, offset, limit, scoped_query, discover_saved
except Exception as e:
# Swallow the exception if it was due to the discover split, and try again one more time.
sentry_sdk.capture_exception(e)
return _data_fn(scopedDataset, offset, limit, scoped_query)
return _data_fn(scoped_dataset, offset, limit, scoped_query)

def data_fn_factory(scopedDataset):
def data_fn_factory(scoped_dataset):
"""
This factory closes over query and dataset in order to make an additional request to the errors dataset
in the case that this request is from a dashboard widget or a discover query and we're trying to split
Expand All @@ -564,14 +564,14 @@ def data_fn_factory(scopedDataset):
def fn(offset, limit) -> dict[str, Any]:
if save_discover_dataset_decision and discover_saved_query_id:
return _discover_data_fn(
scopedDataset, offset, limit, scoped_query, discover_saved_query_id
scoped_dataset, offset, limit, scoped_query, discover_saved_query_id
)

if not (metrics_enhanced and dashboard_widget_id):
return _data_fn(scopedDataset, offset, limit, scoped_query)
return _data_fn(scoped_dataset, offset, limit, scoped_query)

return _dashboards_data_fn(
scopedDataset, offset, limit, scoped_query, dashboard_widget_id
scoped_dataset, offset, limit, scoped_query, dashboard_widget_id
)

return fn
Expand Down
Loading