minor code sync (#12403)

This commit is contained in:
Lianmin Zheng
2025-10-30 12:49:31 -07:00
committed by GitHub
parent 4d2f17bd0b
commit 6a63a9852e
4 changed files with 32 additions and 27 deletions
+3 -3
View File
@@ -870,13 +870,13 @@ class TokenizerMetricsCollector:
def check_time_to_first_token_straggler(self, value: float) -> bool:
his = self.histogram_time_to_first_token.labels(**self.labels)
total_observations = sum(bucket._value for bucket in his._buckets)
if total_observations < 1000:
if total_observations < 100:
return False
p999_threshold = total_observations * 0.999
p99_threshold = total_observations * 0.99
cumulative_count = 0
for i, bucket in enumerate(his._buckets):
cumulative_count += bucket._value
if cumulative_count > p999_threshold:
if cumulative_count > p99_threshold:
return value >= his._upper_bounds[i]
return False