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
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const {
HTTP_RESPONSE_CONTENT_LENGTH,
PROJECT_ID,
FILE_EXTENSION,
USER_GEO_SUBREGION,
} = SpanMetricsField;

const {TIME_SPENT_PERCENTAGE} = SpanFunction;
Expand All @@ -49,6 +50,9 @@ export const getResourcesEventViewQuery = (
...(resourceFilters.transaction
? [`transaction:"${resourceFilters.transaction}"`]
: []),
...(resourceFilters[USER_GEO_SUBREGION]
? [`user.geo.subregion:[${resourceFilters[USER_GEO_SUBREGION]}]`]
: []),
...getDomainFilter(resourceFilters[SPAN_DOMAIN]),
...(resourceFilters[RESOURCE_RENDER_BLOCKING_STATUS]
? [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ function ResourceSummaryCharts(props: {groupId: string}) {
filters[RESOURCE_RENDER_BLOCKING_STATUS],
}
: {}),
...(filters[SpanMetricsField.USER_GEO_SUBREGION]
? {
[SpanMetricsField.USER_GEO_SUBREGION]: `[${filters[SpanMetricsField.USER_GEO_SUBREGION].join(',')}]`,
}
: {}),
}),
yAxis: [
`spm()`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const {
SPAN_DOMAIN,
TRANSACTION,
RESOURCE_RENDER_BLOCKING_STATUS,
USER_GEO_SUBREGION,
} = BrowserStarfishFields;

type Option = {
Expand All @@ -52,7 +53,12 @@ function ResourceView() {
...(filters[SPAN_DOMAIN] ? {[SPAN_DOMAIN]: filters[SPAN_DOMAIN]} : {}),
};

const extraQuery = getResourceTypeFilter(undefined, DEFAULT_RESOURCE_TYPES);
const extraQuery = [
...getResourceTypeFilter(undefined, DEFAULT_RESOURCE_TYPES),
...(filters[USER_GEO_SUBREGION]
? [`user.geo.subregion:[${filters[USER_GEO_SUBREGION].join(',')}]`]
: []),
];

return (
<Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const {
SPAN_SELF_TIME,
HTTP_RESPONSE_CONTENT_LENGTH,
TRANSACTION,
USER_GEO_SUBREGION,
} = SpanMetricsField;

type Row = {
Expand All @@ -55,6 +56,7 @@ function ResourceSummaryTable() {
const {data, isLoading, pageLinks} = useResourcePagesQuery(groupId, {
sort,
cursor,
subregions: filters[USER_GEO_SUBREGION],
renderBlockingStatus: filters[RESOURCE_RENDER_BLOCKING_STATUS],
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
RESOURCE_THROUGHPUT_UNIT,
} from 'sentry/views/insights/browser/resources/settings';
import {ResourceSpanOps} from 'sentry/views/insights/browser/resources/types';
import {useResourceModuleFilters} from 'sentry/views/insights/browser/resources/utils/useResourceFilters';
import type {ValidSort} from 'sentry/views/insights/browser/resources/utils/useResourceSort';
import {DurationCell} from 'sentry/views/insights/common/components/tableCells/durationCell';
import {renderHeadCell} from 'sentry/views/insights/common/components/tableCells/renderHeadCell';
Expand Down Expand Up @@ -79,6 +80,7 @@ function ResourceTable({sort, defaultResourceTypes}: Props) {
const location = useLocation();
const organization = useOrganization();
const cursor = decodeScalar(location.query?.[QueryParameterNames.SPANS_CURSOR]);
const filters = useResourceModuleFilters();
const {setPageInfo, pageAlert} = usePageAlert();

const {data, isLoading, pageLinks} = useResourcesQuery({
Expand Down Expand Up @@ -130,7 +132,11 @@ function ResourceTable({sort, defaultResourceTypes}: Props) {

if (key === SPAN_DESCRIPTION) {
const fileExtension = row[SPAN_DESCRIPTION].split('.').pop() || '';

const extraLinkQueryParams = {};
if (filters[SpanMetricsField.USER_GEO_SUBREGION]) {
extraLinkQueryParams[SpanMetricsField.USER_GEO_SUBREGION] =
filters[SpanMetricsField.USER_GEO_SUBREGION];
}
return (
<DescriptionWrapper>
<ResourceIcon fileExtension={fileExtension} spanOp={row[SPAN_OP]} />
Expand All @@ -140,6 +146,7 @@ function ResourceTable({sort, defaultResourceTypes}: Props) {
spanOp={row[SPAN_OP]}
description={row[SPAN_DESCRIPTION]}
group={row[SPAN_GROUP]}
extraLinkQueryParams={extraLinkQueryParams}
/>
</DescriptionWrapper>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {Sort} from 'sentry/utils/discover/fields';
import {useSpanTransactionMetrics} from 'sentry/views/insights/common/queries/useSpanTransactionMetrics';
import {SpanMetricsField} from 'sentry/views/insights/types';
import {SpanMetricsField, type SubregionCode} from 'sentry/views/insights/types';

const {HTTP_RESPONSE_CONTENT_LENGTH, RESOURCE_RENDER_BLOCKING_STATUS} = SpanMetricsField;

Expand All @@ -9,15 +9,24 @@ export const useResourcePagesQuery = (
{
sort,
cursor,
subregions,
renderBlockingStatus,
}: {sort: Sort; cursor?: string; renderBlockingStatus?: string}
}: {
sort: Sort;
cursor?: string;
renderBlockingStatus?: string;
subregions?: SubregionCode[];
}
) => {
return useSpanTransactionMetrics(
{
'span.group': groupId,
...(renderBlockingStatus
? {[RESOURCE_RENDER_BLOCKING_STATUS]: renderBlockingStatus}
: {}),
...(subregions
? {[SpanMetricsField.USER_GEO_SUBREGION]: `[${subregions.join(',')}]`}
: {}),
},
[sort],
cursor,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import pick from 'lodash/pick';

import {decodeList} from 'sentry/utils/queryString';
import {useLocation} from 'sentry/utils/useLocation';
import type {ResourceSpanOps} from 'sentry/views/insights/browser/resources/types';
import type {SubregionCode} from 'sentry/views/insights/types';

// TODO - we should probably just use SpanMetricsField here
export enum BrowserStarfishFields {
SPAN_OP = 'span.op',
TRANSACTION = 'transaction',
SPAN_DOMAIN = 'span.domain',
GROUP_ID = 'groupId',
DESCRIPTION = 'description',
RESOURCE_RENDER_BLOCKING_STATUS = 'resource.render_blocking_status',
USER_GEO_SUBREGION = 'user.geo.subregion',
}

export type ModuleFilters = {
Expand All @@ -22,17 +26,27 @@ export type ModuleFilters = {
[BrowserStarfishFields.SPAN_OP]?: ResourceSpanOps;
[BrowserStarfishFields.TRANSACTION]?: string;
[BrowserStarfishFields.SPAN_DOMAIN]?: string;
[BrowserStarfishFields.USER_GEO_SUBREGION]?: SubregionCode[];
};

export const useResourceModuleFilters = () => {
const location = useLocation<ModuleFilters>();

return pick(location.query, [
const filters = pick(location.query, [
BrowserStarfishFields.SPAN_DOMAIN,
BrowserStarfishFields.SPAN_OP,
BrowserStarfishFields.TRANSACTION,
BrowserStarfishFields.GROUP_ID,
BrowserStarfishFields.DESCRIPTION,
BrowserStarfishFields.RESOURCE_RENDER_BLOCKING_STATUS,
]);

const subregions = decodeList(
location.query[BrowserStarfishFields.USER_GEO_SUBREGION]
) as SubregionCode[];
if (subregions.length) {
filters[BrowserStarfishFields.USER_GEO_SUBREGION] = subregions;
}

return filters;
};
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {ToolRibbon} from 'sentry/views/insights/common/components/ribbon';
import {useSpanMetrics} from 'sentry/views/insights/common/queries/useDiscover';
import {useModuleBreadcrumbs} from 'sentry/views/insights/common/utils/useModuleBreadcrumbs';
import {useModuleURL} from 'sentry/views/insights/common/utils/useModuleURL';
import SubregionSelector from 'sentry/views/insights/common/views/spans/selectors/subregionSelector';
import {SampleList} from 'sentry/views/insights/common/views/spanSummaryPage/sampleList';
import {ModuleName, SpanMetricsField} from 'sentry/views/insights/types';
import {TraceViewSources} from 'sentry/views/performance/newTraceDetails/traceMetadataHeader';
Expand All @@ -55,6 +56,11 @@ function ResourceSummary() {
{
search: MutableSearch.fromQueryObject({
'span.group': groupId,
...(filters[SpanMetricsField.USER_GEO_SUBREGION]
? {
[SpanMetricsField.USER_GEO_SUBREGION]: `[${filters[SpanMetricsField.USER_GEO_SUBREGION].join(',')}]`,
}
: {}),
}),
fields: [
`avg(${SPAN_SELF_TIME})`,
Expand Down Expand Up @@ -123,6 +129,7 @@ function ResourceSummary() {
<RenderBlockingSelector
value={filters[RESOURCE_RENDER_BLOCKING_STATUS] || ''}
/>
<SubregionSelector />
</ToolRibbon>
<ResourceInfo
isLoading={isLoading}
Expand Down Expand Up @@ -154,6 +161,7 @@ function ResourceSummary() {
<ModuleLayout.Full>
<SampleList
transactionRoute={webVitalsModuleURL}
subregions={filters[SpanMetricsField.USER_GEO_SUBREGION]}
groupId={groupId}
moduleName={ModuleName.RESOURCE}
transactionName={transaction as string}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {Fragment} from 'react';
import styled from '@emotion/styled';

import {Breadcrumbs} from 'sentry/components/breadcrumbs';
Expand Down Expand Up @@ -27,6 +27,7 @@ import {ModulesOnboarding} from 'sentry/views/insights/common/components/modules
import {ToolRibbon} from 'sentry/views/insights/common/components/ribbon';
import {useModuleBreadcrumbs} from 'sentry/views/insights/common/utils/useModuleBreadcrumbs';
import {DomainSelector} from 'sentry/views/insights/common/views/spans/selectors/domainSelector';
import SubregionSelector from 'sentry/views/insights/common/views/spans/selectors/subregionSelector';
import {ModuleName} from 'sentry/views/insights/types';

const {SPAN_OP, SPAN_DOMAIN} = BrowserStarfishFields;
Expand Down Expand Up @@ -64,15 +65,18 @@ function ResourcesLandingPage() {
<ModulePageFilterBar
moduleName={ModuleName.RESOURCE}
extraFilters={
<DomainSelector
moduleName={ModuleName.RESOURCE}
emptyOptionLocation="top"
value={filters[SPAN_DOMAIN] || ''}
additionalQuery={[
...DEFAULT_RESOURCE_FILTERS,
`${SPAN_OP}:[${DEFAULT_RESOURCE_TYPES.join(',')}]`,
]}
/>
<Fragment>
<DomainSelector
moduleName={ModuleName.RESOURCE}
emptyOptionLocation="top"
value={filters[SPAN_DOMAIN] || ''}
additionalQuery={[
...DEFAULT_RESOURCE_FILTERS,
`${SPAN_OP}:[${DEFAULT_RESOURCE_TYPES.join(',')}]`,
]}
/>
<SubregionSelector />
</Fragment>
}
/>
</ToolRibbon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ import {applyStaticWeightsToTimeseries} from 'sentry/views/insights/browser/webV
import type {BrowserType} from 'sentry/views/insights/browser/webVitals/utils/queryParameterDecoders/browserType';
import {PERFORMANCE_SCORE_WEIGHTS} from 'sentry/views/insights/browser/webVitals/utils/scoreThresholds';
import Chart, {ChartType} from 'sentry/views/insights/common/components/chart';
import type {SubregionCode} from 'sentry/views/insights/types';

type Props = {
browserTypes?: BrowserType[];
subregions?: SubregionCode[];
transaction?: string;
};

Expand All @@ -43,14 +45,18 @@ export const formatTimeSeriesResultsToChartData = (
});
};

export function PerformanceScoreBreakdownChart({transaction, browserTypes}: Props) {
export function PerformanceScoreBreakdownChart({
transaction,
browserTypes,
subregions,
}: Props) {
const theme = useTheme();
const segmentColors = [...theme.charts.getColorPalette(3).slice(0, 5)];

const pageFilters = usePageFilters();

const {data: timeseriesData, isLoading: isTimeseriesLoading} =
useProjectWebVitalsScoresTimeseriesQuery({transaction, browserTypes});
useProjectWebVitalsScoresTimeseriesQuery({transaction, browserTypes, subregions});

const period = pageFilters.selection.datetime.period;
const performanceScoreSubtext = (period && DEFAULT_RELATIVE_PERIODS[period]) ?? '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ import type {
WebVitals,
} from 'sentry/views/insights/browser/webVitals/types';
import type {BrowserType} from 'sentry/views/insights/browser/webVitals/utils/queryParameterDecoders/browserType';
import type {SubregionCode} from 'sentry/views/insights/types';

type Props = {
browserTypes?: BrowserType[];
isProjectScoreLoading?: boolean;
projectScore?: ProjectScore;
subregions?: SubregionCode[];
transaction?: string;
webVital?: WebVitals | null;
};
Expand All @@ -34,6 +36,7 @@ export function PerformanceScoreChart({
transaction,
isProjectScoreLoading,
browserTypes,
subregions,
}: Props) {
const theme = useTheme();
const pageFilters = usePageFilters();
Expand Down Expand Up @@ -100,6 +103,7 @@ export function PerformanceScoreChart({
<PerformanceScoreBreakdownChart
transaction={transaction}
browserTypes={browserTypes}
subregions={subregions}
/>
</Flex>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {useProjectRawWebVitalsValuesTimeseriesQuery} from 'sentry/views/insights
import {MODULE_DOC_LINK} from 'sentry/views/insights/browser/webVitals/settings';
import type {ProjectScore} from 'sentry/views/insights/browser/webVitals/types';
import type {BrowserType} from 'sentry/views/insights/browser/webVitals/utils/queryParameterDecoders/browserType';
import type {SubregionCode} from 'sentry/views/insights/types';
import {SidebarSpacer} from 'sentry/views/performance/transactionSummary/utils';

const CHART_HEIGHTS = 100;
Expand All @@ -32,13 +33,15 @@ type Props = {
projectScore?: ProjectScore;
projectScoreIsLoading?: boolean;
search?: string;
subregions?: SubregionCode[];
};

export function PageOverviewSidebar({
projectScore,
transaction,
projectScoreIsLoading,
browserTypes,
subregions,
}: Props) {
const theme = useTheme();
const router = useRouter();
Expand All @@ -62,6 +65,7 @@ export function PageOverviewSidebar({
transaction,
datetime: doubledDatetime,
browserTypes,
subregions,
});

const {countDiff, currentSeries, currentCount, initialCount} = processSeriesData(
Expand Down
Loading