lablup / lablup/backend.ai

Support filtering prometheusQueryPresets by category name

Open
#13,581 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
17h 7m
Merged PRs (30d)
358

Description

## Context

The WebUI deployment detail page (FR-3434, lablup/backend.ai-webui#8611) renders vLLM inference metric charts by fetching Prometheus query presets in the `vllm-inference` category and executing them via `prometheusQueryPresetResult`.

## Problem

`prometheusQueryPresets`' `QueryDefinitionFilter` only supports filtering by `categoryId` (UUID). The category UUID is generated by the DB at seed time (`_seed_category` in migration `7af18070fdef`), so it differs per installation and cannot be known by clients upfront. As a result the WebUI must fetch **all** presets and filter client-side by `category.name`, or spend an extra round trip resolving the category UUID first.

Meanwhile the category **name** is the de-facto stable semantic key:

- `prometheus_query_preset_categories.name` has a UNIQUE constraint
- the seed migration upserts idempotently keyed by name
- there is no rename mutation (only `adminCreatePrometheusQueryPresetCategory` / `adminDelete...`)

## Request

Add a category-name filter to `QueryDefinitionFilter`, e.g.:

```
prometheusQueryPresets(filter: { categoryName: { equals: "vllm-inference" } }) { ... }
```

(a `StringFilter` joined through the category relation). This lets clients select a preset category in a single server-side-filtered query using the stable key.

## Notes

- Nice-to-have in the same area: `prometheusQueryPresetCategories` already supports a name filter via `CategoryFilter`, so this aligns the two.
- Reported from WebUI work on FR-3434.

JIRA Issue: BA-7263

Contributor guide

Open the contributing guide

Research direction

Start at the prometheusQueryPresets GraphQL entry point and QueryDefinitionFilter; inspect how categoryId filtering is implemented and how category names are filtered by CategoryFilter. Use the existing category-name filtering behavior as the reference, then verify that categoryName selects only matching presets while existing filters continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
prometheus, python
Domain
api, backend, observability
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.