Skip to content

Commit 655f2b7

Browse files
ADI-ROXXyurishkuro
andauthored
Make changes to allow for /api/quality-metrics to work (jaegertracing#2641)
## Which problem is this PR solving? - Resolves jaegertracing#2640 - jaegertracing/jaeger#6607 ## Description of the changes - introduce config option for the API endpoint and change it to `/api/quality-metrics' as implemented in jaegertracing/jaeger#6608 ## How was this change tested? - manually ## Checklist - [ ] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [ ] I have signed all commits - [ ] I have added unit tests for the new functionality - [ ] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `npm run lint` and `npm run test` --------- Signed-off-by: cs-308-2023 <[email protected]> Signed-off-by: Yuri Shkuro <[email protected]> Co-authored-by: Yuri Shkuro <[email protected]> Co-authored-by: Yuri Shkuro <[email protected]>
1 parent 625a57a commit 655f2b7

File tree

5 files changed

+8
-3
lines changed

5 files changed

+8
-3
lines changed

packages/jaeger-ui/src/api/jaeger.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import dayjs from 'dayjs';
1717
import _duration from 'dayjs/plugin/duration';
1818
import queryString from 'query-string';
1919

20+
import getConfig from '../utils/config/get-config';
2021
import prefixUrl from '../utils/prefix-url';
2122

2223
dayjs.extend(_duration);
@@ -81,6 +82,7 @@ function getJSON(url, options = {}) {
8182

8283
export const DEFAULT_API_ROOT = prefixUrl('/api/');
8384
export const ANALYTICS_ROOT = prefixUrl('/analytics/');
85+
export const QUALITY_METRICS_ROOT = prefixUrl(getConfig().qualityMetrics.apiEndpoint);
8486
export const DEFAULT_DEPENDENCY_LOOKBACK = dayjs.duration(1, 'weeks').asMilliseconds();
8587

8688
const JaegerAPI = {
@@ -98,7 +100,7 @@ const JaegerAPI = {
98100
return getJSON(`${this.apiRoot}dependencies`, { query: { endTs, lookback } });
99101
},
100102
fetchQualityMetrics(service, hours) {
101-
return getJSON(`/qualitymetrics-v2`, { query: { hours, service } });
103+
return getJSON(QUALITY_METRICS_ROOT, { query: { hours, service } });
102104
},
103105
fetchServiceOperations(serviceName) {
104106
return getJSON(`${this.apiRoot}services/${encodeURIComponent(serviceName)}/operations`);

packages/jaeger-ui/src/api/jaeger.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ describe('fetchQualityMetrics', () => {
9595
const service = 'test-service';
9696
JaegerAPI.fetchQualityMetrics(service, hours);
9797
expect(fetchMock).toHaveBeenLastCalledWith(
98-
`/qualitymetrics-v2?${queryString.stringify({ service, hours })}`,
98+
`/api/quality-metrics?${queryString.stringify({ service, hours })}`,
9999
defaultOptions
100100
);
101101
});

packages/jaeger-ui/src/constants/default-config.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ const defaultConfig: Config = {
119119
qualityMetrics: {
120120
menuEnabled: false,
121121
menuLabel: 'Trace Quality',
122+
apiEndpoint: '/api/quality-metrics',
122123
},
123124
};
124125

packages/jaeger-ui/src/types/config.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -200,5 +200,6 @@ export type Config = {
200200
qualityMetrics?: {
201201
menuEnabled?: boolean;
202202
menuLabel?: string;
203+
apiEndpoint?: string;
203204
};
204205
};

packages/jaeger-ui/src/utils/config/get-config.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import _get from 'lodash/get';
1616
import memoizeOne from 'memoize-one';
1717

18+
import { Config } from '../../types/config';
1819
import processDeprecation from './process-deprecation';
1920
import defaultConfig, { deprecations, mergeFields } from '../../constants/default-config';
2021

@@ -38,7 +39,7 @@ function getCapabilities() {
3839
* Merge the embedded config from the query service (if present) with the
3940
* default config from `../../constants/default-config`.
4041
*/
41-
const getConfig = memoizeOne(function getConfig() {
42+
const getConfig = memoizeOne(function getConfig(): Config {
4243
const capabilities = getCapabilities();
4344

4445
const embedded = getUiConfig();

0 commit comments

Comments
 (0)