Skip to content

Commit

Permalink
Remove kuery from uiFilters (#91932)
Browse files Browse the repository at this point in the history
* Make kuery a standalone query parameter instead of part of uiFilters
* Move getEsFilters helper to RUM
* Move query utils from "common" to "server" (it uses esKuery from the data plugin, which is exported from server, not common.)
* Move uiFiltersRt to RUM routes

References #84526.
  • Loading branch information
smith authored Feb 23, 2021
1 parent 4f8cd83 commit 57dfb81
Show file tree
Hide file tree
Showing 149 changed files with 644 additions and 672 deletions.
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 @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ export function ServiceOverviewTransactionsTable({ serviceName }: Props) {

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

const { data = INITIAL_STATE, status } = useFetcher(
Expand All @@ -73,9 +72,9 @@ export function ServiceOverviewTransactionsTable({ serviceName }: Props) {
path: { serviceName },
query: {
environment,
kuery,
start,
end,
uiFilters: JSON.stringify(uiFilters),
transactionType,
latencyAggregationType,
},
Expand All @@ -89,10 +88,10 @@ export function ServiceOverviewTransactionsTable({ serviceName }: Props) {
},
[
environment,
kuery,
serviceName,
start,
end,
uiFilters,
transactionType,
latencyAggregationType,
]
Expand Down Expand Up @@ -128,9 +127,9 @@ export function ServiceOverviewTransactionsTable({ serviceName }: Props) {
path: { serviceName },
query: {
environment,
kuery,
start,
end,
uiFilters: JSON.stringify(uiFilters),
numBuckets: 20,
transactionType,
latencyAggregationType,
Expand Down
Loading

0 comments on commit 57dfb81

Please sign in to comment.