Skip to content

Commit

Permalink
Merge pull request #1495 from alexcreasy/incubation-revert-bias
Browse files Browse the repository at this point in the history
Revert "Bias to incubation (#1449)" rebase, then reapply as a merge.
  • Loading branch information
openshift-merge-robot authored Jul 11, 2023
2 parents bb8e2c5 + ea5cad8 commit 2e7d6e2
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
20 changes: 18 additions & 2 deletions backend/src/routes/api/prometheus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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,
);
},
);

Expand Down
5 changes: 3 additions & 2 deletions backend/src/utils/prometheusUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/api/prometheus/serving.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export const useModelServingMetrics = (
end,
timeframe,
trustyResponsePredicate,
'/api/prometheus/bias',
);

const modelTrustyAIDIR = useQueryRangeResourceData(
Expand All @@ -109,6 +110,7 @@ export const useModelServingMetrics = (
end,
timeframe,
trustyResponsePredicate,
'/api/prometheus/bias',
);

React.useEffect(() => {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/api/prometheus/useQueryRangeResourceData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ const useQueryRangeResourceData = <T = PrometheusQueryRangeResultValue>(
end: number,
timeframe: TimeframeTitle,
responsePredicate: ResponsePredicate<T>,
apiPath = '/api/prometheus/serving',
): ContextResourceData<T> =>
useRestructureContextResourceData<T>(
usePrometheusQueryRange<T>(
active,
'/api/prometheus/serving',
apiPath,
query,
TimeframeTimeRange[timeframe],
end,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ const PipelineRunJobTable: React.FC<PipelineRunTableProps> = ({ jobs, experiment
)}
/>
)}

<DeletePipelineCoreResourceModal
toDeleteResources={deleteResources}
type="scheduled run"
Expand Down

0 comments on commit 2e7d6e2

Please sign in to comment.