Skip to content
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

[7.x] Remove kuery from uiFilters (#91932) #92685

Merged
merged 9 commits into from
Mar 2, 2021
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@ type ErrorGroupDetailsProps = RouteComponentProps<{

export function ErrorGroupDetails({ location, match }: ErrorGroupDetailsProps) {
const { serviceName, groupId } = match.params;
const { urlParams, uiFilters } = useUrlParams();
const { environment, start, end } = urlParams;

const { urlParams } = useUrlParams();
const { environment, kuery, start, end } = urlParams;
const { data: errorGroupData } = useFetcher(
(callApmApi) => {
if (start && end) {
Expand All @@ -82,15 +81,15 @@ export function ErrorGroupDetails({ location, match }: ErrorGroupDetailsProps) {
},
query: {
environment,
kuery,
start,
end,
uiFilters: JSON.stringify(uiFilters),
},
},
});
}
},
[environment, serviceName, start, end, groupId, uiFilters]
[environment, kuery, serviceName, start, end, groupId]
);

const { errorDistributionData } = useErrorGroupDistributionFetcher({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ export function ServiceStatsFetcher({
serviceAnomalyStats,
}: ServiceStatsFetcherProps) {
const {
urlParams: { start, end },
uiFilters,
urlParams: { environment, start, end },
} = useUrlParams();

const {
Expand All @@ -46,12 +45,12 @@ export function ServiceStatsFetcher({
endpoint: 'GET /api/apm/service-map/service/{serviceName}',
params: {
path: { serviceName },
query: { start, end, uiFilters: JSON.stringify(uiFilters) },
query: { environment, start, end },
},
});
}
},
[serviceName, start, end, uiFilters],
[environment, serviceName, start, end],
{
preservePreviousData: false,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ export function ErrorCorrelations({ onClose }: Props) {
] = useState<SelectedSignificantTerm | null>(null);

const { serviceName } = useParams<{ serviceName?: string }>();
const { urlParams, uiFilters } = useUrlParams();
const { urlParams } = useUrlParams();
const {
environment,
kuery,
transactionName,
transactionType,
start,
Expand All @@ -71,12 +72,12 @@ export function ErrorCorrelations({ onClose }: Props) {
params: {
query: {
environment,
kuery,
serviceName,
transactionName,
transactionType,
start,
end,
uiFilters: JSON.stringify(uiFilters),
fieldNames: fieldNames.join(','),
},
},
Expand All @@ -85,12 +86,12 @@ export function ErrorCorrelations({ onClose }: Props) {
},
[
environment,
kuery,
serviceName,
start,
end,
transactionName,
transactionType,
uiFilters,
fieldNames,
]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ export function LatencyCorrelations({ onClose }: Props) {
] = useState<SelectedSignificantTerm | null>(null);

const { serviceName } = useParams<{ serviceName?: string }>();
const { urlParams, uiFilters } = useUrlParams();
const { urlParams } = useUrlParams();
const {
environment,
kuery,
transactionName,
transactionType,
start,
Expand All @@ -76,12 +77,12 @@ export function LatencyCorrelations({ onClose }: Props) {
params: {
query: {
environment,
kuery,
serviceName,
transactionName,
transactionType,
start,
end,
uiFilters: JSON.stringify(uiFilters),
durationPercentile: durationPercentile.toString(10),
fieldNames: fieldNames.join(','),
},
Expand All @@ -91,12 +92,12 @@ export function LatencyCorrelations({ onClose }: Props) {
},
[
environment,
kuery,
serviceName,
start,
end,
transactionName,
transactionType,
uiFilters,
durationPercentile,
fieldNames,
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ interface ErrorGroupOverviewProps {
}

export function ErrorGroupOverview({ serviceName }: ErrorGroupOverviewProps) {
const { urlParams, uiFilters } = useUrlParams();
const { environment, start, end, sortField, sortDirection } = urlParams;
const {
urlParams: { environment, kuery, start, end, sortField, sortDirection },
} = useUrlParams();
const { errorDistributionData } = useErrorGroupDistributionFetcher({
serviceName,
groupId: undefined,
Expand All @@ -47,17 +48,17 @@ export function ErrorGroupOverview({ serviceName }: ErrorGroupOverviewProps) {
},
query: {
environment,
kuery,
start,
end,
sortField,
sortDirection: normalizedSortDirection,
uiFilters: JSON.stringify(uiFilters),
},
},
});
}
},
[environment, serviceName, start, end, sortField, sortDirection, uiFilters]
[environment, kuery, serviceName, start, end, sortField, sortDirection]
);

useTrackPageview({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ const initialData = {
let hasDisplayedToast = false;

function useServicesFetcher() {
const { urlParams, uiFilters } = useUrlParams();
const {
urlParams: { environment, kuery, start, end },
} = useUrlParams();
const { core } = useApmPluginContext();
const upgradeAssistantHref = useUpgradeAssistantHref();
const { environment, start, end } = urlParams;

const { data = initialData, status } = useFetcher(
(callApmApi) => {
if (start && end) {
Expand All @@ -48,15 +50,15 @@ function useServicesFetcher() {
params: {
query: {
environment,
kuery,
start,
end,
uiFilters: JSON.stringify(uiFilters),
},
},
});
}
},
[environment, start, end, uiFilters]
[environment, kuery, start, end]
);

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@ type ServiceNodeMetricsProps = RouteComponentProps<{
}>;

export function ServiceNodeMetrics({ match }: ServiceNodeMetricsProps) {
const { urlParams, uiFilters } = useUrlParams();
const {
urlParams: { kuery, start, end },
} = useUrlParams();
const { serviceName, serviceNodeName } = match.params;
const { agentName } = useApmServiceContext();
const { data } = useServiceMetricChartsFetcher({ serviceNodeName });
const { start, end } = urlParams;

const { data: { host, containerId } = INITIAL_DATA, status } = useFetcher(
(callApmApi) => {
Expand All @@ -72,15 +73,15 @@ export function ServiceNodeMetrics({ match }: ServiceNodeMetricsProps) {
params: {
path: { serviceName, serviceNodeName },
query: {
kuery,
start,
end,
uiFilters: JSON.stringify(uiFilters),
},
},
});
}
},
[serviceName, serviceNodeName, start, end, uiFilters]
[kuery, serviceName, serviceNodeName, start, end]
);

const isLoading = status === FETCH_STATUS.LOADING;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ interface ServiceNodeOverviewProps {
}

function ServiceNodeOverview({ serviceName }: ServiceNodeOverviewProps) {
const { uiFilters, urlParams } = useUrlParams();
const { start, end } = urlParams;
const {
urlParams: { kuery, start, end },
} = useUrlParams();

const { data: items = [] } = useFetcher(
(callApmApi) => {
Expand All @@ -50,14 +51,14 @@ function ServiceNodeOverview({ serviceName }: ServiceNodeOverviewProps) {
serviceName,
},
query: {
kuery,
start,
end,
uiFilters: JSON.stringify(uiFilters),
},
},
});
},
[serviceName, start, end, uiFilters]
[kuery, serviceName, start, end]
);

const columns: Array<ITableColumn<typeof items[0]>> = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ const INITIAL_STATE = {

export function ServiceOverviewErrorsTable({ serviceName }: Props) {
const {
urlParams: { environment, start, end },
uiFilters,
urlParams: { environment, kuery, start, end },
} = useUrlParams();
const { transactionType } = useApmServiceContext();
const [tableOptions, setTableOptions] = useState<{
Expand Down Expand Up @@ -72,9 +71,9 @@ export function ServiceOverviewErrorsTable({ serviceName }: Props) {
path: { serviceName },
query: {
environment,
kuery,
start,
end,
uiFilters: JSON.stringify(uiFilters),
transactionType,
},
},
Expand All @@ -85,7 +84,7 @@ export function ServiceOverviewErrorsTable({ serviceName }: Props) {
};
});
},
[environment, start, end, serviceName, uiFilters, transactionType]
[environment, kuery, start, end, serviceName, transactionType]
);

const { requestId, items } = data;
Expand Down Expand Up @@ -116,9 +115,10 @@ export function ServiceOverviewErrorsTable({ serviceName }: Props) {
params: {
path: { serviceName },
query: {
environment,
kuery,
start,
end,
uiFilters: JSON.stringify(uiFilters),
numBuckets: 20,
transactionType,
groupIds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ export function ServiceOverviewInstancesChartAndTable({
const { transactionType } = useApmServiceContext();

const {
urlParams: { environment, latencyAggregationType, start, end },
uiFilters,
urlParams: { environment, kuery, latencyAggregationType, start, end },
} = useUrlParams();

const { data = [], status } = useFetcher(
Expand All @@ -44,24 +43,24 @@ export function ServiceOverviewInstancesChartAndTable({
},
query: {
environment,
kuery,
latencyAggregationType,
start,
end,
transactionType,
uiFilters: JSON.stringify(uiFilters),
numBuckets: 20,
},
},
});
},
[
environment,
kuery,
latencyAggregationType,
start,
end,
serviceName,
transactionType,
uiFilters,
]
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ export function ServiceOverviewThroughputChart({
}) {
const theme = useTheme();
const { serviceName } = useParams<{ serviceName?: string }>();
const { urlParams, uiFilters } = useUrlParams();
const {
urlParams: { environment, kuery, start, end },
} = useUrlParams();
const { transactionType } = useApmServiceContext();
const { environment, start, end } = urlParams;

const { data = INITIAL_STATE, status } = useFetcher(
(callApmApi) => {
Expand All @@ -43,16 +44,16 @@ export function ServiceOverviewThroughputChart({
},
query: {
environment,
kuery,
start,
end,
transactionType,
uiFilters: JSON.stringify(uiFilters),
},
},
});
}
},
[environment, serviceName, start, end, uiFilters, transactionType]
[environment, kuery, serviceName, start, end, transactionType]
);

return (
Expand Down
Loading