-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat(insights): Add prebuilt dashboard rendering for queues landing page #109610
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
DominikB2014
merged 6 commits into
master
from
dominikbuszowiecki/browse-371-implement-basic-queues-module-as-dashboard
Mar 2, 2026
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f16818d
implement queue and queue summary
DominikB2014 281935d
ref(insights): Extract shared queue chart configs to queueCharts.ts
DominikB2014 9edba50
ref(insights): Update queue summary prebuilt config and switch to que…
DominikB2014 f98a341
ref(insights): Update shared queue chart configs
DominikB2014 bce5ad8
fix(insights): Use avg_if for processing time in queues destination t…
DominikB2014 586b86b
Merge branch 'master' into dominikbuszowiecki/browse-371-implement-ba…
DominikB2014 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
183 changes: 182 additions & 1 deletion
183
static/app/views/dashboards/utils/prebuiltConfigs/queues/queueSummary.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,191 @@ | ||
| import {t} from 'sentry/locale'; | ||
| import {DisplayType, WidgetType, type Widget} from 'sentry/views/dashboards/types'; | ||
| import type {PrebuiltDashboard} from 'sentry/views/dashboards/utils/prebuiltConfigs'; | ||
| import {QUEUE_CHARTS} from 'sentry/views/dashboards/utils/prebuiltConfigs/queues/queues'; | ||
| import {SUMMARY_DASHBOARD_TITLE} from 'sentry/views/dashboards/utils/prebuiltConfigs/queues/settings'; | ||
| import {spaceWidgetsEquallyOnRow} from 'sentry/views/dashboards/utils/prebuiltConfigs/utils/spaceWidgetsEquallyOnRow'; | ||
| import {SpanFields} from 'sentry/views/insights/types'; | ||
|
|
||
| const SPAN_OP_FILTER = `${SpanFields.SPAN_OP}:[queue.publish, queue.process]`; | ||
|
|
||
| const FIRST_ROW_WIDGTS = spaceWidgetsEquallyOnRow( | ||
| [ | ||
| { | ||
| id: 'avg-time-in-queue-widget', | ||
| title: t('Avg Time in Queue'), | ||
| displayType: DisplayType.BIG_NUMBER, | ||
| widgetType: WidgetType.SPANS, | ||
| interval: '5m', | ||
| queries: [ | ||
| { | ||
| name: '', | ||
| fields: [`avg(${SpanFields.MESSAGING_MESSAGE_RECEIVE_LATENCY})`], | ||
| aggregates: [`avg(${SpanFields.MESSAGING_MESSAGE_RECEIVE_LATENCY})`], | ||
| columns: [], | ||
| conditions: SPAN_OP_FILTER, | ||
| orderby: `avg(${SpanFields.MESSAGING_MESSAGE_RECEIVE_LATENCY})`, | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| id: 'avg-processing-time-widget', | ||
| title: t('Avg Processing Time'), | ||
| displayType: DisplayType.BIG_NUMBER, | ||
| widgetType: WidgetType.SPANS, | ||
| interval: '5m', | ||
| queries: [ | ||
| { | ||
| name: '', | ||
| fields: [`avg(${SpanFields.SPAN_DURATION})`], | ||
| aggregates: [`avg(${SpanFields.SPAN_DURATION})`], | ||
| columns: [], | ||
| conditions: SPAN_OP_FILTER, | ||
| orderby: `avg(${SpanFields.SPAN_DURATION})`, | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| id: 'error-rate-widget', | ||
| title: t('Error Rate'), | ||
| displayType: DisplayType.BIG_NUMBER, | ||
| widgetType: WidgetType.SPANS, | ||
| interval: '5m', | ||
| queries: [ | ||
| { | ||
| name: '', | ||
| fields: [ | ||
| `equation|1 - (count_if(${SpanFields.TRACE_STATUS},equals,ok) / count(${SpanFields.SPAN_DURATION}))`, | ||
| ], | ||
| aggregates: [ | ||
| `equation|1 - (count_if(${SpanFields.TRACE_STATUS},equals,ok) / count(${SpanFields.SPAN_DURATION}))`, | ||
| ], | ||
| columns: [], | ||
| conditions: SPAN_OP_FILTER, | ||
| orderby: `equation|1 - (count_if(${SpanFields.TRACE_STATUS},equals,ok) / count(${SpanFields.SPAN_DURATION}))`, | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| id: 'published-widget', | ||
| title: t('Published'), | ||
| displayType: DisplayType.BIG_NUMBER, | ||
| widgetType: WidgetType.SPANS, | ||
| interval: '5m', | ||
| queries: [ | ||
| { | ||
| name: '', | ||
| fields: [`count_if(${SpanFields.SPAN_OP},equals,queue.publish)`], | ||
| aggregates: [`count_if(${SpanFields.SPAN_OP},equals,queue.publish)`], | ||
| columns: [], | ||
| conditions: SPAN_OP_FILTER, | ||
| orderby: `count_if(${SpanFields.SPAN_OP},equals,queue.publish)`, | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| id: 'processed-widget', | ||
| title: t('Processed'), | ||
| displayType: DisplayType.BIG_NUMBER, | ||
| widgetType: WidgetType.SPANS, | ||
| interval: '5m', | ||
| queries: [ | ||
| { | ||
| name: '', | ||
| fields: [`count_if(${SpanFields.SPAN_OP},equals,queue.process)`], | ||
| aggregates: [`count_if(${SpanFields.SPAN_OP},equals,queue.process)`], | ||
| columns: [], | ||
| conditions: SPAN_OP_FILTER, | ||
| orderby: `count_if(${SpanFields.SPAN_OP},equals,queue.process)`, | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| id: 'time-spent-widget', | ||
| title: t('Time Spent'), | ||
| displayType: DisplayType.BIG_NUMBER, | ||
| widgetType: WidgetType.SPANS, | ||
| interval: '5m', | ||
| queries: [ | ||
| { | ||
| name: '', | ||
| fields: [`sum(${SpanFields.SPAN_DURATION})`], | ||
| aggregates: [`sum(${SpanFields.SPAN_DURATION})`], | ||
| columns: [], | ||
| conditions: SPAN_OP_FILTER, | ||
| orderby: `sum(${SpanFields.SPAN_DURATION})`, | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| 0, | ||
| {h: 1, minH: 1} | ||
| ); | ||
|
|
||
| const TRANSACTIONS_TABLE: Widget = { | ||
| id: 'transactions-table', | ||
| title: t('Transactions Interacting with Destination'), | ||
| displayType: DisplayType.TABLE, | ||
| widgetType: WidgetType.SPANS, | ||
| interval: '5m', | ||
| queries: [ | ||
| { | ||
| name: '', | ||
| fields: [ | ||
| SpanFields.TRANSACTION, | ||
| `avg(${SpanFields.MESSAGING_MESSAGE_RECEIVE_LATENCY})`, | ||
| `avg_if(${SpanFields.SPAN_DURATION},${SpanFields.SPAN_OP},equals,queue.process)`, | ||
| `avg_if(${SpanFields.SPAN_DURATION},${SpanFields.SPAN_OP},equals,queue.publish)`, | ||
| `equation|1 - (count_if(${SpanFields.TRACE_STATUS},equals,ok) / count(${SpanFields.SPAN_DURATION}))`, | ||
| `count_if(${SpanFields.SPAN_OP},equals,queue.publish)`, | ||
| `count_if(${SpanFields.SPAN_OP},equals,queue.process)`, | ||
| `sum(${SpanFields.SPAN_DURATION})`, | ||
| ], | ||
| aggregates: [ | ||
| `avg(${SpanFields.MESSAGING_MESSAGE_RECEIVE_LATENCY})`, | ||
| `avg_if(${SpanFields.SPAN_DURATION},${SpanFields.SPAN_OP},equals,queue.process)`, | ||
| `avg_if(${SpanFields.SPAN_DURATION},${SpanFields.SPAN_OP},equals,queue.publish)`, | ||
| `equation|1 - (count_if(${SpanFields.TRACE_STATUS},equals,ok) / count(${SpanFields.SPAN_DURATION}))`, | ||
| `count_if(${SpanFields.SPAN_OP},equals,queue.publish)`, | ||
| `count_if(${SpanFields.SPAN_OP},equals,queue.process)`, | ||
| `sum(${SpanFields.SPAN_DURATION})`, | ||
| ], | ||
| columns: [SpanFields.MESSAGING_MESSAGE_DESTINATION_NAME, SpanFields.TRANSACTION], | ||
| fieldAliases: [ | ||
| t('Transaction'), | ||
| t('Avg time in queue'), | ||
| t('Avg processing time'), | ||
| t('Error rate'), | ||
| t('Published'), | ||
| t('Processed'), | ||
| t('Time spent'), | ||
| ], | ||
DominikB2014 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| fieldMeta: [ | ||
| null, | ||
| null, | ||
| null, | ||
| null, | ||
| {valueType: 'percentage', valueUnit: null}, | ||
| null, | ||
| null, | ||
| null, | ||
| ], | ||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| conditions: SPAN_OP_FILTER, | ||
| orderby: `-sum(${SpanFields.SPAN_DURATION})`, | ||
| }, | ||
| ], | ||
| layout: { | ||
| x: 0, | ||
| y: 4, | ||
| w: 6, | ||
| h: 6, | ||
DominikB2014 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| minH: 6, | ||
| }, | ||
| }; | ||
|
|
||
| export const QUEUE_SUMMARY_PREBUILT_CONFIG: PrebuiltDashboard = { | ||
| dateCreated: '', | ||
| projects: [], | ||
| title: SUMMARY_DASHBOARD_TITLE, | ||
| filters: {}, | ||
| widgets: [], | ||
| widgets: [...FIRST_ROW_WIDGTS, ...QUEUE_CHARTS, TRANSACTIONS_TABLE], | ||
DominikB2014 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }; | ||
128 changes: 126 additions & 2 deletions
128
static/app/views/dashboards/utils/prebuiltConfigs/queues/queues.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,134 @@ | ||
| import {t} from 'sentry/locale'; | ||
| import {FieldKind} from 'sentry/utils/fields'; | ||
| import {DisplayType, WidgetType, type Widget} from 'sentry/views/dashboards/types'; | ||
| import type {PrebuiltDashboard} from 'sentry/views/dashboards/utils/prebuiltConfigs'; | ||
| import {DASHBOARD_TITLE} from 'sentry/views/dashboards/utils/prebuiltConfigs/queues/settings'; | ||
| import {spaceWidgetsEquallyOnRow} from 'sentry/views/dashboards/utils/prebuiltConfigs/utils/spaceWidgetsEquallyOnRow'; | ||
| import {SpanFields} from 'sentry/views/insights/types'; | ||
|
|
||
| export const QUEUE_CHARTS = spaceWidgetsEquallyOnRow( | ||
| [ | ||
| { | ||
| id: 'average-duration-widget', | ||
| title: t('Average Duration'), | ||
| displayType: DisplayType.AREA, | ||
| widgetType: WidgetType.SPANS, | ||
| interval: '5m', | ||
| queries: [ | ||
| { | ||
| name: '', | ||
| aggregates: [ | ||
| `avg(${SpanFields.MESSAGING_MESSAGE_RECEIVE_LATENCY})`, | ||
| `avg(${SpanFields.SPAN_DURATION})`, | ||
| ], | ||
| columns: [], | ||
| conditions: `${SpanFields.SPAN_OP}:queue.process`, | ||
| orderby: `avg(${SpanFields.SPAN_DURATION})`, | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| id: 'throughput-widget', | ||
| title: t('Published vs Processed'), | ||
| displayType: DisplayType.LINE, | ||
| widgetType: WidgetType.SPANS, | ||
| interval: '5m', | ||
| queries: [ | ||
| { | ||
| name: '', | ||
| aggregates: ['epm()'], | ||
| columns: [SpanFields.SPAN_OP], | ||
| conditions: `${SpanFields.SPAN_OP}:[queue.publish, queue.process]`, | ||
| orderby: 'epm()', | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| 0 | ||
| ); | ||
|
|
||
| const DETINATION_TABLE: Widget = { | ||
| id: 'destination-table', | ||
| title: t('Destinations'), | ||
| displayType: DisplayType.TABLE, | ||
| widgetType: WidgetType.SPANS, | ||
| interval: '5m', | ||
| queries: [ | ||
| { | ||
| name: '', | ||
| fields: [ | ||
| SpanFields.MESSAGING_MESSAGE_DESTINATION_NAME, | ||
| `avg(${SpanFields.MESSAGING_MESSAGE_RECEIVE_LATENCY})`, | ||
| `avg(${SpanFields.SPAN_DURATION})`, | ||
DominikB2014 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| `equation|1 - (count_if(${SpanFields.TRACE_STATUS},equals,ok) / count(${SpanFields.SPAN_DURATION}))`, | ||
| `count_if(${SpanFields.SPAN_OP},equals,queue.publish)`, | ||
| `count_if(${SpanFields.SPAN_OP},equals,queue.process)`, | ||
| `sum(${SpanFields.SPAN_DURATION})`, | ||
| ], | ||
| columns: [SpanFields.MESSAGING_MESSAGE_DESTINATION_NAME], | ||
| aggregates: [ | ||
| 'epm()', | ||
| `avg(${SpanFields.MESSAGING_MESSAGE_RECEIVE_LATENCY})`, | ||
| `avg(${SpanFields.SPAN_DURATION})`, | ||
| `equation|1 - (count_if(${SpanFields.TRACE_STATUS},equals,ok) / count(${SpanFields.SPAN_DURATION}))`, | ||
| `count_if(${SpanFields.SPAN_OP},equals,queue.publish)`, | ||
| `count_if(${SpanFields.SPAN_OP},equals,queue.process)`, | ||
| `sum(${SpanFields.SPAN_DURATION})`, | ||
| ], | ||
DominikB2014 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| fieldAliases: [ | ||
| t('Destination'), | ||
| t('Avg time in queue'), | ||
| t('Avg processing time'), | ||
| t('Error rate'), | ||
| t('Published'), | ||
| t('Processed'), | ||
| t('Time spent'), | ||
| ], | ||
| fieldMeta: [ | ||
| null, | ||
| null, | ||
| null, | ||
| {valueType: 'percentage', valueUnit: null}, | ||
| null, | ||
| null, | ||
| null, | ||
| ], | ||
| linkedDashboards: [ | ||
| { | ||
| dashboardId: '-1', | ||
| field: SpanFields.MESSAGING_MESSAGE_DESTINATION_NAME, | ||
| staticDashboardId: 27, | ||
| }, | ||
| ], | ||
| conditions: `${SpanFields.SPAN_OP}:[queue.publish, queue.process]`, | ||
| orderby: `-sum(${SpanFields.SPAN_DURATION})`, | ||
| }, | ||
| ], | ||
| layout: { | ||
| x: 0, | ||
| y: 3, | ||
| w: 6, | ||
| h: 6, | ||
| minH: 6, | ||
| }, | ||
| }; | ||
|
|
||
| export const QUEUES_PREBUILT_CONFIG: PrebuiltDashboard = { | ||
| dateCreated: '', | ||
| projects: [], | ||
| title: DASHBOARD_TITLE, | ||
| filters: {}, | ||
| widgets: [], | ||
| filters: { | ||
| globalFilter: [ | ||
| { | ||
| dataset: WidgetType.SPANS, | ||
| tag: { | ||
| key: SpanFields.MESSAGING_MESSAGE_DESTINATION_NAME, | ||
| name: SpanFields.MESSAGING_MESSAGE_DESTINATION_NAME, | ||
| kind: FieldKind.TAG, | ||
| }, | ||
| value: '', | ||
| }, | ||
| ], | ||
| }, | ||
| widgets: [...QUEUE_CHARTS, DETINATION_TABLE], | ||
| }; | ||
7 changes: 7 additions & 0 deletions
7
static/app/views/insights/queues/utils/useHasPlatformizedQueues.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import useOrganization from 'sentry/utils/useOrganization'; | ||
|
|
||
| export function useHasPlatformizedQueues() { | ||
| const organization = useOrganization(); | ||
|
|
||
| return organization.features.includes('insights-queue-dashboard-migration'); | ||
| } |
20 changes: 20 additions & 0 deletions
20
static/app/views/insights/queues/views/platformizedOverview.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import {DataCategory} from 'sentry/types/core'; | ||
| import {useMaxPickableDays} from 'sentry/utils/useMaxPickableDays'; | ||
| import {PrebuiltDashboardRenderer} from 'sentry/views/dashboards/prebuiltDashboardRenderer'; | ||
| import {PrebuiltDashboardId} from 'sentry/views/dashboards/utils/prebuiltConfigs'; | ||
| import {ModulePageProviders} from 'sentry/views/insights/common/components/modulePageProviders'; | ||
|
|
||
| export function PlatformizedQueuesOverview() { | ||
| const maxPickableDays = useMaxPickableDays({ | ||
| dataCategories: [DataCategory.SPANS], | ||
| }); | ||
|
|
||
| return ( | ||
| <ModulePageProviders | ||
| moduleName="queue" | ||
| maxPickableDays={maxPickableDays.maxPickableDays} | ||
| > | ||
| <PrebuiltDashboardRenderer prebuiltId={PrebuiltDashboardId.BACKEND_QUEUES} /> | ||
| </ModulePageProviders> | ||
DominikB2014 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.