@@ -31,15 +31,15 @@ class BlockHashType(NamedTuple):
3131
3232
3333class PrefixCachingMetrics :
34- """Metrics for prefix caching with a hit rate of the most recent N requests.
34+ """Metrics for prefix caching with a hit rate of the max recent N requests.
3535
3636 Args:
37- interval : The number of the most recent requests to aggregate.
37+ max_recent_requests : The number of the max recent requests to aggregate.
3838 Defaults to 1000.
3939 """
4040
41- def __init__ (self , interval : int = 1000 ):
42- self .interval = interval
41+ def __init__ (self , max_recent_requests : int = 1000 ):
42+ self .max_recent_requests = max_recent_requests
4343 # The current aggregated values.
4444 self .aggregated_requests = 0
4545 self .aggregated_query_total = 0
@@ -54,7 +54,7 @@ def observe(self, stats: PrefixCacheStats):
5454 are being scheduled and are looking for computed blocks.
5555
5656 When there are more than `interval` requests, the oldest set of
57- requestsare removed from the metrics.
57+ requests are removed from the metrics.
5858
5959 Args:
6060 stats: The prefix cache stats.
@@ -71,7 +71,7 @@ def observe(self, stats: PrefixCacheStats):
7171 self .aggregated_query_hit += stats .hits
7272
7373 # Remove the oldest stats if the number of requests exceeds.
74- if self .aggregated_requests > self .interval :
74+ if self .aggregated_requests > self .max_recent_requests :
7575 old_requests , old_queries , old_hits = self .query_queue .popleft ()
7676 self .aggregated_requests -= old_requests
7777 self .aggregated_query_total -= old_queries
0 commit comments