-
Notifications
You must be signed in to change notification settings - Fork 86
RSPEED-2957: add endpoint label to LLM Prometheus metrics #1624
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,25 +29,29 @@ | |
|
|
||
| # Metric that counts how many LLM calls were made for each provider + model | ||
| llm_calls_total = Counter( | ||
| "ls_llm_calls_total", "LLM calls counter", ["provider", "model"] | ||
| "ls_llm_calls_total", "LLM calls counter", ["provider", "model", "endpoint"] | ||
| ) | ||
|
|
||
| # Metric that counts how many LLM calls failed | ||
| llm_calls_failures_total = Counter( | ||
| "ls_llm_calls_failures_total", "LLM calls failures", ["provider", "model"] | ||
| "ls_llm_calls_failures_total", | ||
| "LLM calls failures", | ||
| ["provider", "model", "endpoint"], | ||
| ) | ||
|
|
||
| # Metric that counts how many LLM calls had validation errors | ||
| llm_calls_validation_errors_total = Counter( | ||
| "ls_llm_validation_errors_total", "LLM validation errors" | ||
| "ls_llm_validation_errors_total", "LLM validation errors", ["endpoint"] | ||
| ) | ||
|
|
||
| # Metric that counts how many tokens were sent to LLMs | ||
| llm_token_sent_total = Counter( | ||
| "ls_llm_token_sent_total", "LLM tokens sent", ["provider", "model"] | ||
| "ls_llm_token_sent_total", "LLM tokens sent", ["provider", "model", "endpoint"] | ||
| ) | ||
|
|
||
| # Metric that counts how many tokens were received from LLMs | ||
| llm_token_received_total = Counter( | ||
| "ls_llm_token_received_total", "LLM tokens received", ["provider", "model"] | ||
| "ls_llm_token_received_total", | ||
| "LLM tokens received", | ||
| ["provider", "model", "endpoint"], | ||
|
Comment on lines
31
to
+56
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Centralize the allowed endpoint label values. These counters now depend on endpoint strings supplied from several call chains, so a typo or empty fallback will create a new Prometheus series silently. Please move the four supported endpoint paths behind shared constants (or an enum/Literal) and reuse them at every metric call site to preserve the bounded-cardinality guarantee. Based on learnings: Check 🤖 Prompt for AI Agents |
||
| ) | ||
Uh oh!
There was an error while loading. Please reload this page.