Skip to content
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
25 changes: 24 additions & 1 deletion static/app/views/performance/cache/samplePanel/samplePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ import {MetricReadout} from 'sentry/views/performance/metricReadout';
import * as ModuleLayout from 'sentry/views/performance/moduleLayout';
import DetailPanel from 'sentry/views/starfish/components/detailPanel';
import {getTimeSpentExplanation} from 'sentry/views/starfish/components/tableCells/timeSpentCell';
import {useSpanMetrics} from 'sentry/views/starfish/queries/useDiscover';
import {useMetrics, useSpanMetrics} from 'sentry/views/starfish/queries/useDiscover';
import {useIndexedSpans} from 'sentry/views/starfish/queries/useIndexedSpans';
import {useTransactions} from 'sentry/views/starfish/queries/useTransactions';
import {
MetricsFields,
type MetricsQueryFilters,
SpanFunction,
SpanIndexedField,
type SpanIndexedQueryFilters,
Expand Down Expand Up @@ -76,6 +78,15 @@ export function CacheSamplePanel() {
referrer: Referrer.SAMPLES_CACHE_METRICS_RIBBON,
});

const {data: transactionDurationData, isLoading: isTransactionDurationLoading} =
useMetrics({
search: MutableSearch.fromQueryObject({
transaction: query.transaction,
} satisfies MetricsQueryFilters),
fields: [`avg(${MetricsFields.TRANSACTION_DURATION})`],
enabled: isPanelOpen && Boolean(query.transaction),
});

const sampleFilters: SpanIndexedQueryFilters = {
...BASE_FILTERS,
transaction: query.transaction,
Expand Down Expand Up @@ -192,6 +203,18 @@ export function CacheSamplePanel() {
isLoading={areCacheTransactionMetricsFetching}
/>

<MetricReadout
align="left"
title={DataTitles[`avg(${MetricsFields.TRANSACTION_DURATION})`]}
value={
transactionDurationData?.[0]?.[
`avg(${MetricsFields.TRANSACTION_DURATION})`
]
}
unit={DurationUnit.MILLISECOND}
isLoading={isTransactionDurationLoading}
/>

<MetricReadout
align="left"
title={DataTitles.cacheMissRate}
Expand Down
2 changes: 2 additions & 0 deletions static/app/views/starfish/views/spans/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type DataKey =
| 'count'
| 'avg(http.response_content_length)'
| 'avg(http.decoded_response_content_length)'
| 'avg(transaction.duration)'
| 'avg(http.response_transfer_size)'
| 'bundleSize'
| 'unsuccessfulHTTPCodes'
Expand All @@ -44,6 +45,7 @@ export const DataTitles: Record<DataKey, string> = {
'avg(http.response_content_length)': t('Avg Encoded Size'),
'avg(http.decoded_response_content_length)': t('Avg Decoded Size'),
'avg(http.response_transfer_size)': t('Avg Transfer Size'),
'avg(transaction.duration)': t('Avg Txn Duration'),
'avg(cache.item_size)': t('Avg Value Size'),
unsuccessfulHTTPCodes: t('Response Codes (3XX, 4XX, 5XX)'),
httpCodeBreakdown: t('Response Code Breakdown'),
Expand Down