Skip to content
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

fix stats #17

Merged
merged 1 commit into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 16 additions & 18 deletions vllm/tgis_utils/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,21 +116,19 @@ def log(self, stats: Stats) -> None:
self._vllm_stat_logger.log(stats)

# Then log TGIS specific ones
self.tgi_queue_size.set(stats.num_waiting + stats.num_swapped)
self.tgi_batch_current_size.set(stats.num_running)

for ttft in stats.time_to_first_tokens:
self.tgi_batch_inference_duration.labels({
"method": "prefill"
}).observe(ttft)
for tpot in stats.time_per_output_tokens:
self.tgi_batch_inference_duration.labels({
"method": "next_token"
}).observe(tpot)

# These metrics depend on open PR: https://github.com/vllm-project/vllm/pull/2764
if hasattr(stats, "num_prompt_tokens_lst"):
for input_len in stats.num_prompt_tokens_lst:
self.tgi_request_input_length.observe(input_len)
for output_len in stats.num_generation_tokens_lst:
self.tgi_request_generated_tokens.observe(output_len)
self.tgi_queue_size.set(stats.num_waiting_sys + stats.num_swapped_sys)
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)
for tpot in stats.time_per_output_tokens_iter:
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)
for output_len in stats.num_generation_tokens_requests:
self.tgi_request_generated_tokens.observe(output_len)