-
Notifications
You must be signed in to change notification settings - Fork 275
feat(observability): structured JSON logs and event fields #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(observability): structured JSON logs and event fields #66
Conversation
👥 vLLM Semantic Team NotificationThe following members have been identified for the changed files in this PR and have been automatically assigned: 📁
|
e729a58 to
77aa1c2
Compare
✅ Deploy Preview for vllm-semantic-router ready!
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( |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
This comment was marked as outdated.
Sorry, something went wrong.
There was a problem hiding this comment.
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
a3aeeb2 to
9395d4c
Compare
|
|
||
| import ( | ||
| "encoding/json" | ||
| "log" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this is time to pick a logging pkg, e.g. https://betterstack.com/community/guides/logging/best-golang-logging-libraries/
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one #76
|
@tao12345666333 lgtm. |
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]>
Signed-off-by: Jintao Zhang <[email protected]>
0e6f4f7 to
be20700
Compare
|
@tao12345666333 thanks for contribution, please followup with the comments. |
What type of PR is this?
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #49
Release Notes: Yes/No