forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APM] Create new API's to return Latency and Throughput charts (elast…
…ic#85242) * breaking /transactions/charts into /latency and /thoughput * adding unit tests * fixing UI * fixing i18n * addressing pr comments * fix api test * refactoring some stuff * addressing pr comments * addressing pr comments * fixing test Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
d11bf79
commit 12b6e45
Showing
43 changed files
with
1,072 additions
and
12,404 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
x-pack/plugins/apm/public/hooks/use_transaction_throughput_chart_fetcher.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { useMemo } from 'react'; | ||
import { useParams } from 'react-router-dom'; | ||
import { useFetcher } from './use_fetcher'; | ||
import { useUrlParams } from '../context/url_params_context/use_url_params'; | ||
import { getThrouputChartSelector } from '../selectors/throuput_chart_selectors'; | ||
import { useTheme } from './use_theme'; | ||
|
||
export function useTransactionThroughputChartsFetcher() { | ||
const { serviceName } = useParams<{ serviceName?: string }>(); | ||
const theme = useTheme(); | ||
const { | ||
urlParams: { transactionType, start, end, transactionName }, | ||
uiFilters, | ||
} = useUrlParams(); | ||
|
||
const { data, error, status } = useFetcher( | ||
(callApmApi) => { | ||
if (serviceName && start && end) { | ||
return callApmApi({ | ||
endpoint: | ||
'GET /api/apm/services/{serviceName}/transactions/charts/throughput', | ||
params: { | ||
path: { serviceName }, | ||
query: { | ||
start, | ||
end, | ||
transactionType, | ||
transactionName, | ||
uiFilters: JSON.stringify(uiFilters), | ||
}, | ||
}, | ||
}); | ||
} | ||
}, | ||
[serviceName, start, end, transactionName, transactionType, uiFilters] | ||
); | ||
|
||
const memoizedData = useMemo( | ||
() => getThrouputChartSelector({ throuputChart: data, theme }), | ||
[data, theme] | ||
); | ||
|
||
return { | ||
throughputChartsData: memoizedData, | ||
throughputChartsStatus: status, | ||
throughputChartsError: error, | ||
}; | ||
} |
Oops, something went wrong.