diff --git a/backend/src/routes/api/prometheus/index.ts b/backend/src/routes/api/prometheus/index.ts index 95c6b3f016..2c62e3164f 100644 --- a/backend/src/routes/api/prometheus/index.ts +++ b/backend/src/routes/api/prometheus/index.ts @@ -4,8 +4,9 @@ import { OauthFastifyRequest, PrometheusQueryRangeResponse, PrometheusQueryResponse, + QueryType, } from '../../../types'; -import { callPrometheusPVC, callPrometheusServing } from '../../../utils/prometheusUtils'; +import { callPrometheusThanos, callPrometheusServing } from '../../../utils/prometheusUtils'; import { createCustomError } from '../../../utils/requestUtils'; import { logRequestDetails } from '../../../utils/fileUtils'; @@ -35,7 +36,22 @@ module.exports = async (fastify: KubeFastifyInstance) => { ): Promise<{ code: number; response: PrometheusQueryResponse }> => { const { query } = request.body; - return callPrometheusPVC(fastify, request, query).catch(handleError); + return callPrometheusThanos(fastify, request, query).catch(handleError); + }, + ); + + fastify.post( + '/bias', + async ( + request: OauthFastifyRequest<{ + Body: { query: string }; + }>, + ): Promise<{ code: number; response: PrometheusQueryResponse }> => { + const { query } = request.body; + + return callPrometheusThanos(fastify, request, query, QueryType.QUERY_RANGE).catch( + handleError, + ); }, ); diff --git a/backend/src/utils/prometheusUtils.ts b/backend/src/utils/prometheusUtils.ts index 141f3025de..5735a850cc 100644 --- a/backend/src/utils/prometheusUtils.ts +++ b/backend/src/utils/prometheusUtils.ts @@ -84,17 +84,18 @@ const generatePrometheusHostURL = ( return `https://${instanceName}.${namespace}.svc.cluster.local:${port}`; }; -export const callPrometheusPVC = ( +export const callPrometheusThanos = ( fastify: KubeFastifyInstance, request: OauthFastifyRequest, query: string, + queryType: QueryType = QueryType.QUERY, ): Promise<{ code: number; response: PrometheusQueryResponse }> => callPrometheus( fastify, request, query, generatePrometheusHostURL(fastify, 'thanos-querier', 'openshift-monitoring', '9092'), - QueryType.QUERY, + queryType, ); export const callPrometheusServing = ( diff --git a/frontend/src/api/prometheus/serving.ts b/frontend/src/api/prometheus/serving.ts index 8db5a23fdc..d9dd517ccc 100644 --- a/frontend/src/api/prometheus/serving.ts +++ b/frontend/src/api/prometheus/serving.ts @@ -101,6 +101,7 @@ export const useModelServingMetrics = ( end, timeframe, trustyResponsePredicate, + '/api/prometheus/bias', ); const modelTrustyAIDIR = useQueryRangeResourceData( @@ -109,6 +110,7 @@ export const useModelServingMetrics = ( end, timeframe, trustyResponsePredicate, + '/api/prometheus/bias', ); React.useEffect(() => { diff --git a/frontend/src/api/prometheus/useQueryRangeResourceData.ts b/frontend/src/api/prometheus/useQueryRangeResourceData.ts index 1c7dbdc2f3..52f082fc4b 100644 --- a/frontend/src/api/prometheus/useQueryRangeResourceData.ts +++ b/frontend/src/api/prometheus/useQueryRangeResourceData.ts @@ -11,11 +11,12 @@ const useQueryRangeResourceData = ( end: number, timeframe: TimeframeTitle, responsePredicate: ResponsePredicate, + apiPath = '/api/prometheus/serving', ): ContextResourceData => useRestructureContextResourceData( usePrometheusQueryRange( active, - '/api/prometheus/serving', + apiPath, query, TimeframeTimeRange[timeframe], end, diff --git a/frontend/src/concepts/pipelines/content/tables/pipelineRunJob/PipelineRunJobTable.tsx b/frontend/src/concepts/pipelines/content/tables/pipelineRunJob/PipelineRunJobTable.tsx index 6308e01cd5..328492c5e5 100644 --- a/frontend/src/concepts/pipelines/content/tables/pipelineRunJob/PipelineRunJobTable.tsx +++ b/frontend/src/concepts/pipelines/content/tables/pipelineRunJob/PipelineRunJobTable.tsx @@ -94,7 +94,6 @@ const PipelineRunJobTable: React.FC = ({ jobs, experiment )} /> )} -