Skip to content

Commit 86fb667

Browse files
committed
chore(metrics): sync generated Python metric names
Signed-off-by: Yuting Wu (DLAlgo) <yutwu@nvidia.com>
1 parent 6daf973 commit 86fb667

1 file changed

Lines changed: 33 additions & 25 deletions

File tree

lib/bindings/python/src/dynamo/prometheus_names.py

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ class frontend_perf:
5959
TOKENIZE_SECONDS = "tokenize_seconds"
6060
# Template application time in preprocessor
6161
TEMPLATE_SECONDS = "template_seconds"
62+
# L1 tokenizer cache hits (cumulative); enabled unless DYN_TOKENIZER_CACHE=0
63+
TOKENIZER_CACHE_HITS_TOTAL = "tokenizer_cache_hits_total"
64+
# L1 tokenizer cache misses (cumulative); enabled unless DYN_TOKENIZER_CACHE=0
65+
TOKENIZER_CACHE_MISSES_TOTAL = "tokenizer_cache_misses_total"
66+
# Tokens returned from the L1 tokenizer prefix cache (cumulative, labeled by model)
67+
TOKENIZER_CACHE_CACHED_TOKENS_TOTAL = "tokenizer_cache_cached_tokens_total"
68+
# Tokens freshly encoded after an L1 tokenizer prefix-cache lookup (cumulative, labeled by model)
69+
TOKENIZER_CACHE_UNCACHED_TOKENS_TOTAL = "tokenizer_cache_uncached_tokens_total"
6270
# Cumulative detokenization time (microseconds); pair with DETOKENIZE_TOKEN_COUNT
6371
DETOKENIZE_TOTAL_US = "detokenize_total_us"
6472
# Total tokens detokenized; use rate(total_us)/rate(count) for per-token average
@@ -98,6 +106,10 @@ class frontend_service:
98106
KV_HIT_RATE = "kv_hit_rate"
99107
# Upper-bound estimation of KV cache transfer latency in disaggregated serving (seconds)
100108
KV_TRANSFER_ESTIMATED_LATENCY_SECONDS = "kv_transfer_estimated_latency_seconds"
109+
# Shared cache hit rate (0.0-1.0): fraction of request blocks found in shared cache
110+
SHARED_CACHE_HIT_RATE = "shared_cache_hit_rate"
111+
# Shared cache blocks beyond device overlap for the selected worker
112+
SHARED_CACHE_BEYOND_BLOCKS = "shared_cache_beyond_blocks"
101113
# Number of cached tokens (prefix cache hits) per request
102114
CACHED_TOKENS = "cached_tokens"
103115
# Tokenizer latency in milliseconds
@@ -112,9 +124,7 @@ class frontend_service:
112124
# Separate from `REQUEST_DURATION_SECONDS` so its buckets can be sized for
113125
# pooling-model latencies (sub-second) without sacrificing resolution.
114126
EMBEDDING_LATENCY_SECONDS = "embedding_latency_seconds"
115-
# Number of `image_url` content parts per request (histogram). Named
116-
# `images_per_request` so the auto-emitted `_sum` (cumulative image volume),
117-
# `_count` (requests observed), and `_bucket` all read naturally.
127+
# Number of `image_url` content parts per request (histogram)
118128
IMAGES_PER_REQUEST = "images_per_request"
119129
# Number of `video_url` content parts per request (histogram)
120130
VIDEOS_PER_REQUEST = "videos_per_request"
@@ -139,9 +149,7 @@ class frontend_service:
139149
MODEL_MIGRATION_TOTAL = "model_migration_total"
140150
# Total number of times migration was disabled because the sequence length
141151
# exceeded the configured max_seq_len limit
142-
MODEL_MIGRATION_MAX_SEQ_LEN_EXCEEDED_TOTAL = (
143-
"model_migration_max_seq_len_exceeded_total"
144-
)
152+
MODEL_MIGRATION_MAX_SEQ_LEN_EXCEEDED_TOTAL = "model_migration_max_seq_len_exceeded_total"
145153
# Total number of request cancellations
146154
MODEL_CANCELLATION_TOTAL = "model_cancellation_total"
147155
# Total number of requests rejected due to resource exhaustion
@@ -164,7 +172,7 @@ class frontend_service:
164172
WORKER_LAST_INTER_TOKEN_LATENCY_SECONDS = "worker_last_inter_token_latency_seconds"
165173
# Number of requests pending in the router's scheduler queue (gauge per worker_type)
166174
ROUTER_QUEUE_PENDING_REQUESTS = "router_queue_pending_requests"
167-
# Number of replicas allocated for a LoRA adapter
175+
# Number of replicas allocated for a LoRA adapter (gauge per LoRA)
168176
LORA_REPLICA_FACTOR = "lora_replica_factor"
169177
# Whether a LoRA adapter is actively receiving traffic (1=active, 0=inactive)
170178
LORA_IS_ACTIVE = "lora_is_active"
@@ -252,25 +260,17 @@ class kvindexer:
252260

253261

254262
class kvrouter:
263+
255264
# Number of KV cache events applied to the index (including status)
256265
KV_CACHE_EVENTS_APPLIED = "kv_cache_events_applied"
257266

258267

259268
class kvstats:
269+
260270
# Total number of KV cache blocks available on the worker
261271
TOTAL_BLOCKS = "total_blocks"
262272
# GPU cache usage as a percentage (0.0-1.0)
263273
GPU_CACHE_USAGE_PERCENT = "gpu_cache_usage_percent"
264-
# Prefix cache hit rate (0.0-1.0), portable across vLLM / SGLang / TRT-LLM
265-
KV_CACHE_HIT_RATE = "kv_cache_hit_rate"
266-
267-
268-
class lifecycle:
269-
"""Worker-lifecycle timing gauges. Set once per worker run by the
270-
framework, not by the engine."""
271-
272-
CLEANUP_TIME_SECONDS = "cleanup_time_seconds"
273-
DRAIN_TIME_SECONDS = "drain_time_seconds"
274274

275275

276276
class labels:
@@ -304,6 +304,7 @@ class labels:
304304

305305

306306
class model_info:
307+
307308
# Model load time in seconds
308309
LOAD_TIME_SECONDS = "model_load_time_seconds"
309310

@@ -328,6 +329,9 @@ class name_prefix:
328329
TRANSPORT = "dynamo_transport"
329330
# Prefix for work-handler transport breakdown metrics (backend side)
330331
WORK_HANDLER = "dynamo_work_handler"
332+
# Prefix for request admission/rejection control metrics (e.g.
333+
# `dynamo_rejection_request_total`).
334+
REJECTION = "dynamo_rejection"
331335
# Prefix for tokio runtime metrics (poll times, queue depths, stalls).
332336
TOKIO = "dynamo_tokio"
333337
# Prefix for per-phase routing overhead latency (hashing, scheduling).
@@ -376,13 +380,13 @@ class router:
376380
# Predicted cached tokens on the worker selected by the router
377381
SELECTED_CACHED_TOKENS_TOTAL = "router_selected_cached_tokens_total"
378382
# Best cached tokens among workers eligible after overload filtering
379-
ELIGIBLE_ORACLE_CACHED_TOKENS_TOTAL = (
380-
"router_eligible_oracle_cached_tokens_total"
381-
)
383+
ELIGIBLE_ORACLE_CACHED_TOKENS_TOTAL = "router_eligible_oracle_cached_tokens_total"
382384
# Best cached tokens among allowed workers before overload filtering
383-
RESIDENT_ORACLE_CACHED_TOKENS_TOTAL = (
384-
"router_resident_oracle_cached_tokens_total"
385-
)
385+
RESIDENT_ORACLE_CACHED_TOKENS_TOTAL = "router_resident_oracle_cached_tokens_total"
386+
# Shared cache hit rate (0.0-1.0): fraction of request blocks found in shared cache
387+
SHARED_CACHE_HIT_RATE = "router_shared_cache_hit_rate"
388+
# Shared cache blocks beyond device overlap for the selected worker
389+
SHARED_CACHE_BEYOND_BLOCKS = "router_shared_cache_beyond_blocks"
386390
# Whether the router currently has a worker/dp_rank registered (1 = registered)
387391
WORKER_REGISTERED = "router_worker_registered"
388392

@@ -408,6 +412,10 @@ class routing_overhead:
408412
SCHEDULING_MS = "overhead_scheduling_ms"
409413
# Total routing overhead per request
410414
TOTAL_MS = "overhead_total_ms"
415+
# Time spent querying the shared KV cache (Mooncake)
416+
SHARED_CACHE_QUERY_MS = "overhead_shared_cache_query_ms"
417+
# Total shared cache query errors (timeouts, HTTP failures)
418+
SHARED_CACHE_ERRORS_TOTAL = "shared_cache_errors_total"
411419

412420

413421
class task_tracker:
@@ -500,8 +508,8 @@ class work_handler:
500508
# Configured capacity of the bounded work queue (gauge, static)
501509
QUEUE_CAPACITY = "queue_capacity"
502510
# Total times enqueuing work failed because the dispatcher channel was closed.
503-
# tokio bounded mpsc applies backpressure on full — saturation shows up as
504-
# rising QUEUE_DEPTH toward QUEUE_CAPACITY.
511+
# Note: tokio bounded mpsc applies backpressure on full — it does NOT increment
512+
# this counter. Saturation shows up as rising `QUEUE_DEPTH` toward `QUEUE_CAPACITY`.
505513
ENQUEUE_REJECTED_TOTAL = "enqueue_rejected_total"
506514
# Time spent waiting to acquire a worker-pool permit (histogram)
507515
PERMIT_WAIT_SECONDS = "permit_wait_seconds"

0 commit comments

Comments
 (0)