Skip to content

feat(ourlogs): Add new widget type for logs #92157

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 1 commit into from
May 22, 2025
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions src/sentry/models/dashboard_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ class DashboardWidgetTypes(TypesClass):
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.
"""
SPANS = 102
"""
These represent the logs trace item type on the EAP dataset.
"""
LOGS = 103

TYPES = [
(DISCOVER, "discover"),
Expand All @@ -74,6 +78,7 @@ class DashboardWidgetTypes(TypesClass):
(ERROR_EVENTS, "error-events"),
(TRANSACTION_LIKE, "transaction-like"),
(SPANS, "spans"),
(LOGS, "logs"),
]
TYPE_NAMES = [t[1] for t in TYPES]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,29 @@ def test_widget_type_spans(self):
)
assert response.status_code == 200, response.data

def test_widget_type_logs(self):
data = {
"title": "Test Logs Query",
"widgetType": "logs",
"displayType": "table",
"queries": [
{
"name": "",
"conditions": "",
"fields": ["log.message", "count()"],
"columns": ["log.message"],
"aggregates": ["count()"],
},
],
}

response = self.do_request(
"post",
self.url(),
data=data,
)
assert response.status_code == 200, response.data

def test_has_group_by_and_no_limit_on_creation(self):
data = {
"title": "Test Query",
Expand Down
Loading