Skip to content

Commit e563e8f

Browse files
authored
feat(ourlogs): Add new widget type for logs (#92157)
### Summary This adds a dashboard widget type for logs, needed before UX work. Refs LOGS-50
1 parent 957c5fe commit e563e8f

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/sentry/models/dashboard_widget.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ class DashboardWidgetTypes(TypesClass):
6363
This targets transaction-like data from the split from discover. Itt may either use 'Transactions' events or 'PerformanceMetrics' depending on on-demand, MEP metrics, etc.
6464
"""
6565
SPANS = 102
66+
"""
67+
These represent the logs trace item type on the EAP dataset.
68+
"""
69+
LOGS = 103
6670

6771
TYPES = [
6872
(DISCOVER, "discover"),
@@ -74,6 +78,7 @@ class DashboardWidgetTypes(TypesClass):
7478
(ERROR_EVENTS, "error-events"),
7579
(TRANSACTION_LIKE, "transaction-like"),
7680
(SPANS, "spans"),
81+
(LOGS, "logs"),
7782
]
7883
TYPE_NAMES = [t[1] for t in TYPES]
7984

tests/sentry/api/endpoints/test_organization_dashboard_widget_details.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,29 @@ def test_widget_type_spans(self):
11061106
)
11071107
assert response.status_code == 200, response.data
11081108

1109+
def test_widget_type_logs(self):
1110+
data = {
1111+
"title": "Test Logs Query",
1112+
"widgetType": "logs",
1113+
"displayType": "table",
1114+
"queries": [
1115+
{
1116+
"name": "",
1117+
"conditions": "",
1118+
"fields": ["log.message", "count()"],
1119+
"columns": ["log.message"],
1120+
"aggregates": ["count()"],
1121+
},
1122+
],
1123+
}
1124+
1125+
response = self.do_request(
1126+
"post",
1127+
self.url(),
1128+
data=data,
1129+
)
1130+
assert response.status_code == 200, response.data
1131+
11091132
def test_has_group_by_and_no_limit_on_creation(self):
11101133
data = {
11111134
"title": "Test Query",

0 commit comments

Comments
 (0)