Skip to content

fix(monitoring): name each embedding backend in the savings bars #5932

Done

Description

@dan-petty

Update 2026-11-26 (infra move): The gateway config is in dan-petty/homelab now.

This item keeps the product part: devops ai gateway render sets model_info.id on each embedding deployment, with its test, and the panel query of k8s/devops/dashboards/ai-spend.json names each such bar by model_id. The new render of the tracked config is the homelab follow-up, after the release.

Follow-up: dan-petty/homelab#304.


Problem

The panel "Local savings by backend server: USD per hour" of k8s/devops/dashboards/ai-spend.json shows one bar for each Kubernetes service of an in-cluster Ollama (#5914). It takes the service name from the api_base that litellm_deployment_total_requests_total gives each deployment (model_id).

LiteLLM gives the two embedding deployments of k8s/llm/gateway/config.yaml (dan-petty/homelab) (ollama-24gib-embed-gpu0 and ollama-24gib-embed-gpu1) no api_base on any of its series. Live Prometheus on 2026-11-16 shows this for all 27 litellm_ series names of the two model_ids. So the panel names both by their model, qwen3-embedding:0.6b, in one bar. The owner requirement of 2026-11-16 asks for one series for each embedding backend.

Expected behavior

The panel shows one bar for ollama-24gib-embed-gpu0 and one for ollama-24gib-embed-gpu1.

Possible ways

  • Give each deployment of the gateway config a fixed model_info.id that names its service, so model_id names the backend. The render of devops ai gateway render writes the embedding deployments.
  • Find why LiteLLM sets no api_base for an Ollama embedding call, and fix it upstream.

Source: #5931

Alternatives check of 2026-11-24: in-use.
The repository already uses this tool.
Tool: BerriAI/litellm (https://github.com/BerriAI/litellm), NOASSERTION, last activity 2026-11-24, maintained.
Reason: Searches found no alternative tool; the gateway the project already runs, LiteLLM, labels each deployment with a model_id taken from model_info.id, so a fixed per-deployment id gives each embedding backend its own bar.

Covers:

  • Per-deployment model_id label on its request metrics
  • model_info.id sets the deployment name in the config
  • Lets the panel keep grouping by model_id alone

Lacks:

  • No api_base label on Ollama embedding series
  • No Kubernetes service label on the metric
  • Does not write the rendered gateway config itself

Proposed design

Problem statement

The panel "Local savings by backend server: USD per hour" shows one bar for both Ollama embedding deployments. LiteLLM sets no api_base on their series, so the panel names both bars by the model qwen3-embedding:0.6b. This item sets a fixed model_info.id on each embedding deployment in devops ai gateway render, with its test. It also makes the panel name each embedding bar by model_id. The tracked config lives in dan-petty/homelab, so its re-render stays with dan-petty/homelab#304 after the release.

Acceptance criteria

Requirement: Embedding deployment id

The gateway render SHALL set model_info.id to the service name on each Ollama embedding deployment.

Scenario: Render names each embedding deployment

  • WHEN uv run pytest tests/ai/test_ai_gateway_render.py -k embedding_model_info_id runs
  • THEN The test passes and each rendered embedding deployment has a model_info.id equal to the service name of its api_base host.

Requirement: Panel bar name

The local savings by backend server panel SHALL name each bar by the service name from api_base when the series has one, and by model_id when it does not.

Scenario: Panel query falls back to model id

  • WHEN uv run devops ci --check --only k8s runs
  • THEN The k8s check passes with the panel query of k8s/devops/dashboards/ai-spend.json labelling each bar from api_base, else from model_id.

Existing Tool Considered

BerriAI/litellm, verdict in-use (alternatives check of 2026-11-24 in the issue body). The block records what LiteLLM covers and lacks: it sets model_id from model_info.id, but sets no api_base on Ollama embedding series and carries no Kubernetes service label. The render writes the model_info.id that LiteLLM does not write. The panel takes the bar name from model_id when api_base is empty, so the missing labels do not matter.

Key questions

  • Which label names each local savings bar?: Use the api_base host when the series has one, and model_id when it does not. (best practice) [sources: k8s/devops/dashboards/ai-spend.json, src/devops_cli/ai/pool_load.py]
    • Chosen: model_id with an api_base fallback. LiteLLM keeps model_id on the embedding token and request series and sets no api_base there.
    • Rejected: api_base only. The embedding series have no api_base, so both deployments merge in one bar.
    • Rejected: litellm_model_name. Both embedding deployments share the model name, so their bars merge again.
  • Which value does the render put in model_info.id?: The Kubernetes service name of the deployment, taken from the host of its api_base. (best practice) [sources: src/devops_cli/ai/gateway_render.py, tests/ai/test_ai_gateway_render.py, tests/fixtures/k8s_environment/llm/gateway/config.yaml]
    • Chosen: Service name from the api_base host. The panel already takes the service name from that host, so each embedding deployment gets its own bar.
    • Rejected: The model name. Both embedding deployments share the model name, so the bars merge again.
    • Rejected: A hand-written id per deployment. The render derives the id from the config, so there is no second list to keep.
  • Does devops ai gateway render write the embedding deployments?: Yes. The command renders the gateway config, and the render writes the embedding deployments with the chat deployments. [sources: src/devops_cli/ai/gateway_render.py, src/devops_cli/commands/ai_gateway.py, tests/ai/test_ai_gateway_render.py]
  • Which part of this item does the product repository deliver?: The render code with its test, and the panel query. The tracked config k8s/llm/gateway/config.yaml is in dan-petty/homelab, so its re-render stays with dan-petty/homelab#304 after the release. (best practice) [sources: k8s/devops/dashboards/ai-spend.json, src/devops_cli/ai/gateway_render.py, tests/fixtures/k8s_environment/llm/gateway/config.yaml]
    • Chosen: Product render and panel only. The tracked config is not in this repository, and homelab#304 tracks its re-render.
    • Rejected: Also change the tracked config here. The file is in dan-petty/homelab, so this repository cannot change it.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. dan-petty commented on Nov 16, 2026

    @dan-petty
    OwnerAuthor
  2. added
    type/bug
    source/agent
    status/new
    value/medium
    effort/low
    scope/monitoring
    priority/p2-medium
    on Nov 16, 2026
  3. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (10)

    Tools considered:

    Searches run:

    • LiteLLM prometheus metrics model_id label model_info id deployment, results: 5
    • litellm_deployment_total_requests_total api_base label empty ollama embedding, results: 5
    • litellm prometheus metrics "api_base" label deployment model_info, results: 5
    • litellm docs prometheus metrics labels litellm_deployment_total_requests_total, results: 5
    • BerriAI litellm github model_info id deployment naming metrics, results: 5
    • LiteLLM prometheus metrics documentation, results: 5
    • "litellm" prometheus metric deployment api_base label, results: 5
    • ollama embedding litellm api_base not set metrics per deployment, results: 5
    • litellm, results: 5
    • litellm prometheus, results: 5

    Sources:

  4. added
    status/ready
    and removed
    status/new
    on Nov 18, 2026
  5. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 97bb46c (see proposed design in issue body).

  6. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  7. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 29, 2026
  8. removed
    status/in-review
    owner/agent
    on Nov 29, 2026
  9. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-29 16:17 UTC

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/monitoringsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions