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

A few more environment uiFilters fixes #92044

Merged
merged 4 commits into from
Feb 21, 2021
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 @@ -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 @@ -23,9 +23,8 @@ export function AnnotationsContextProvider({
children: React.ReactNode;
}) {
const { serviceName } = useParams<{ serviceName?: string }>();
const { urlParams, uiFilters } = useUrlParams();
const { start, end } = urlParams;
const { environment } = uiFilters;
const { urlParams } = useUrlParams();
const { environment, start, end } = urlParams;

const { data = INITIAL_STATE } = useFetcher(
(callApmApi) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function getServiceMapServiceNodeInfo({
searchAggregatedTransactions,
}: Options & { serviceName: string }) {
return withApmSpan('get_service_map_node_stats', async () => {
const { start, end, uiFilters } = setup;
const { start, end } = setup;

const filter: ESFilter[] = [
{ term: { [SERVICE_NAME]: serviceName } },
Expand All @@ -66,7 +66,7 @@ export function getServiceMapServiceNodeInfo({

const minutes = Math.abs((end - start) / (1000 * 60));
const taskParams = {
environment: uiFilters.environment,
environment,
filter,
searchAggregatedTransactions,
minutes,
Expand Down
6 changes: 4 additions & 2 deletions x-pack/plugins/apm/server/routes/service_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { setupRequest } from '../lib/helpers/setup_request';
import { getServiceMap } from '../lib/service_map/get_service_map';
import { getServiceMapServiceNodeInfo } from '../lib/service_map/get_service_map_service_node_info';
import { createRoute } from './create_route';
import { environmentRt, rangeRt, uiFiltersRt } from './default_api_types';
import { environmentRt, rangeRt } from './default_api_types';
import { notifyFeatureUsage } from '../feature';
import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions';
import { isActivePlatinumLicense } from '../../common/license_check';
Expand Down Expand Up @@ -67,7 +67,7 @@ export const serviceMapServiceNodeRoute = createRoute({
path: t.type({
serviceName: t.string,
}),
query: t.intersection([rangeRt, uiFiltersRt]),
query: t.intersection([environmentRt, rangeRt]),
}),
options: { tags: ['access:apm'] },
handler: async ({ context, request }) => {
Expand All @@ -81,13 +81,15 @@ export const serviceMapServiceNodeRoute = createRoute({

const {
path: { serviceName },
query: { environment },
} = context.params;

const searchAggregatedTransactions = await getSearchAggregatedTransactions(
setup
);

return getServiceMapServiceNodeInfo({
environment,
setup,
serviceName,
searchAggregatedTransactions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export default function serviceMapsApiTests({ getService }: FtrProviderContext)
const q = querystring.stringify({
start: metadata.start,
end: metadata.end,
uiFilters: encodeURIComponent('{}'),
});
const response = await supertest.get(`/api/apm/service-map/service/opbeans-node?${q}`);

Expand Down