Skip to content

Conversation

@tao12345666333
Copy link
Contributor

What type of PR is this?

  • metrics: add llm_model_cost_usd_total and llm_routing_reason_codes_total
  • docs: add pricing section and cost/routing metrics
  • chore: normalize config/config.yaml line endings

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #49

Release Notes: Yes/No

@github-actions
Copy link

github-actions bot commented Sep 6, 2025

👥 vLLM Semantic Team Notification

The following members have been identified for the changed files in this PR and have been automatically assigned:

📁 src

Owners: @rootfs, @Xunzhuo, @wangchen615
Files changed:

  • src/semantic-router/pkg/observability/logging.go
  • src/semantic-router/pkg/config/config.go
  • src/semantic-router/pkg/extproc/request_handler.go
  • src/semantic-router/pkg/extproc/response_handler.go
  • src/semantic-router/pkg/metrics/metrics.go

📁 config

Owners: @rootfs
Files changed:

  • config/config.yaml

📁 website

Owners: @Xunzhuo
Files changed:

  • website/docs/api/router.md
  • website/docs/getting-started/configuration.md

This comment was automatically generated based on the OWNER files in the repository.

@vllm-project vllm-project deleted a comment from netlify bot Sep 6, 2025
@tao12345666333 tao12345666333 force-pushed the feat/observability-pricing-metrics branch from e729a58 to 77aa1c2 Compare September 6, 2025 02:05
@netlify
Copy link

netlify bot commented Sep 6, 2025

Deploy Preview for vllm-semantic-router ready!

Name Link
🔨 Latest commit be20700
🔍 Latest deploy log https://app.netlify.com/projects/vllm-semantic-router/deploys/68bd702071f65b000882799b
😎 Deploy Preview https://deploy-preview-66--vllm-semantic-router.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

)

// ModelCostUSD tracks the total USD cost attributed to each model
ModelCostUSD = promauto.NewCounterVec(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should USD be a specific naming suffix for this metric?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we want to support more units a dimension in metric should be easier to extend.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your suggestion is good.
Maybe I can change the metric name to llm_model_cost_total and add a currency label. e.g. llm_model_cost_total{currency="USD"}

But a trade-off needs to be made here.

Pros:

  • Easy to extend, allowing us to add CNY, EUR, etc, in the future as needed
  • Clearer. A metric name for "cost," with currency as the dimension

Cons:

  • Aggregations must be done per-currency (sum by (currency, model) …). It’s easy to accidentally sum different currencies if you forget to filter.

WDYT? @Xunzhuo @rootfs

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the cons, maybe we should have clear docs around metrics, it is a bit bad to add more metrics when units increase linearly

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding a currency label is a good idea!

This comment was marked as outdated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created an issue for tracking.
#75

@tao12345666333 tao12345666333 force-pushed the feat/observability-pricing-metrics branch 2 times, most recently from a3aeeb2 to 9395d4c Compare September 6, 2025 12:17

import (
"encoding/json"
"log"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer zap, but I'll create an issue to see what others think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one #76

@rootfs
Copy link
Collaborator

rootfs commented Sep 6, 2025

@tao12345666333 lgtm.
@Xunzhuo this can be merged now. Additional comments can be addressed in followup PRs. WDYT?

metrics: add llm_model_cost_usd_total and llm_routing_reason_codes_total
docs: add pricing section and cost/routing metrics
chore: normalize config/config.yaml line endings

Signed-off-by: Jintao Zhang <[email protected]>
Signed-off-by: Jintao Zhang <[email protected]>
@tao12345666333 tao12345666333 force-pushed the feat/observability-pricing-metrics branch from 0e6f4f7 to be20700 Compare September 7, 2025 11:44
@rootfs rootfs merged commit 89dfce7 into vllm-project:main Sep 7, 2025
10 of 11 checks passed
@rootfs
Copy link
Collaborator

rootfs commented Sep 7, 2025

@tao12345666333 thanks for contribution, please followup with the comments.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v0.1] Observability:Structured logs and metrics

4 participants