Skip to content

feat(metric): add token-full-cycle metric#1488

Merged
MaojiaSheng merged 5 commits intovolcengine:mainfrom
baojun-zhang:metric-optimize
Apr 16, 2026
Merged

feat(metric): add token-full-cycle metric#1488
MaojiaSheng merged 5 commits intovolcengine:mainfrom
baojun-zhang:metric-optimize

Conversation

@baojun-zhang
Copy link
Copy Markdown
Collaborator

@baojun-zhang baojun-zhang commented Apr 16, 2026

Description

add token full-cycle metric && support token dashboard && optimize metric guide && deprecated 'server.telemetry.prometheus.enabled' configuration && change metric config to observability.metric

Related Issue

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • add token full-lifecycle metric
  • support token demo dashboard
  • optimize metric guide
  • deprecated 'server.telemetry.prometheus.enabled' configuration
  • change metric config to observability.metric
  • refactor metric test

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

image

Additional Notes

server.telemetry.prometheus.enabled deprecated . using server.observability.metric.enable instead.

…&& optimize metric guide && deprecated 'server.telemetry.prometheus.enabled' configuration && change metric config to observability.metric
…&& optimize metric guide && deprecated 'server.telemetry.prometheus.enabled' configuration && change metric config to observability.metric
@github-actions
Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🏅 Score: 70
🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 Multiple PR themes

Sub-PR theme: Add rerank metrics collector and integration

Relevant files:

  • openviking/metrics/collectors/rerank.py
  • openviking/models/rerank/base.py
  • openviking/models/rerank/volcengine_rerank.py
  • openviking/models/rerank/cohere_rerank.py
  • openviking/models/rerank/litellm_rerank.py
  • tests/metrics/collectors/test_event_collectors.py

Sub-PR theme: Add token dashboard and update metrics documentation

Relevant files:

  • examples/grafana/openviking_token_demo_dashboard.json
  • docs/en/concepts/12-metrics.md
  • docs/zh/concepts/12-metrics.md
  • docs/en/guides/05-observability.md
  • docs/zh/guides/05-observability.md

Sub-PR theme: Migrate metrics config to observability.metric and deprecate old path

Relevant files:

  • openviking/server/config.py
  • examples/ov.conf.example
  • openviking/metrics/global_api.py
  • tests/metrics/config/test_server_config.py

⚡ Recommended focus areas for review

Critical Logic Bug

The receive_hook method unconditionally calls record_inflight after handling http.request, which will process http.request payloads as inflight events. This causes errors when accessing payload["value"] (which doesn't exist for http.request events) and breaks HTTP metrics collection.

self.record_inflight(
    registry,
    route=str(payload["route"]),
    value=float(payload["value"]),
    account_id=payload.get("account_id"),
)
Silent Exception Swallowing

The update_token_usage method uses a bare except Exception: block that swallows all exceptions without logging. This hides potential errors in metrics reporting and makes debugging difficult.

except Exception:
    # Metrics must never break embedding execution.
    pass

@github-actions
Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

@MaojiaSheng MaojiaSheng merged commit 629fc24 into volcengine:main Apr 16, 2026
6 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenViking project Apr 16, 2026
@baojun-zhang baojun-zhang deleted the metric-optimize branch April 16, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants