Skip to content

proxy: add excludeFromMetrics option to hide models from activity stats#678

Open
mytbk wants to merge 1 commit into
mostlygeek:mainfrom
mytbk:model-hidden-metrics
Open

proxy: add excludeFromMetrics option to hide models from activity stats#678
mytbk wants to merge 1 commit into
mostlygeek:mainfrom
mytbk:model-hidden-metrics

Conversation

@mytbk

@mytbk mytbk commented Apr 20, 2026

Copy link
Copy Markdown

Add excludeFromMetrics field to ModelConfig that allows excluding a model's requests from appearing in the /ui/#/activity page and metrics API.

  • adds excludeFromMetrics boolean config option (default: false)
  • filters excluded models in apiGetMetrics endpoint
  • filters excluded models in SSE events
  • adds documentation in configuration.md

Co-authored-by: opencode (minimax-m2.5-free)

@coderabbitai

coderabbitai Bot commented Apr 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8a66dbeb-1622-435b-a492-c20858dc5468

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This PR introduces a metrics exclusion feature by adding an ExcludeFromMetrics configuration option to models. The implementation spans documentation, model configuration struct updates, and filtering logic to prevent specified models' metrics from appearing in activity endpoints and metrics responses.

Changes

Cohort / File(s) Summary
Configuration Documentation
docs/configuration.md
Added example model configuration "qwen-hidden-metrics" demonstrating the new excludeFromMetrics: true setting alongside model launch command.
Model Configuration Struct
proxy/config/model_config.go
Added ExcludeFromMetrics bool field with YAML tag to ModelConfig struct; updated UnmarshalYAML defaults to initialize the new field to false.
Metrics Filtering Logic
proxy/proxymanager_api.go
Introduced filterExcludedMetrics() method to exclude metrics entries for models with ExcludeFromMetrics=true; integrated filtering into apiSendEvents() and apiGetMetrics() to prevent excluded metrics from appearing in SSE payloads and metrics endpoint responses.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding an excludeFromMetrics option to hide models from activity stats, which is the core feature across all modified files.
Description check ✅ Passed The description is directly related to the changeset, detailing the new excludeFromMetrics field, its default value, filtering implementations in endpoints, and documentation updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/configuration.md`:
- Around line 403-410: The docs entry for the "qwen-hidden-metrics" model only
mentions hiding requests from /ui/#/activity but the implementation also filters
the metrics API; update the prose for the excludeFromMetrics field under the
"qwen-hidden-metrics" block to state that when excludeFromMetrics: true the
model will be excluded from both the SSE activity stream (/ui/#/activity) and
the metrics API (GET /api/metrics), so users understand it affects both
surfaces.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 989627d9-913b-4cd0-b1b9-e682a2040016

📥 Commits

Reviewing files that changed from the base of the PR and between 231e622 and e7daaa0.

📒 Files selected for processing (3)
  • docs/configuration.md
  • proxy/config/model_config.go
  • proxy/proxymanager_api.go

Comment thread docs/configuration.md
Comment on lines +403 to +410
# Exclude model from metrics example:
"qwen-hidden-metrics":
# excludeFromMetrics: boolean, true or false
# - optional, default: false
# - when true, requests to this model will not appear in /ui/#/activity
# - useful for hiding test or internal models from usage statistics
excludeFromMetrics: true
cmd: llama-server --port ${PORT} -m Qwen3-4B-Q4_K_M.gguf -ngl 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Mention that this also affects the metrics API.

The implementation filters both SSE activity and GET /api/metrics, but Line 407 only documents /ui/#/activity. Add the API endpoint so users understand the full behavior.

Suggested docs tweak
-    # - when true, requests to this model will not appear in /ui/#/activity
+    # - when true, requests to this model will not appear in /ui/#/activity or /api/metrics
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Exclude model from metrics example:
"qwen-hidden-metrics":
# excludeFromMetrics: boolean, true or false
# - optional, default: false
# - when true, requests to this model will not appear in /ui/#/activity
# - useful for hiding test or internal models from usage statistics
excludeFromMetrics: true
cmd: llama-server --port ${PORT} -m Qwen3-4B-Q4_K_M.gguf -ngl 0
# Exclude model from metrics example:
"qwen-hidden-metrics":
# excludeFromMetrics: boolean, true or false
# - optional, default: false
# - when true, requests to this model will not appear in /ui/#/activity or /api/metrics
# - useful for hiding test or internal models from usage statistics
excludeFromMetrics: true
cmd: llama-server --port ${PORT} -m Qwen3-4B-Q4_K_M.gguf -ngl 0
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/configuration.md` around lines 403 - 410, The docs entry for the
"qwen-hidden-metrics" model only mentions hiding requests from /ui/#/activity
but the implementation also filters the metrics API; update the prose for the
excludeFromMetrics field under the "qwen-hidden-metrics" block to state that
when excludeFromMetrics: true the model will be excluded from both the SSE
activity stream (/ui/#/activity) and the metrics API (GET /api/metrics), so
users understand it affects both surfaces.

Add excludeFromMetrics field to ModelConfig that allows excluding a model's
requests from appearing in the /ui/#/activity page and metrics API.

- adds excludeFromMetrics boolean config option (default: false)
- filters excluded models in apiGetMetrics endpoint
- filters excluded models in SSE events
- adds documentation in configuration.md

---

Co-authored-by: opencode (minimax-m2.5-free)
@mytbk mytbk force-pushed the model-hidden-metrics branch from e7daaa0 to 4b91f85 Compare May 21, 2026 05:56
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.

1 participant