Skip to content

Commit

Permalink
🐛 fix prometheus metric labels (#27)
Browse files Browse the repository at this point in the history
This fixes a miss where I had seen usages of `.labels` `**`a dictionary
into kwargs, and I accidentally passed a raw dictionary as a value
instead of using keyword arguments 🤦. This caused metrics to show eg.
`method="{'method':'prefill'}"` instead of `method=prefill`

Signed-off-by: Joe Runde <[email protected]>
  • Loading branch information
joerunde authored May 14, 2024
1 parent 21fb852 commit 2e81ed2
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions vllm/tgis_utils/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def observe_queue_time(self, engine_output: RequestOutput):
engine_output.metrics.time_in_queue)

def count_request_failure(self, reason: FailureReasonLabel):
self.tgi_request_failure.labels({"err": reason}).inc(1)
self.tgi_request_failure.labels(err=reason).inc(1)


class TGISStatLogger(StatLogger):
Expand Down Expand Up @@ -120,13 +120,11 @@ def log(self, stats: Stats) -> None:
self.tgi_batch_current_size.set(stats.num_running_sys)

for ttft in stats.time_to_first_tokens_iter:
self.tgi_batch_inference_duration.labels({
"method": "prefill"
}).observe(ttft)
self.tgi_batch_inference_duration.labels(
method="prefill").observe(ttft)
for tpot in stats.time_per_output_tokens_iter:
self.tgi_batch_inference_duration.labels({
"method": "next_token"
}).observe(tpot)
self.tgi_batch_inference_duration.labels(
method="next_token").observe(tpot)

for input_len in stats.num_prompt_tokens_requests:
self.tgi_request_input_length.observe(input_len)
Expand Down

0 comments on commit 2e81ed2

Please sign in to comment.