|
@@ -98,6 +98,11 @@ def _get_alert_metric_specs(
|
|
|
if not ("organizations:on-demand-metrics-extraction" in enabled_features or prefilling):
|
|
|
return []
|
|
|
|
|
|
+ metrics.incr(
|
|
|
+ "on_demand_metrics.get_alerts",
|
|
|
+ tags={"prefilling": prefilling},
|
|
|
+ )
|
|
|
+
|
|
|
datasets = [Dataset.PerformanceMetrics.value]
|
|
|
if prefilling:
|
|
|
datasets.append(Dataset.Transactions.value)
|
|
@@ -115,7 +120,11 @@ def _get_alert_metric_specs(
|
|
|
specs = []
|
|
|
for alert in alert_rules:
|
|
|
alert_snuba_query = alert.snuba_query
|
|
|
- if result := _convert_snuba_query_to_metric(project, alert.snuba_query, prefilling):
|
|
|
+ metrics.incr(
|
|
|
+ "on_demand_metrics.before_alert_spec_generation",
|
|
|
+ tags={"prefilling": prefilling, "dataset": alert_snuba_query.dataset},
|
|
|
+ )
|
|
|
+ if result := _convert_snuba_query_to_metric(project, alert_snuba_query, prefilling):
|
|
|
_log_on_demand_metric_spec(
|
|
|
project_id=project.id,
|
|
|
spec_for="alert",
|
|
@@ -150,6 +159,11 @@ def _get_widget_metric_specs(
|
|
|
):
|
|
|
return []
|
|
|
|
|
|
+ metrics.incr(
|
|
|
+ "on_demand_metrics.get_widgets",
|
|
|
+ tags={"prefilling": prefilling},
|
|
|
+ )
|
|
|
+
|
|
|
# fetch all queries of all on demand metrics widgets of this organization
|
|
|
widget_queries = DashboardWidgetQuery.objects.filter(
|
|
|
widget__dashboard__organization=project.organization,
|
|
@@ -217,6 +231,10 @@ def _convert_widget_query_to_metric(
|
|
|
return metrics_specs
|
|
|
|
|
|
for aggregate in widget_query.aggregates:
|
|
|
+ metrics.incr(
|
|
|
+ "on_demand_metrics.before_widget_spec_generation",
|
|
|
+ tags={"prefilling": prefilling},
|
|
|
+ )
|
|
|
if result := _convert_aggregate_and_query_to_metric(
|
|
|
project,
|
|
|
# there is an internal check to make sure we extract metrics oly for performance dataset
|