def linear_buckets(start: float, step: float, end: float) -> tuple[float, ...]:
    """
    Creates buckets of a Prometheus histogram where the lowest bucket has an upper
    bound of start and the upper bound of each following bucket is the previous
    buckets upper bound plus step. The return tuple include the end as the second
    last value and positive infinity as the last value.
    """

    assert start > 0.0
    assert start < end
    assert step > 0.0

    bound = start
    buckets: list[float] = []
    while bound < end:
        buckets.append(bound)
        bound += step

    if len(buckets) > MAX_BUCKET_COUNT:
        buckets = buckets[:MAX_BUCKET_COUNT]

    return tuple(buckets) + (end, INF)
Creates buckets of a Prometheus histogram where the lowest bucket has an upper
bound of start and the upper bound of each following bucket is the previous
buckets upper bound plus step. The return tuple include the end as the second
last value and positive infinity as the last value.
src/bentoml/_internal/utils/metrics.py