-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
ref(insights): Refactor cache-
+ queues-
page widgets
#89344
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
Changes from all commits
fa47fc2
9f75f50
1688135
d6d428b
d5a1d66
c0e2893
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import {MutableSearch} from 'sentry/utils/tokenizeSearch'; | ||
import {Referrer} from 'sentry/views/insights/cache/referrers'; | ||
import {BASE_FILTERS} from 'sentry/views/insights/cache/settings'; | ||
import {InsightsLineChartWidget} from 'sentry/views/insights/common/components/insightsLineChartWidget'; | ||
import type {LoadableChartWidgetProps} from 'sentry/views/insights/common/components/widgets/types'; | ||
import {useSpanMetricsSeries} from 'sentry/views/insights/common/queries/useDiscoverSeries'; | ||
import {DataTitles} from 'sentry/views/insights/common/views/spans/types'; | ||
import {SpanFunction} from 'sentry/views/insights/types'; | ||
|
||
const {CACHE_MISS_RATE} = SpanFunction; | ||
|
||
export default function CacheMissRateChartWidget(props: LoadableChartWidgetProps) { | ||
const {isPending, data, error} = useSpanMetricsSeries( | ||
{ | ||
yAxis: [`${CACHE_MISS_RATE}()`], | ||
search: MutableSearch.fromQueryObject(BASE_FILTERS), | ||
transformAliasToInputFormat: true, | ||
}, | ||
Referrer.LANDING_CACHE_HIT_MISS_CHART, | ||
props.pageFilters | ||
); | ||
|
||
return ( | ||
<InsightsLineChartWidget | ||
{...props} | ||
id="cacheMissRateChartWidget" | ||
title={DataTitles[`cache_miss_rate()`]} | ||
series={[data[`${CACHE_MISS_RATE}()`]]} | ||
isLoading={isPending} | ||
error={error} | ||
/> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import {MutableSearch} from 'sentry/utils/tokenizeSearch'; | ||
import {Referrer} from 'sentry/views/insights/cache/referrers'; | ||
import {BASE_FILTERS} from 'sentry/views/insights/cache/settings'; | ||
import {InsightsLineChartWidget} from 'sentry/views/insights/common/components/insightsLineChartWidget'; | ||
import type {LoadableChartWidgetProps} from 'sentry/views/insights/common/components/widgets/types'; | ||
import {useSpanMetricsSeries} from 'sentry/views/insights/common/queries/useDiscoverSeries'; | ||
import {getThroughputChartTitle} from 'sentry/views/insights/common/views/spans/types'; | ||
|
||
export default function CacheThroughputChartWidget(props: LoadableChartWidgetProps) { | ||
const {isPending, data, error} = useSpanMetricsSeries( | ||
{ | ||
search: MutableSearch.fromQueryObject(BASE_FILTERS), | ||
yAxis: ['epm()'], | ||
transformAliasToInputFormat: true, | ||
}, | ||
Referrer.LANDING_CACHE_THROUGHPUT_CHART, | ||
props.pageFilters | ||
); | ||
|
||
return ( | ||
<InsightsLineChartWidget | ||
{...props} | ||
id="cacheThroughputChartWidget" | ||
title={getThroughputChartTitle('cache.get_item')} | ||
series={[data['epm()']]} | ||
isLoading={isPending} | ||
error={error} | ||
/> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type {LoadableChartWidgetProps} from 'sentry/views/insights/common/components/widgets/types'; | ||
import {LatencyChart} from 'sentry/views/insights/queues/charts/latencyChart'; | ||
import {Referrer} from 'sentry/views/insights/queues/referrers'; | ||
|
||
export default function QueuesLandingLatencyChartWidget(props: LoadableChartWidgetProps) { | ||
return ( | ||
<LatencyChart | ||
{...props} | ||
id="queuesLandingLatencyChartWidget" | ||
referrer={Referrer.QUEUES_LANDING_CHARTS} | ||
/> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type {LoadableChartWidgetProps} from 'sentry/views/insights/common/components/widgets/types'; | ||
import {ThroughputChart} from 'sentry/views/insights/queues/charts/throughputChart'; | ||
import {Referrer} from 'sentry/views/insights/queues/referrers'; | ||
|
||
export default function QueuesLandingThroughputChartWidget( | ||
props: LoadableChartWidgetProps | ||
) { | ||
return ( | ||
<ThroughputChart | ||
{...props} | ||
id="queuesLandingThroughputChartWidget" | ||
referrer={Referrer.QUEUES_LANDING_CHARTS} | ||
/> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import {decodeScalar} from 'sentry/utils/queryString'; | ||
import useLocationQuery from 'sentry/utils/url/useLocationQuery'; | ||
import type {LoadableChartWidgetProps} from 'sentry/views/insights/common/components/widgets/types'; | ||
import {LatencyChart} from 'sentry/views/insights/queues/charts/latencyChart'; | ||
import {Referrer} from 'sentry/views/insights/queues/referrers'; | ||
|
||
export default function QueuesSummaryLatencyChartWidget(props: LoadableChartWidgetProps) { | ||
const {destination} = useLocationQuery({ | ||
fields: { | ||
destination: decodeScalar, | ||
}, | ||
}); | ||
Comment on lines
+8
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does mean that if this chart were rendered via the drawer, it needs to be on the Queues Summary Page (or have We have a similar situation with the resources charts, it uses There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe! I think this is okay for now, though. |
||
|
||
return ( | ||
<LatencyChart | ||
{...props} | ||
id="queuesSummaryLatencyChartWidget" | ||
referrer={Referrer.QUEUES_SUMMARY_CHARTS} | ||
destination={destination} | ||
/> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import {decodeScalar} from 'sentry/utils/queryString'; | ||
import useLocationQuery from 'sentry/utils/url/useLocationQuery'; | ||
import type {LoadableChartWidgetProps} from 'sentry/views/insights/common/components/widgets/types'; | ||
import {ThroughputChart} from 'sentry/views/insights/queues/charts/throughputChart'; | ||
import {Referrer} from 'sentry/views/insights/queues/referrers'; | ||
|
||
export default function QueuesSummaryThroughputChartWidget( | ||
props: LoadableChartWidgetProps | ||
) { | ||
const {destination} = useLocationQuery({ | ||
fields: { | ||
destination: decodeScalar, | ||
}, | ||
}); | ||
|
||
return ( | ||
<ThroughputChart | ||
{...props} | ||
id="queuesSummaryThroughputChartWidget" | ||
referrer={Referrer.QUEUES_SUMMARY_CHARTS} | ||
destination={destination} | ||
/> | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dupe request because of error handling :'(