File tree 5 files changed +8
-3
lines changed
5 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import dayjs from 'dayjs';
17
17
import _duration from 'dayjs/plugin/duration' ;
18
18
import queryString from 'query-string' ;
19
19
20
+ import getConfig from '../utils/config/get-config' ;
20
21
import prefixUrl from '../utils/prefix-url' ;
21
22
22
23
dayjs . extend ( _duration ) ;
@@ -81,6 +82,7 @@ function getJSON(url, options = {}) {
81
82
82
83
export const DEFAULT_API_ROOT = prefixUrl ( '/api/' ) ;
83
84
export const ANALYTICS_ROOT = prefixUrl ( '/analytics/' ) ;
85
+ export const QUALITY_METRICS_ROOT = prefixUrl ( getConfig ( ) . qualityMetrics . apiEndpoint ) ;
84
86
export const DEFAULT_DEPENDENCY_LOOKBACK = dayjs . duration ( 1 , 'weeks' ) . asMilliseconds ( ) ;
85
87
86
88
const JaegerAPI = {
@@ -98,7 +100,7 @@ const JaegerAPI = {
98
100
return getJSON ( `${ this . apiRoot } dependencies` , { query : { endTs, lookback } } ) ;
99
101
} ,
100
102
fetchQualityMetrics ( service , hours ) {
101
- return getJSON ( `/qualitymetrics-v2` , { query : { hours, service } } ) ;
103
+ return getJSON ( QUALITY_METRICS_ROOT , { query : { hours, service } } ) ;
102
104
} ,
103
105
fetchServiceOperations ( serviceName ) {
104
106
return getJSON ( `${ this . apiRoot } services/${ encodeURIComponent ( serviceName ) } /operations` ) ;
Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ describe('fetchQualityMetrics', () => {
95
95
const service = 'test-service' ;
96
96
JaegerAPI . fetchQualityMetrics ( service , hours ) ;
97
97
expect ( fetchMock ) . toHaveBeenLastCalledWith (
98
- `/qualitymetrics-v2 ?${ queryString . stringify ( { service, hours } ) } ` ,
98
+ `/api/quality-metrics ?${ queryString . stringify ( { service, hours } ) } ` ,
99
99
defaultOptions
100
100
) ;
101
101
} ) ;
Original file line number Diff line number Diff line change @@ -119,6 +119,7 @@ const defaultConfig: Config = {
119
119
qualityMetrics : {
120
120
menuEnabled : false ,
121
121
menuLabel : 'Trace Quality' ,
122
+ apiEndpoint : '/api/quality-metrics' ,
122
123
} ,
123
124
} ;
124
125
Original file line number Diff line number Diff line change @@ -200,5 +200,6 @@ export type Config = {
200
200
qualityMetrics ?: {
201
201
menuEnabled ?: boolean ;
202
202
menuLabel ?: string ;
203
+ apiEndpoint ?: string ;
203
204
} ;
204
205
} ;
Original file line number Diff line number Diff line change 15
15
import _get from 'lodash/get' ;
16
16
import memoizeOne from 'memoize-one' ;
17
17
18
+ import { Config } from '../../types/config' ;
18
19
import processDeprecation from './process-deprecation' ;
19
20
import defaultConfig , { deprecations , mergeFields } from '../../constants/default-config' ;
20
21
@@ -38,7 +39,7 @@ function getCapabilities() {
38
39
* Merge the embedded config from the query service (if present) with the
39
40
* default config from `../../constants/default-config`.
40
41
*/
41
- const getConfig = memoizeOne ( function getConfig ( ) {
42
+ const getConfig = memoizeOne ( function getConfig ( ) : Config {
42
43
const capabilities = getCapabilities ( ) ;
43
44
44
45
const embedded = getUiConfig ( ) ;
You can’t perform that action at this time.
0 commit comments