Skip to content

feat(chat): update prometheus metrics name #5787

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

Merged
merged 2 commits into from
Jul 31, 2025

Conversation

nicolasvienot
Copy link
Member

Pull Request

Related issue

Fixes #5786

What does this PR do?

This PR renames chat-related counter metrics to follow Prometheus naming conventions by adding the _total suffix. This fixes the warning: "metric might not be a counter, name does not end in _total/_sum/_count/_bucket".

Changes:

  • meilisearch_chat_prompt_tokens_usagemeilisearch_chat_prompt_tokens_total
  • meilisearch_chat_completion_tokens_usagemeilisearch_chat_completion_tokens_total
  • meilisearch_chat_total_tokens_usagemeilisearch_chat_tokens_total
  • meilisearch_chat_search_requestsmeilisearch_chat_searches_total

All counter metrics now properly end with _total as required by Prometheus best practices.

Example output now:

# HELP meilisearch_chat_prompt_tokens_total Total number of prompt tokens consumed
# TYPE meilisearch_chat_prompt_tokens_total counter
meilisearch_chat_prompt_tokens_total{model="gpt-3.5-turbo",workspace="default"} 1613

# HELP meilisearch_chat_completion_tokens_total Total number of completion tokens consumed
# TYPE meilisearch_chat_completion_tokens_total counter
meilisearch_chat_completion_tokens_total{model="gpt-3.5-turbo",workspace="default"} 393

# HELP meilisearch_chat_tokens_total Total number of tokens consumed (prompt + completion)
# TYPE meilisearch_chat_tokens_total counter
meilisearch_chat_tokens_total{model="gpt-3.5-turbo",workspace="default"} 2006

# HELP meilisearch_chat_searches_total Total number of searches performed by the chat route
# TYPE meilisearch_chat_searches_total counter
meilisearch_chat_searches_total{type="internal"} 1

@nicolasvienot nicolasvienot requested a review from Kerollmops July 30, 2025 15:59
@nicolasvienot nicolasvienot added the no db change The database didn't change label Jul 30, 2025
@nicolasvienot nicolasvienot added this to the v1.16.0 milestone Jul 30, 2025
Copy link
Member

@Kerollmops Kerollmops left a comment

Choose a reason for hiding this comment

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

Looks perfect to me, thanks 🙏

@Kerollmops Kerollmops added this pull request to the merge queue Jul 31, 2025
Merged via the queue into release-v1.16.0 with commit a99538c Jul 31, 2025
11 checks passed
@Kerollmops Kerollmops deleted the chat-update-metrics-name branch July 31, 2025 08:48
@meili-bot meili-bot added the v1.16.0 PRs/issues solved in v1.16.0 released on 2025-08-04 label Aug 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no db change The database didn't change v1.16.0 PRs/issues solved in v1.16.0 released on 2025-08-04
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants