|
6 | 6 |
|
7 | 7 | import * as t from 'io-ts'; |
8 | 8 | import { omit } from 'lodash'; |
| 9 | +import { jsonRt } from '../../common/runtime_types/json_rt'; |
| 10 | +import { LocalUIFilterName } from '../../common/ui_filter'; |
| 11 | +import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions'; |
| 12 | +import { getEsFilter } from '../lib/helpers/convert_ui_filters/get_es_filter'; |
9 | 13 | import { |
10 | | - setupRequest, |
11 | 14 | Setup, |
| 15 | + setupRequest, |
12 | 16 | SetupTimeRange, |
13 | 17 | } from '../lib/helpers/setup_request'; |
14 | 18 | import { getEnvironments } from '../lib/ui_filters/get_environments'; |
15 | | -import { Projection } from '../projections/typings'; |
16 | | -import { localUIFilterNames } from '../lib/ui_filters/local_ui_filters/config'; |
17 | | -import { getEsFilter } from '../lib/helpers/convert_ui_filters/get_es_filter'; |
18 | 19 | import { getLocalUIFilters } from '../lib/ui_filters/local_ui_filters'; |
19 | | -import { getServicesProjection } from '../projections/services'; |
20 | | -import { getTransactionGroupsProjection } from '../projections/transaction_groups'; |
21 | | -import { getMetricsProjection } from '../projections/metrics'; |
22 | | -import { getErrorGroupsProjection } from '../projections/errors'; |
23 | | -import { getTransactionsProjection } from '../projections/transactions'; |
24 | | -import { createRoute } from './create_route'; |
25 | | -import { uiFiltersRt, rangeRt } from './default_api_types'; |
26 | | -import { jsonRt } from '../../common/runtime_types/json_rt'; |
27 | | -import { getServiceNodesProjection } from '../projections/service_nodes'; |
| 20 | +import { localUIFilterNames } from '../lib/ui_filters/local_ui_filters/config'; |
28 | 21 | import { getRumPageLoadTransactionsProjection } from '../projections/rum_page_load_transactions'; |
29 | | -import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions'; |
| 22 | +import { Projection } from '../projections/typings'; |
| 23 | +import { createRoute } from './create_route'; |
| 24 | +import { rangeRt, uiFiltersRt } from './default_api_types'; |
30 | 25 | import { APMRequestHandlerContext } from './typings'; |
31 | | -import { LocalUIFilterName } from '../../common/ui_filter'; |
32 | 26 |
|
33 | 27 | export const uiFiltersEnvironmentsRoute = createRoute({ |
34 | 28 | endpoint: 'GET /api/apm/ui_filters/environments', |
@@ -121,136 +115,6 @@ function createLocalFiltersRoute< |
121 | 115 | }); |
122 | 116 | } |
123 | 117 |
|
124 | | -export const servicesLocalFiltersRoute = createLocalFiltersRoute({ |
125 | | - endpoint: `GET /api/apm/ui_filters/local_filters/services`, |
126 | | - getProjection: async ({ context, setup }) => { |
127 | | - const searchAggregatedTransactions = await getSearchAggregatedTransactions( |
128 | | - setup |
129 | | - ); |
130 | | - |
131 | | - return getServicesProjection({ setup, searchAggregatedTransactions }); |
132 | | - }, |
133 | | - queryRt: t.type({}), |
134 | | -}); |
135 | | - |
136 | | -export const transactionGroupsLocalFiltersRoute = createLocalFiltersRoute({ |
137 | | - endpoint: 'GET /api/apm/ui_filters/local_filters/transactionGroups', |
138 | | - getProjection: async ({ context, setup, query }) => { |
139 | | - const { transactionType, serviceName, transactionName } = query; |
140 | | - |
141 | | - const searchAggregatedTransactions = await getSearchAggregatedTransactions( |
142 | | - setup |
143 | | - ); |
144 | | - |
145 | | - return getTransactionGroupsProjection({ |
146 | | - setup, |
147 | | - options: { |
148 | | - type: 'top_transactions', |
149 | | - transactionType, |
150 | | - serviceName, |
151 | | - transactionName, |
152 | | - searchAggregatedTransactions, |
153 | | - }, |
154 | | - }); |
155 | | - }, |
156 | | - queryRt: t.intersection([ |
157 | | - t.type({ |
158 | | - serviceName: t.string, |
159 | | - transactionType: t.string, |
160 | | - }), |
161 | | - t.partial({ |
162 | | - transactionName: t.string, |
163 | | - }), |
164 | | - ]), |
165 | | -}); |
166 | | - |
167 | | -export const tracesLocalFiltersRoute = createLocalFiltersRoute({ |
168 | | - endpoint: 'GET /api/apm/ui_filters/local_filters/traces', |
169 | | - getProjection: async ({ setup, context }) => { |
170 | | - const searchAggregatedTransactions = await getSearchAggregatedTransactions( |
171 | | - setup |
172 | | - ); |
173 | | - |
174 | | - return getTransactionGroupsProjection({ |
175 | | - setup, |
176 | | - options: { type: 'top_traces', searchAggregatedTransactions }, |
177 | | - }); |
178 | | - }, |
179 | | - queryRt: t.type({}), |
180 | | -}); |
181 | | - |
182 | | -export const transactionsLocalFiltersRoute = createLocalFiltersRoute({ |
183 | | - endpoint: 'GET /api/apm/ui_filters/local_filters/transactions', |
184 | | - getProjection: async ({ context, setup, query }) => { |
185 | | - const { transactionType, serviceName, transactionName } = query; |
186 | | - |
187 | | - const searchAggregatedTransactions = await getSearchAggregatedTransactions( |
188 | | - setup |
189 | | - ); |
190 | | - |
191 | | - return getTransactionsProjection({ |
192 | | - setup, |
193 | | - transactionType, |
194 | | - serviceName, |
195 | | - transactionName, |
196 | | - searchAggregatedTransactions, |
197 | | - }); |
198 | | - }, |
199 | | - queryRt: t.type({ |
200 | | - transactionType: t.string, |
201 | | - transactionName: t.string, |
202 | | - serviceName: t.string, |
203 | | - }), |
204 | | -}); |
205 | | - |
206 | | -export const metricsLocalFiltersRoute = createLocalFiltersRoute({ |
207 | | - endpoint: 'GET /api/apm/ui_filters/local_filters/metrics', |
208 | | - getProjection: ({ setup, query }) => { |
209 | | - const { serviceName, serviceNodeName } = query; |
210 | | - return getMetricsProjection({ |
211 | | - setup, |
212 | | - serviceName, |
213 | | - serviceNodeName, |
214 | | - }); |
215 | | - }, |
216 | | - queryRt: t.intersection([ |
217 | | - t.type({ |
218 | | - serviceName: t.string, |
219 | | - }), |
220 | | - t.partial({ |
221 | | - serviceNodeName: t.string, |
222 | | - }), |
223 | | - ]), |
224 | | -}); |
225 | | - |
226 | | -export const errorGroupsLocalFiltersRoute = createLocalFiltersRoute({ |
227 | | - endpoint: 'GET /api/apm/ui_filters/local_filters/errorGroups', |
228 | | - getProjection: ({ setup, query }) => { |
229 | | - const { serviceName } = query; |
230 | | - return getErrorGroupsProjection({ |
231 | | - setup, |
232 | | - serviceName, |
233 | | - }); |
234 | | - }, |
235 | | - queryRt: t.type({ |
236 | | - serviceName: t.string, |
237 | | - }), |
238 | | -}); |
239 | | - |
240 | | -export const serviceNodesLocalFiltersRoute = createLocalFiltersRoute({ |
241 | | - endpoint: 'GET /api/apm/ui_filters/local_filters/serviceNodes', |
242 | | - getProjection: ({ setup, query }) => { |
243 | | - const { serviceName } = query; |
244 | | - return getServiceNodesProjection({ |
245 | | - setup, |
246 | | - serviceName, |
247 | | - }); |
248 | | - }, |
249 | | - queryRt: t.type({ |
250 | | - serviceName: t.string, |
251 | | - }), |
252 | | -}); |
253 | | - |
254 | 118 | export const rumOverviewLocalFiltersRoute = createLocalFiltersRoute({ |
255 | 119 | endpoint: 'GET /api/apm/ui_filters/local_filters/rumOverview', |
256 | 120 | getProjection: async ({ setup }) => { |
|
0 commit comments