feat(prometheus): add metrics for AI cache hits, misses, bypasses, and embedding latency#13659
Open
janiussyafiq wants to merge 1 commit into
Open
feat(prometheus): add metrics for AI cache hits, misses, bypasses, and embedding latency#13659janiussyafiq wants to merge 1 commit into
janiussyafiq wants to merge 1 commit into
Conversation
…d embedding latency
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds Prometheus metrics for the
ai-cacheplugin (#13578, #13632, #13644), integrated inprometheus/exporter.luafollowing the existingllm_*metric pattern:apisix_ai_cache_hits_total(withlayer="exact"|"semantic"),apisix_ai_cache_misses_total,apisix_ai_cache_bypasses_total— counters sharing thellm_*label set (route_id,service_id,consumer,node,request_type,request_llm_model,llm_model)apisix_ai_cache_embedding_latency— histogram of embedding-call latency in milliseconds (the issue sketched_seconds, but the exporter's latency histograms use milliseconds withDEFAULT_BUCKETS, so this follows the house convention)Semantics: Redis fail-open lookups count as MISS;
fail_mode: errorrejections record nothing; recording happens inlogphase and is a silent no-op when theprometheusplugin is disabled. Docs: label sections added toprometheus.md(en + zh).Which issue(s) this PR fixes:
Fixes #13290
Checklist