Skip to content

feat(metrics): fan out vikingdb collection metrics across accounts#1830

Open
arminzou wants to merge 3 commits intovolcengine:mainfrom
arminzou:feat/vikingdb-account-metrics-fanout
Open

feat(metrics): fan out vikingdb collection metrics across accounts#1830
arminzou wants to merge 3 commits intovolcengine:mainfrom
arminzou:feat/vikingdb-account-metrics-fanout

Conversation

@arminzou
Copy link
Copy Markdown

@arminzou arminzou commented Apr 30, 2026

Summary

  • Fan out VikingDB collection metrics across configured/default and api-key-managed accounts
  • Expose account_id on the VikingDB collection metric families and preserve stale semantics on per-account partial failures
  • Update the demo dashboard account_id selector to source from VikingDB metrics directly

Motivation

This replaces the earlier default-account-only approach behind #1760 with actual per-account fan-out so the account_id label is semantically accurate.

Changes

  • Add openviking_vikingdb_collection_health and openviking_vikingdb_collection_vectors to the account-dimension allowlist
  • Wire the VikingDB metrics datasource to app state so it can enumerate API-key-managed accounts
  • Read VikingDB count metrics once per account using account-scoped request contexts
  • Mark partial per-account failures as stale (valid="0") instead of exporting fresh zero-count samples
  • Reuse the last known vector count for failed-account fallback series
  • Clean up stale placeholder / old collection series correctly after recovery or label changes
  • Extend datasource and collector tests for multi-account and partial-failure behavior
  • Source the Grafana demo dashboard account_id variable from openviking_vikingdb_collection_vectors

Test Plan

  • Targeted unit tests pass (tests/metrics/collectors/test_state_collectors.py tests/metrics/datasources/test_state_datasources.py)
  • JSON validation for examples/grafana/openviking_demo_dashboard.json
  • Manual code review of datasource/collector stale semantics, recovery cleanup, and dashboard queries

Screenshots / Examples

N/A

Notes for Reviewers

/cc @qin-ctx

- allow vikingdb collection metrics to carry account_id labels
- fan out vikingdb state reads across default and api-key-managed accounts
- mark partial per-account failures stale instead of fresh zeroes
- reuse last known vectors for failed accounts in collector fallback
- cover multi-account and partial-failure behavior in tests
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 30, 2026

PR Reviewer Guide 🔍

(Review updated until commit d023efc)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis ✅

1760 - Fully compliant

Compliant requirements:

  • The PR goes beyond the original ticket to add per-account fan-out, which includes using the configured default account, adding account_id labels, and updating the collector.
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🏅 Score: 88
🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@github-actions
Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

@arminzou arminzou force-pushed the feat/vikingdb-account-metrics-fanout branch from 5c41e2a to 72b7c50 Compare April 30, 2026 15:00
@arminzou arminzou force-pushed the feat/vikingdb-account-metrics-fanout branch from 72b7c50 to d023efc Compare April 30, 2026 15:37
@arminzou arminzou marked this pull request as ready for review April 30, 2026 15:48
@github-actions
Copy link
Copy Markdown

Persistent review updated to latest commit d023efc

@github-actions
Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant