lablup / lablup/backend.ai

Add scope metric catalog table, model, and seed defaults (scope_type binding)

Open
#12,604 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
15h 13m
Merged PRs (30d)
368

Description

New mapping table binding scope_type to prometheus query presets, with ordering. scope_id is NOT stored (supplied at query time).

Table scope_metric_bindings (mapping + order ONLY; query/display attributes live on the preset):
- scope_type (VARCHAR; extensible - adding a scope_type needs no code change)
- prometheus_query_preset_id (FK -> prometheus_query_presets)
- rank (int; ordering within a scope_type)

Owned by the preset, NOT duplicated on the binding: mode (instant/range) derives from the preset's time_window; unit/display options live on the preset options; viz is out of scope for now.

ScopeType = {session, kernel, agent, deployment, resource_group, domain, project, user}. Repository provides list_bindings(scope_type). Seed fixed defaults (at minimum a session set equivalent to live_stat).

Success Criteria:
- [ ] Migration creates the mapping table; pants run applies cleanly on a fresh DB
- [ ] Seed: default bindings present for the session scope after fixture import
- [ ] list_bindings(scope_type=session) returns presets in rank order
- [ ] Adding a binding row for a new scope_type requires no code change
- [ ] pants test passes for affected packages

JIRA Issue: BA-6750

Contributor guide

Open the contributing guide

Research direction

Locate the migration for the scope_metric_bindings table, the model and repository entry point for list_bindings(scope_type), the seed or fixture-import entry point, and affected package tests. Verify the fresh database migration, session defaults, rank ordering, and insertion of a new scope_type without code changes; then run the affected pants tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
prometheus, python
Domain
backend, databases, observability
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
56/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.