Skip to content

Question on mapping authorized_calls metrics to a user #434

@nerdalert

Description

@nerdalert

This is a general question around looking into how to use Kuardrant in a chargeback scenario. The need is being able to match an authorized call from a limitador perspective to a user ID.

The current metrics are namespace scoped like so:

# HELP limited_calls Limited calls
# TYPE limited_calls counter
limited_calls{limitador_namespace="llm-d/qwen-qwen3-0-6b"} 13
# HELP authorized_calls Authorized calls
# TYPE authorized_calls counter
authorized_calls{limitador_namespace="llm-d/qwen-qwen3-0-6b"} 2

Refining them further down to a call to ID mapping allows for an accurate scrape of authorized calls that will allow for a clear usage. Scraping the same from Authorino would give you that mapping but Authorino doesn't have an awareness of calls that are limited (from a cursory code review, maybe Im wrong which would be fantastic).

As an example, I patched limitador to include (limited_calls || authorized_calls) to user ID, allowing for accurate usage tracking and come away with:

# HELP authorized_calls Authorized calls
# TYPE authorized_calls counter
authorized_calls{limitador_namespace="llm-d/ms-sim-llm-d-modelservice",user="premiumuser2"} 10
authorized_calls{limitador_namespace="llm-d/ms-sim-llm-d-modelservice",user="premiumuser1"} 10
authorized_calls{limitador_namespace="llm-d/ms-sim-llm-d-modelservice",user="freeuser1"} 4

Code for the above metrics nerdalert/limitador

I'm sure there are plenty of issues around cardinality and separation of concerns with that approach, but I'm out of ideas on how to make this use case work otherwise.

More details/context on the use case here redhat-et/kuadrant-llm-integration.

Thanks for any ideas, they are very much appreciated. Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions