|
@@ -25,10 +25,29 @@ display_modes: Mapping[str, ChartType] = {
|
|
"default": ChartType.SLACK_DISCOVER_TOTAL_PERIOD,
|
|
"default": ChartType.SLACK_DISCOVER_TOTAL_PERIOD,
|
|
"daily": ChartType.SLACK_DISCOVER_TOTAL_DAILY,
|
|
"daily": ChartType.SLACK_DISCOVER_TOTAL_DAILY,
|
|
"top5": ChartType.SLACK_DISCOVER_TOP5_PERIOD,
|
|
"top5": ChartType.SLACK_DISCOVER_TOP5_PERIOD,
|
|
|
|
+ "top5line": ChartType.SLACK_DISCOVER_TOP5_PERIOD_LINE,
|
|
"dailytop5": ChartType.SLACK_DISCOVER_TOP5_DAILY,
|
|
"dailytop5": ChartType.SLACK_DISCOVER_TOP5_DAILY,
|
|
"previous": ChartType.SLACK_DISCOVER_PREVIOUS_PERIOD,
|
|
"previous": ChartType.SLACK_DISCOVER_PREVIOUS_PERIOD,
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+# All `multiPlotType: line` fields in /static/app/utils/discover/fields.tsx
|
|
|
|
+line_plot_fields = {
|
|
|
|
+ "count_unique",
|
|
|
|
+ "failure_count",
|
|
|
|
+ "min",
|
|
|
|
+ "max",
|
|
|
|
+ "p50",
|
|
|
|
+ "p75",
|
|
|
|
+ "p95",
|
|
|
|
+ "p99",
|
|
|
|
+ "p100",
|
|
|
|
+ "percentile",
|
|
|
|
+ "avg",
|
|
|
|
+ "apdex",
|
|
|
|
+ "user_misery",
|
|
|
|
+ "failure_rate",
|
|
|
|
+}
|
|
|
|
+
|
|
TOP_N = 5
|
|
TOP_N = 5
|
|
MAX_PERIOD_DAYS_INCLUDE_PREVIOUS = 45
|
|
MAX_PERIOD_DAYS_INCLUDE_PREVIOUS = 45
|
|
DEFAULT_PERIOD = "14d"
|
|
DEFAULT_PERIOD = "14d"
|
|
@@ -48,6 +67,13 @@ def get_double_period(period: str) -> str:
|
|
return f"{value * 2}{unit}"
|
|
return f"{value * 2}{unit}"
|
|
|
|
|
|
|
|
|
|
|
|
+def get_top5_display_mode(field: str) -> str:
|
|
|
|
+ if is_equation(field):
|
|
|
|
+ return "top5line"
|
|
|
|
+
|
|
|
|
+ return "top5line" if field.split("(")[0] in line_plot_fields else "top5"
|
|
|
|
+
|
|
|
|
+
|
|
def is_aggregate(field: str) -> bool:
|
|
def is_aggregate(field: str) -> bool:
|
|
field_match = re.match(AGGREGATE_PATTERN, field)
|
|
field_match = re.match(AGGREGATE_PATTERN, field)
|
|
if field_match:
|
|
if field_match:
|
|
@@ -141,6 +167,10 @@ def unfurl_discover(
|
|
)
|
|
)
|
|
else:
|
|
else:
|
|
params.setlist("topEvents", [f"{TOP_N}"])
|
|
params.setlist("topEvents", [f"{TOP_N}"])
|
|
|
|
+
|
|
|
|
+ y_axis = params.getlist("yAxis")[0]
|
|
|
|
+ display_mode = get_top5_display_mode(y_axis)
|
|
|
|
+
|
|
else:
|
|
else:
|
|
# topEvents param persists in the URL in some cases, we want to discard
|
|
# topEvents param persists in the URL in some cases, we want to discard
|
|
# it if it's not a top n display type.
|
|
# it if it's not a top n display type.
|