You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(FR-2451): add auto scaling rule management feature spec (#6356)
> [!NOTE]
> This is for v26.5.0
Resolves#6357 ([FR-2451](https://lablup.atlassian.net/browse/FR-2451))
## Summary
- Add full-scope draft spec for Auto Scaling Rule management feature
- Admin Serving page: Prometheus Query Preset CRUD for superadmins (create/read/update/delete via dedicated tab)
- Service detail page: single/range condition mode selector, Prometheus preset-based metric selection, query result preview
- Updated to reflect schema changes:
- Query APIs are user-accessible (`prometheusQueryPresets`, `prometheusQueryPreset`, `prometheusQueryPresetResult`), mutations remain admin-only
- `AutoScalingRule.queryPreset: QueryDefinition` field added (26.4.3) — enables direct preset resolution without ID roundtrip
- `QueryDefinition.category: QueryPresetCategory` field added (26.4.3) — preset grouping in UI dropdowns
- New category-related queries/mutations (`prometheusQueryPresetCategories`, `adminCreatePrometheusQueryPresetCategory`, etc.)
- `QueryDefinition` extended with `description`, `rank`, `categoryId` fields
## Notes
- This is the broader draft spec. The reduced, implementation-focused spec is in the parent PR #6486.
- **TODO(needs-backend)**: `metric_source` field may need version-based branching once the backend core auto scaling PR lands.
## Spec
See \`.specs/draft-auto-scaling-rule-management/spec.md\`
[FR-2451]: https://lablup.atlassian.net/browse/FR-2451?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
서비스 디테일 페이지의 Auto Scaling Rule 편집/목록 UI를 개선한다. 비교 연산자 표시 방향을 정규화하고, 단일/범위 조건 모드를 추가하며, 백엔드 >=26.4.0에서 Prometheus Query Preset 기반 메트릭 선택을 지원한다.
5
+
서비스 디테일 페이지의 Auto Scaling Rule 편집/목록 UI를 개선한다. 비교 연산자 표시 방향을 정규화하고, Scale In / Scale Out / Scale In & Out 세 가지 조건 방향 선택을 추가하며, 백엔드 >=26.4.0에서 Prometheus Query Preset 기반 메트릭 선택을 지원한다.
6
6
7
7
## 문제 정의
8
8
@@ -22,11 +22,11 @@
22
22
23
23
| 저장된 상태 | 표시 형태 |
24
24
|---|---|
25
-
|`maxThreshold`만 설정 (상한) |`[metric_name] < [maxThreshold]`|
26
-
|`minThreshold`만 설정 (하한) |`[minThreshold] < [metric_name]`|
27
-
| 둘 다 설정 (범위) |`[minThreshold] < [metric_name] < [maxThreshold]`|
25
+
|`minThreshold`만 설정 (Scale In) |`[metric_name] < [minThreshold]`|
26
+
|`maxThreshold`만 설정 (Scale Out) |`[maxThreshold] < [metric_name]`|
27
+
| 둘 다 설정 (Scale In & Out) |`[metric_name] < [minThreshold]` + `[maxThreshold] < [metric_name]` (두 줄)|
28
28
29
-
**Graphene API (<26.4.0)**: `comparator` + 단일 `threshold`로 조건을 표현한다.
29
+
**Legacy API (<26.4.0)**: `comparator` + 단일 `threshold`로 조건을 표현한다.
30
30
31
31
| 저장된 comparator | 표시 형태 |
32
32
|---|---|
@@ -35,53 +35,60 @@
35
35
36
36
에디터 모달의 비교 연산자 드롭다운은 **Legacy 단일 모드에서만** 표시하며, `<` (LESS_THAN)과 `>` (GREATER_THAN) 두 가지만 제공한다. 스키마에는 `LESS_THAN_OR_EQUAL`, `GREATER_THAN_OR_EQUAL`도 존재하지만, UI에서는 사용하지 않는다.
37
37
38
-
#### 2. 조건 모드 선택 (단일/범위)
38
+
#### 2. 조건 모드 선택 (Scale In / Scale Out / Scale In & Out)
39
39
40
-
Auto Scaling Rule 에디터 모달에 Ant Design `Segmented`컴포넌트를 추가하여 "단일" / "범위" 모드를 전환한다.
40
+
Auto Scaling Rule 에디터 모달에 Ant Design `Radio.Group` (버튼형) 컴포넌트를 추가하여 세 가지 조건 방향을 선택한다. 비교 연산자는 항상 `<` (strict less than)만 사용하며, `≤` 선택 UI는 제공하지 않는다.
41
41
42
-
-**단일 모드** (기본): "상한" 또는 "하한" 방향을 선택하고 threshold 값을 입력
-**Scale In & Out** (범위): `minThreshold` + `maxThreshold` 동시 설정
48
+
- UI: `Metric < [하한값]` + `[상한값] < Metric` 두 행으로 표시
46
49
- 하한값 >= 상한값이면 validation 에러를 표시
47
50
48
-
> **참고**: Strawberry API (>=26.4.0) 전용. Legacy (<26.4.0)에서는 Graphene `comparator` + 단일 `threshold`를 그대로 사용하며, 범위 모드는 지원하지 않는다.
51
+
스텝 사이즈 필드의 prefix 기호는 조건 모드에 따라 자동으로 변경된다:
52
+
- Scale In: `−` (minus)
53
+
- Scale Out: `+` (plus)
54
+
- Scale In & Out: `±`
49
55
50
-
#### 3. Prometheus Preset 기반 메트릭 선택
56
+
> **참고**: Strawberry API (>=26.4.0) 전용. Legacy (<26.4.0)에서는 `comparator` + 단일 `threshold`를 그대로 사용하며, Scale In & Out(범위) 모드는 지원하지 않는다.
51
57
52
-
-`baiClient.supports('prometheus-auto-scaling-rule')` (또는 >=26.4.0 대응 키)로 기능 게이팅
53
-
-**>=26.4.0**: `AutoScalingMetricSource.PROMETHEUS`가 추가됨. Condition 영역에서 metric source로 `PROMETHEUS`를 선택하면, `prometheusQueryPresets` 기반 Select로 preset을 선택할 수 있도록 함. Preset 선택 시 `queryTemplate`과 `timeWindow`가 자동 적용되고, `prometheusQueryPresetId`가 Rule에 저장됨
54
-
-**<26.4.0**: 기존 방식 유지 (metric source `KERNEL`/`INFERENCE_FRAMEWORK` 선택 + metric name 수동 입력)
58
+
#### 3. Prometheus Preset 기반 메트릭 선택
55
59
56
-
##### Metric Source별 UI 분기 (>=26.4.0 전용)
60
+
`baiClient.supports('prometheus-auto-scaling-rule')` (`isSupportPrometheusAutoScalingRule`)로 기능 게이팅한다.
57
61
58
-
`<26.4.0`에서는 `KERNEL`/`INFERENCE_FRAMEWORK`만 표시되며, `PROMETHEUS`는 노출하지 않는다.
62
+
**버전별 metric source 드롭다운 구성:**
59
63
60
-
| metricSource |Preset 선택 UI | prometheusQueryPresetId| metric name |
64
+
| metricSource |`<26.4.0`|`>=26.4.0`| metric name 입력|
61
65
|---|---|---|---|
62
-
|`KERNEL`| 숨김 |`null`| AutoComplete (자동완성 목록: `cpu_util`, `mem`, `net_rx`, `net_tx` + 자유 입력 가능) |
63
-
|`INFERENCE_FRAMEWORK`| 숨김 |`null`| AutoComplete (자동완성 목록 없음, 자유 입력) |
64
-
|`PROMETHEUS`| 표시 (필수) | 필수 | preset의 `metricName`에서 자동 채움 (입력 불필요) |
66
+
|`KERNEL`| 표시 | 표시 | AutoComplete (`cpu_util`, `mem`, `net_rx`, `net_tx` + 자유 입력) |
67
+
|`INFERENCE_FRAMEWORK`| 표시 |**숨김**| AutoComplete (자유 입력) |
68
+
|`PROMETHEUS`|**숨김**| 표시 | preset 선택 시 자동 채움 (숨김 필드) |
69
+
70
+
`>=26.4.0`에서는 `INFERENCE_FRAMEWORK`가 드롭다운에서 제거되고 `KERNEL` / `PROMETHEUS` 두 가지만 표시된다.
65
71
66
72
##### Preset 선택 UI 동작
67
73
68
74
1. metric source 드롭다운에서 `PROMETHEUS` 선택 시 Prometheus Query Preset Select가 추가로 노출
69
-
2. Preset 목록은 `prometheusQueryPresets` query로 로드하여 `name`을 드롭다운에 표시
75
+
2. Preset 목록은 `prometheusQueryPresets` query로 로드하여 `rank` 오름차순으로 정렬한 뒤, 카테고리가 있는 항목은 `category.name`으로 그룹핑하고, 카테고리 없는 항목은 그룹 뒤에 평탄하게 나열한다
70
76
3. Preset 선택 시:
71
77
-`prometheusQueryPresetId`에 선택된 preset의 UUID 저장 (Relay global ID를 디코딩한 raw UUID)
72
-
-`metricName`은 preset의 `metricName`에서 자동으로 채움 (사용자 입력 불필요)
73
-
-`queryTemplate`을 읽기 전용으로 표시하여 사용자가 쿼리 내용 확인 가능
74
-
-`timeWindow`가 자동 적용 (preset의 `timeWindow`가 null이면 사용자 입력)
78
+
-`metricName`은 preset의 `metricName`에서 자동으로 채움 (사용자 입력 불필요, 숨김 필드)
79
+
-`timeWindow`가 자동 적용 (preset의 `timeWindow`가 유효한 숫자값이면 적용, null이면 기존값 유지)
75
80
76
81
##### Rule 목록에서 Prometheus preset 표시
77
82
78
-
`metricSource`가 `PROMETHEUS`인 rule은 목록에서 preset 이름을 표시한다. `prometheusQueryPresetId`로 `prometheusQueryPreset(id)` query를 호출하거나, preset 목록을 한 번 로드하여 클라이언트 사이드에서 매칭한다.
83
+
`metricSource`가 `PROMETHEUS`인 rule은 목록에서 metric name 대신 preset 이름을 표시한다. 구현 방식: `prometheusQueryPresets` 쿼리로 전체 preset 목록을 로드한 뒤 `(raw UUID → name)` 맵을 만들고, rule의 `prometheusQueryPresetId`로 이름을 조회한다. 조회 실패 시 `metricName`을 fallback으로 표시한다.
84
+
85
+
> **참고**: `AutoScalingRule.queryPreset` 필드(>=26.4.3)가 스키마에 존재하지만, 현재 구현에서는 사용하지 않고 별도 쿼리 맵 방식을 사용한다.
79
86
80
87
##### Rule 수정 시 주의사항
81
88
82
89
-`updateAutoScalingRule`은 partial update — 변경할 필드만 전달
83
90
-`prometheusQueryPresetId: null`은 "미변경"(UNSET) 의미이며, 명시적으로 null로 설정할 수 없음
84
-
-`metricSource`를 `KERNEL`로 변경해도 `prometheusQueryPresetId`가 자동 클리어되지 않음 — UI에서 `KERNEL`/`INFERENCE_FRAMEWORK`일 때 preset 필드를 숨기는 것으로 처리
91
+
-`metricSource`를 `KERNEL`로 변경해도 `prometheusQueryPresetId`가 자동 클리어되지 않음 — UI에서 `PROMETHEUS`가 아닐 때 preset 필드를 숨기는 것으로 처리
85
92
86
93
### 선택 (Nice to Have)
87
94
@@ -91,136 +98,68 @@ Prometheus Preset 모드(>=26.4.0)에서 메트릭 설정 form item의 `extra`
91
98
92
99
-`timeRange` 없이 instant query로 호출하여 현재 값 1개를 표시
93
100
- 로딩 스피너 → 결과값 텍스트 + 새로고침 아이콘 버튼
94
-
-`options` 파라미터(`ExecuteQueryDefinitionOptionsInput`)로 `filterLabels`/`groupLabels` 전달
95
-
-`groupLabels`는 빈 배열 `[]`이라도 반드시 전달해야 함 (생략 시 validation error)
96
-
-`filterLabels`의 `key`는 preset의 `options.filterLabels`에 정의된 것만 허용됨
101
+
-`options` 파라미터(`ExecuteQueryDefinitionOptionsInput`)로 `filterLabels: []`, `groupLabels: []`를 고정 전달 (현재 구현은 빈 배열 고정, 동적 레이블 필터링은 미지원)
0 commit comments