Skip to content

Commit

Permalink
Revert "Revert "Merge pull request opendatahub-io#1503 from alexcreas…
Browse files Browse the repository at this point in the history
…y/configurable-thanos-port""

This reverts commit fec931d.
  • Loading branch information
alexcreasy committed Jul 18, 2023
1 parent a617178 commit b758ee8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions backend/src/routes/api/prometheus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { callPrometheusThanos } from '../../../utils/prometheusUtils';
import { createCustomError } from '../../../utils/requestUtils';
import { logRequestDetails } from '../../../utils/fileUtils';
import { THANOS_DEFAULT_OAUTH_PORT } from '../../../utils/constants';

const handleError = (e: createError.HttpError) => {
if (e?.code) {
Expand Down Expand Up @@ -56,6 +57,7 @@ module.exports = async (fastify: KubeFastifyInstance) => {
request,
query,
QueryType.QUERY_RANGE,
THANOS_DEFAULT_OAUTH_PORT,
).catch(handleError);
},
);
Expand Down
3 changes: 3 additions & 0 deletions backend/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,6 @@ export const DEFAULT_NOTEBOOK_SIZES: NotebookSize[] = [

export const imageUrlRegex =
/^([\w.\-_]+((?::\d+|)(?=\/[a-z0-9._-]+\/[a-z0-9._-]+))|)(?:\/|)([a-z0-9.\-_]+(?:\/[a-z0-9.\-_]+|))(?::([\w.\-_]{1,127})|)/;

export const THANOS_DEFAULT_RBAC_PORT = '9092';
export const THANOS_DEFAULT_OAUTH_PORT = '9091';
5 changes: 3 additions & 2 deletions backend/src/utils/prometheusUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
PrometheusQueryRangeResponse,
QueryType,
} from '../types';
import { DEV_MODE } from './constants';
import { DEV_MODE, THANOS_DEFAULT_RBAC_PORT } from './constants';
import { getNamespaces } from './notebookUtils';
import { getDashboardConfig } from './resourceUtils';
import { createCustomError } from './requestUtils';
Expand Down Expand Up @@ -88,12 +88,13 @@ export const callPrometheusThanos = <T>(
request: OauthFastifyRequest,
query: string,
queryType: QueryType = QueryType.QUERY,
port = THANOS_DEFAULT_RBAC_PORT,
): Promise<{ code: number; response: T }> =>
callPrometheus<T>(
fastify,
request,
query,
generatePrometheusHostURL(fastify, 'thanos-querier', 'openshift-monitoring', '9092'),
generatePrometheusHostURL(fastify, 'thanos-querier', 'openshift-monitoring', port),
queryType,
);

Expand Down

0 comments on commit b758ee8

Please sign in to comment.