فهرست مقاله
اگر گزارشِ تأخیر فقط شمارِ درخواستهای کوچکتر یا مساویِ چند مرز را نگه دارد، مقدارِ دقیقِ صدک همیشه بازیابی نمیشود. پرسشِ مفید این است که با همین اطلاعات چه بازهای را میتوان با اطمینانِ منطقی گزارش کرد. این درس شمارندههای تجمعیِ ساختگی را ادغام میکند و بازهٔ ممکنِ یک آمارِ ترتیبی را مییابد. بازه، نتیجهٔ اطلاعاتِ ازدسترفته است؛ فاصلهٔ اطمینانِ آماری یا تضمینِ تأخیرِ درخواستهای آینده نیست. هیچ سرویس یا زمانسنجی اجرا نمیشود.
از نمونهٔ دقیق تا شمارندهٔ تجمعی چه چیزی گم میشود؟

در درسِ صدکِ تأخیر همهٔ نمونهها حاضر بودند و نزدیکترین رتبه یا درونیابی را مستقیماً محاسبه میکردیم. اینجا ورودی، خودِ نمونهها نیست: هر سطل میگوید چند مشاهده از مرزش کوچکتر یا مساویاند. برای مرزهای ده، بیست و پنجاه میلیثانیه، مشاهدهٔ هفت هم در شمارندهٔ ده حضور دارد، هم بیست و هم پنجاه. جمعِ این سه شمارنده، تعدادِ مشاهدههای یکتا نیست.
راهنمای رسمیِ هیستوگرامهای Prometheus معنای تجمعیِ سطل و محدودیتِ دقتِ صدک را توضیح میدهد. آن راهنما در کاربردِ مناسب، هیستوگرامِ بومی را ترجیح میدهد؛ مثالِ حاضر پیشنهادِ مهاجرت یا تنظیمِ ابزار نیست. فقط خلاصهای شبیه هیستوگرامِ کلاسیک را بازبینی میکنیم. مقادیر، عددِ صحیحِ نامنفی با واحدِ میلیثانیهاند؛ انتخابِ واحدِ آموزشی، توصیهای برای نامگذاری یا واحدِ انتشارِ معیار در Prometheus نیست.
شمارندهٔ مرزِ بیست، جایِ مشاهدهها را در فاصلهٔ ده تا بیست نشان نمیدهد. ممکن است همه نزدیکِ یازده باشند یا نزدیکِ بیست. شمارِ سطل یکسان میماند، ولی آمارِ ترتیبی تغییر میکند. در درسِ فاصلهٔ Wasserstein محلِ دقیق و وزنِ هر نقطه را داشتیم؛ نرمالسازیِ مستقلِ دو توزیع و محاسبهٔ فاصله، مسئلهٔ دیگری بود. اینجا شمارشها را برای یک جمعیت ادغام میکنیم.
ادغام فقط با مرزهای یکسان و شمارشِ سازگار

هر ورودی سه جزء دارد: تاپلِ مرزها، تاپلِ شمارندههای تجمعی و شمارِ کلِ گزارششده. آخرین مرز باید None باشد؛ آن را نمادِ سطلِ مثبتِ بینهایت میگیریم. شمارندهٔ آخر باید دقیقاً با شمارِ کل برابر باشد. این نمایش، فایلِ خروجیِ هیچ سامانهای را تجزیه نمیکند؛ همهٔ دادهها مستقیم و تألیفی وارد برنامه میشوند.
یک تا چهار خلاصه میپذیریم. هرکدام یک تا شش مرزِ متناهیِ صحیح از صفر تا دههزار دارد؛ مرزها باید اکیداً افزایشی و در تمامِ خلاصهها یکسان باشند. مرزِ تکراری، مرزِ میانیِ None، شمارِ منفی یا کاهشی، نوعِ بولی و ناسازگاریِ شمارِ کل رد میشوند. شمارِ هر خلاصه حداکثر ۶۴ و جمعیتِ ادغامشده حداکثر ۲۵۶ است. تمامِ دسته پیش از جمعکردن اعتبارسنجی میشود؛ مولد نیز بهجای تاپل پذیرفته و مصرف نمیشود.
این سقفها قراردادِ محدودِ مثالاند. بهویژه دههزار، سقفِ مرزِ قابلِ تنظیم است و سقفِ مشاهدهٔ پنهان نیست. مشاهدهای بسیار بزرگتر میتواند در سطلِ پایانی قرار بگیرد. همترازیِ پنجرهٔ مشاهده نیز پیشفرضِ دادهٔ ورودی است؛ برنامه ساعت، بازنشانیِ شمارنده یا نرخ را بررسی نمیکند. جمعکردنِ دو تصویر از یک شمارنده در دو زمان، لزوماً ادغامِ دو جمعیتِ جدا نیست.
در شاهدِ دستی، دو خلاصه بهترتیب شمارندههای یک، سه، چهار، چهار و دو، دو، سه، چهار دارند. شمارشِ ادغامشده سه، پنج، هفت، هشت است و جمعیت هشت میشود. صفرهای اضافی یا تکرارِ شمارندهٔ تجمعی مجازند: میگویند بینِ دو مرز مشاهدهای نبوده است. این با تکرارِ خودِ مرزها فرق دارد.
رتبه را به بازهٔ ممکن تبدیل کنیم، نه عددِ ساختگی

احتمالِ درخواستی، دقیقاً Fraction و در بازهٔ بزرگتر از صفر تا یک است؛ مخرجِ سادهشده نباید از صد بیشتر باشد. طبق مستندِ Fraction، ساختنِ کسر از دو عددِ صحیح، نسبتِ دقیقِ آنها را نگه میدارد. این رابط float یا رشته را تبدیل نمیکند. رتبهٔ یکمبنایی را سقفِ q ضربدر N میگیریم و با صورت و مخرجِ صحیح حساب میکنیم؛ برای سهچهارمِ هشت، رتبه شش است.
نخستین شمارندهای که به رتبه برسد، سطلِ آن مشاهده را تعیین میکند. در شاهدِ هشتقلمی، شمارِ تجمعیِ بیست برابر پنج است و هنوز به شش نرسیده؛ شمارِ پنجاه برابر هفت است. بنابراین مقدارِ عضوِ ششم از بیست بزرگتر و از پنجاه کوچکتر یا مساوی است. چون دامنهٔ ما میلیثانیهٔ صحیح است، بازهٔ بستهٔ ۲۱ تا ۵۰ به دست میآید. برای دامنهٔ پیوسته، کرانِ چپِ همین سطل باز بود.
دو دادهٔ خام این ناتعیینی را آشکار میکنند. گروههای چهار، یازده، نوزده، بیستویک و پنج، نه، بیستویک، نود همان دو خلاصه را میسازند؛ عضوِ ششمِ مجموع، بیستویک است. اگر دو بیستویک را پنجاه کنیم، همهٔ شمارندهها ثابت میمانند، اما عضوِ ششم پنجاه میشود. پس هیچ عددِ یکتایی از این خلاصهها نتیجه نمیشود و هر دو سرِ بازه دستیافتنیاند.
کرانها در این قرارداد تیزند: با قرار دادنِ تمامِ اعضای سطلِ انتخابشده در هر عددِ صحیحِ مجازِ آن، مقدارِ همان رتبه میتواند آن عدد باشد؛ جمعیتِ سطلهای دیگر عوض نمیشود. در سطلِ اول، نامنفیبودن کرانِ چپِ صفر میدهد. در سطلِ پایانی، فقط کرانِ چپ داریم؛ upper_ms برابر null است. جایگزینیِ آن با آخرین مرزِ متناهی، دقتِ ساختگی میسازد.
تابعِ histogram_quantile در Prometheus برای سطلِ کلاسیک درونیابی میکند و حالتهای مرزیِ خودش را دارد. کدِ ما پیادهسازیِ آن تابع نیست: بازهٔ ممکنِ آمارِ ترتیبیِ صحیح را گزارش میکند و در ورودیِ ناسازگار، ترمیمِ خاموش انجام نمیدهد. برای جمعیتِ صفر نیز رتبه و بازه null میشوند؛ صفر میلیثانیه جایِ «تعریفنشده» نمینشیند.
کدِ محدود و مرجعِ مستقلِ شاهدهای خام

فایلِ زیر را با نام histogram_quantile_bounds.py ذخیره کنید. Python استاندارد کافی است. خروجیِ کامل شاملِ خلاصهها، دو شاهدِ خام، بازهٔ سرریز و نتیجهٔ اصلاحِ مرزهاست. چهارده گروهِ نامدار، معنیِ سطل، رتبهٔ دقیق، اعتبارسنجی، دادهٔ تهی، ادغام و حفظِ ورودی را جدا بررسی میکنند؛ تعدادِ ورودیهای خانوادهٔ متناهی، تعدادِ گروهها نیست.
"""Sharp integer-ms quantile bounds from supplied cumulative histograms.
Own finite snapshot contract, not PromQL histogram_quantile interpolation.
No service measurements, timestamps, counter rates or Prometheus execution.
"""
from fractions import Fraction
from itertools import combinations_with_replacement
import json
import platform
import sys
def checked_snapshots(snapshots, q):
"""Validate the entire immutable batch before any count aggregation."""
if type(q) is not Fraction or not 0 < q <= 1 or q.denominator > 100:
raise ValueError('exact_Fraction_0_lt_q_le1_denominator_le100')
if type(snapshots) is not tuple or not 1 <= len(snapshots) <= 4:
raise ValueError('exact_tuple_one_to_four_snapshots')
common = None
for snapshot in snapshots:
if type(snapshot) is not tuple or len(snapshot) != 3:
raise ValueError('snapshot_exact_triple_bounds_counts_reported_total')
bounds, counts, total = snapshot
if type(bounds) is not tuple or not 2 <= len(bounds) <= 7:
raise ValueError('one_to_six_finite_bounds_plus_None')
if bounds[-1] is not None:
raise ValueError('last_bound_None_encodes_positive_infinity')
finite = bounds[:-1]
if any(type(x) is not int or not 0 <= x <= 10000 for x in finite):
raise ValueError('finite_bounds_exact_nonnegative_int_ms_le10000')
if any(a >= b for a, b in zip(finite, finite[1:])):
raise ValueError('finite_bounds_strictly_increasing_no_duplicates')
if type(counts) is not tuple or len(counts) != len(bounds):
raise ValueError('exact_count_tuple_matches_all_bounds')
if any(type(c) is not int or not 0 <= c <= 64 for c in counts):
raise ValueError('cumulative_counts_exact_int_0_to64')
if any(a > b for a, b in zip(counts, counts[1:])):
raise ValueError('cumulative_counts_nondecreasing_no_repair')
if type(total) is not int or not 0 <= total <= 64:
raise ValueError('reported_total_exact_int_0_to64')
if counts[-1] != total:
raise ValueError('positive_infinity_count_must_equal_reported_total')
if common is not None and bounds != common:
raise ValueError('all_snapshots_need_identical_boundary_schema')
common = bounds
return common
def quantile_bounds(snapshots, q):
"""Return the sharp feasible interval under nonnegative INTEGER ms."""
bounds = checked_snapshots(snapshots, q)
cumulative = tuple(sum(row[1][i] for row in snapshots)
for i in range(len(bounds)))
total = sum(row[2] for row in snapshots)
if total == 0:
rank, interval = None, None
else:
rank = (q.numerator * total + q.denominator - 1) // q.denominator
index = next(i for i, count in enumerate(cumulative) if count >= rank)
lower = 0 if index == 0 else bounds[index - 1] + 1
upper = bounds[index]
interval = {'lower_ms': lower, 'upper_ms': upper,
'lower_inclusive': True, 'upper_inclusive': upper is not None}
return {'unit': 'ms', 'domain': 'nonnegative_integer_milliseconds',
'q_ratio': (q.numerator, q.denominator), 'rank1': rank,
'total': total, 'boundaries_ms': bounds,
'pooled_cumulative_counts': cumulative, 'interval': interval}
def fixture_snapshot(raw, bounds):
"""Convenience only for hand-authored valid fixtures, not the oracle."""
return (bounds, tuple(sum(x <= b for x in raw) if b is not None else len(raw)
for b in bounds), len(raw))
def witness_oracle_family():
"""Direct raw-multiset ranks grouped by observed count signatures.
No production merger, checker, bucket search or fixture helper is called
while constructing the reference. The finite alphabet covers every value
of each FINITE bin, but does not purport to cover an unbounded overflow.
"""
signatures = {}
raw_profiles = raw_quantile_cases = 0
probabilities = ((1, 4), (1, 2), (3, 4), (1, 1))
for size in range(1, 6):
for raw in combinations_with_replacement(range(7), size):
signature = (sum(x <= 1 for x in raw), sum(x <= 3 for x in raw),
sum(x <= 5 for x in raw), size)
raw_profiles += 1
for numerator, denominator in probabilities:
rank = next(k for k in range(1, size + 1)
if denominator * k >= numerator * size)
value = raw[rank - 1]
key = (signature, numerator, denominator)
if key not in signatures:
signatures[key] = [value, value]
else:
signatures[key][0] = min(signatures[key][0], value)
signatures[key][1] = max(signatures[key][1], value)
raw_quantile_cases += 1
exact_finite_endpoints = overflow_lower = True
finite_comparisons = overflow_comparisons = 0
for (counts, numerator, denominator), (smallest, largest) in signatures.items():
result = quantile_bounds((((1, 3, 5, None), counts, counts[-1]),),
Fraction(numerator, denominator))
interval = result['interval']
if interval['upper_ms'] is None:
overflow_lower = overflow_lower and interval['lower_ms'] == smallest == 6
overflow_comparisons += 1
else:
exact_finite_endpoints = exact_finite_endpoints and (
interval['lower_ms'] == smallest and interval['upper_ms'] == largest)
finite_comparisons += 1
return {'passed': bool(exact_finite_endpoints and overflow_lower),
'raw_multisets': raw_profiles, 'raw_quantile_cases': raw_quantile_cases,
'distinct_histogram_quantile_signatures': len(signatures),
'finite_endpoint_comparisons': finite_comparisons,
'overflow_lower_comparisons': overflow_comparisons,
'oracle_scope': 'finite alphabet0..6, sizes1..5; no global proof or finite overflow upper bound'}
def rejected(snapshots, q=Fraction(3, 4)):
try:
quantile_bounds(snapshots, q)
except ValueError:
return True
return False
def run_example():
bounds = (10, 20, 50, None)
snapshots = ((bounds, (1, 3, 4, 4), 4), (bounds, (2, 2, 3, 4), 4))
q = Fraction(3, 4)
result = quantile_bounds(snapshots, q)
low_raw = ((4, 11, 19, 21), (5, 9, 21, 90))
high_raw = ((4, 11, 19, 50), (5, 9, 50, 90))
low_summary = tuple(fixture_snapshot(raw, bounds) for raw in low_raw)
high_summary = tuple(fixture_snapshot(raw, bounds) for raw in high_raw)
overflow_low = fixture_snapshot((4, 11, 19, 51), bounds)
overflow_high = fixture_snapshot((4, 11, 19, 10**9), bounds)
overflow = quantile_bounds((overflow_high,), Fraction(1))
zero = quantile_bounds(((bounds, (0, 0, 0, 0), 0),), q)
zero_width_first = quantile_bounds((((0, None), (2, 3), 3),), Fraction(2, 3))
skipped_empty_bins = quantile_bounds((((0, 10, 20, None), (0, 0, 1, 1), 1),), q)
class IntChild(int):
pass
class TupleChild(tuple):
pass
class FractionChild(Fraction):
pass
invalid = (
(), [], 'histogram', TupleChild(snapshots), snapshots * 3,
((),), ((bounds, (1, 3, 4, 4)),), ([bounds, (1, 3, 4, 4), 4],),
((list(bounds), (1, 3, 4, 4), 4),),
(((None,), (0,), 0),), (((0, 1, 2, 3, 4, 5, 6, None), (0,) * 8, 0),),
(((-1, None), (0, 0), 0),), (((10001, None), (0, 0), 0),),
(((True, None), (0, 0), 0),), (((1.0, None), (0, 0), 0),),
(((IntChild(1), None), (0, 0), 0),),
((bounds, [1, 3, 4, 4], 4),), ((bounds, (1, 3, 4), 4),),
((bounds, (True, 3, 4, 4), 4),), ((bounds, (1.0, 3, 4, 4), 4),),
((bounds, (-1, 3, 4, 4), 4),), ((bounds, (1, 3, 4, 65), 65),),
((bounds, (IntChild(1), 3, 4, 4), 4),),
((bounds, (1, 3, 4, 4), True),), ((bounds, (1, 3, 4, 4), 4.0),),
((bounds, (1, 3, 4, 4), -1),), ((bounds, (1, 3, 4, 4), 65),),
((bounds, (1, 3, 4, 4), IntChild(4)),),
)
consumed = []
def raw_generator():
consumed.append(True)
yield snapshots[0]
generator_rejected = rejected(raw_generator()) and consumed == []
mismatch = ((bounds, (1, 3, 4, 4), 4), ((10, 21, 50, None), (2, 2, 3, 4), 4))
bad_schemas = ((((10, 10, None), (1, 2, 2), 2),),
(((20, 10, None), (1, 2, 2), 2),),
(((10, None, 50, None), (1, 2, 3, 3), 3),),
(((10, 20, 50, 100), (1, 2, 3, 3), 3),), mismatch)
bad_cumulative = (((bounds, (2, 1, 4, 4), 4),),
((bounds, (1, 3, 4, 4), 3),),
((bounds, (1, 3, 4, 3), 3),))
bad_q = (0, 1, True, 0.75, '3/4', Fraction(0), Fraction(-1, 2),
Fraction(101, 100), Fraction(1, 101), FractionChild(3, 4))
pooled_raw = low_raw[0] + low_raw[1]
repartitioned = tuple(fixture_snapshot(part, bounds)
for part in (pooled_raw[:1], pooled_raw[1:4], pooled_raw[4:]))
scaled = tuple((schema, tuple(2 * c for c in counts), 2 * total)
for schema, counts, total in snapshots)
refined_bounds = (10, 20, 30, 50, None)
raw = ((4, 11, 19, 40), (5, 9, 30, 90))
refined = quantile_bounds(tuple(fixture_snapshot(part, refined_bounds) for part in raw), q)
oracle = witness_oracle_family()
before = snapshots
changed = quantile_bounds(snapshots, q)
changed['interval']['lower_ms'] = -999
maximum = quantile_bounds(tuple(((0, 1, 2, 3, 4, 10000, None),
(0, 0, 0, 0, 0, 64, 64), 64)
for _ in range(4)), Fraction(1))
checks = {
'manual_aligned_cumulative_merge_does_not_sum_nested_buckets':
result['pooled_cumulative_counts'] == (3, 5, 7, 8)
and result['total'] == 8 and result['rank1'] == 6
and result['interval'] == {'lower_ms': 21, 'upper_ms': 50,
'lower_inclusive': True, 'upper_inclusive': True},
'exact_rank_at_cumulative_boundary_then_next_rank_changes_bucket':
quantile_bounds(snapshots, Fraction(5, 8))['interval']['upper_ms'] == 20
and result['interval']['lower_ms'] == 21,
'same_histogram_two_raw_witnesses_attain_both_finite_endpoints':
low_summary == high_summary == snapshots
and sorted(pooled_raw)[5] == 21
and sorted(high_raw[0] + high_raw[1])[5] == 50,
'overflow_is_not_clamped_and_has_no_finite_upper_bound':
overflow_low == overflow_high
and overflow['interval'] == {'lower_ms': 51, 'upper_ms': None,
'lower_inclusive': True, 'upper_inclusive': False}
and overflow['rank1'] == 4,
'zero_total_is_undefined_instead_of_an_invented_zero_quantile':
zero['rank1'] is None and zero['interval'] is None and zero['total'] == 0,
'schemas_repeated_bounds_missing_infinity_and_mismatch_rejected':
all(rejected(value) for value in bad_schemas),
'cumulative_decrease_and_infinity_total_mismatch_rejected_strictly':
all(rejected(value) for value in bad_cumulative),
'full_shape_exact_types_caps_and_generator_nonconsumption_ONE_group':
all(rejected(value) for value in invalid) and generator_rejected,
'exact_Fraction_quantile_contract_and_smallest_allowed_probability':
all(rejected(snapshots, value) for value in bad_q)
and quantile_bounds(snapshots, Fraction(1, 100))['rank1'] == 1,
'replica_reordering_and_raw_repartition_preserve_pooled_result':
quantile_bounds(tuple(reversed(snapshots)), q) == result
and quantile_bounds(repartitioned, q) == result,
'uniform_count_replication_preserves_interval_not_statistical_confidence':
quantile_bounds(scaled, q)['interval'] == result['interval']
and quantile_bounds(scaled, q)['total'] == 16,
'compatible_boundary_refinement_narrows_the_possible_interval':
refined['interval']['lower_ms'] == 21 and refined['interval']['upper_ms'] == 30
and refined['interval']['upper_ms'] < result['interval']['upper_ms'],
'independent_raw_multiset_endpoint_oracle_ONE_finite_family':
oracle['passed'] and oracle['raw_multisets'] == 791
and oracle['raw_quantile_cases'] == 3164
and oracle['distinct_histogram_quantile_signatures'] == 500,
'first_zero_boundary_empty_bins_resource_endpoints_and_fresh_outputs':
zero_width_first['interval']['lower_ms'] == zero_width_first['interval']['upper_ms'] == 0
and skipped_empty_bins['interval']['lower_ms'] == 11
and skipped_empty_bins['interval']['upper_ms'] == 20
and maximum['total'] == 256 and maximum['interval']['upper_ms'] == 10000
and snapshots == before and quantile_bounds(snapshots, q) == result
and changed['interval']['lower_ms'] == -999 and result['unit'] == 'ms',
}
assert len(checks) == 14 and all(type(v) is bool and v for v in checks.values()), checks
return {'python': platform.python_version(), 'implementation': platform.python_implementation(),
'dependencies': 'Python standard library only',
'scope': 'Sharp feasible nonnegative integer-ms quantile intervals from supplied aligned cumulative counts; not PromQL interpolation or a confidence interval.',
'manual_fixture': {'snapshots': snapshots, 'result': result,
'low_raw_witnesses_ms': low_raw, 'high_raw_witnesses_ms': high_raw,
'raw_nearest_rank_witness_values_ms': [21, 50]},
'overflow_fixture': {'identical_histogram': overflow_high,
'raw_max_witness_values_ms': [51, 10**9], 'result': overflow},
'empty_population_result': zero, 'refined_result': refined,
'finite_family_in_ONE_group': oracle,
'invalid_shape_type_cap_cases_in_ONE_group': len(invalid) + 1,
'limits': {'replicas': [1, 4], 'finite_boundaries': [1, 6],
'boundary_integer_ms': [0, 10000], 'counts_and_reported_total_per_replica': [0, 64],
'pooled_total_at_most': 256, 'q': 'exact Fraction,0<q<=1,normalized denominator<=100',
'raw_observation_value_upper_cap': None,
'provided_window_alignment': 'external precondition; no timestamps inspected'},
'actual_internal_or_service_GETs': 0, 'prometheus_or_PromQL_executed': False,
'statistical_confidence_or_future_latency_guarantee': False,
'checks': checks}
if __name__ == '__main__':
text = json.dumps(run_example(), ensure_ascii=True, indent=2, allow_nan=False) + '\n'
sys.stdout.buffer.write(text.encode('utf-8'))
مرجعِ مستقل، چندمجموعههای خامِ مرتب از صفر تا شش با طولِ یک تا پنج را میسازد. برای هر ورودی، شمارشِ مستقیمِ کوچکتر یا مساوی و مقایسهٔ صحیحِ رتبه به کار میرود؛ مرجع از اعتبارسنج، ادغامکننده یا جستوجوی سطلِ اصلی جواب نمیگیرد. سپس کمینه و بیشینهٔ مقدارهای واقعی را برای هر خلاصه و احتمال جمع میکند. این خانواده همهٔ عددهای سطلهای متناهیِ انتخابشده را پوشش میدهد، اما آزمونِ متناهی، برهانِ تمامِ ورودیهای ممکن نیست.
{
"python": "3.14.5",
"implementation": "CPython",
"dependencies": "Python standard library only",
"scope": "Sharp feasible nonnegative integer-ms quantile intervals from supplied aligned cumulative counts; not PromQL interpolation or a confidence interval.",
"manual_fixture": {
"snapshots": [
[
[
10,
20,
50,
null
],
[
1,
3,
4,
4
],
4
],
[
[
10,
20,
50,
null
],
[
2,
2,
3,
4
],
4
]
],
"result": {
"unit": "ms",
"domain": "nonnegative_integer_milliseconds",
"q_ratio": [
3,
4
],
"rank1": 6,
"total": 8,
"boundaries_ms": [
10,
20,
50,
null
],
"pooled_cumulative_counts": [
3,
5,
7,
8
],
"interval": {
"lower_ms": 21,
"upper_ms": 50,
"lower_inclusive": true,
"upper_inclusive": true
}
},
"low_raw_witnesses_ms": [
[
4,
11,
19,
21
],
[
5,
9,
21,
90
]
],
"high_raw_witnesses_ms": [
[
4,
11,
19,
50
],
[
5,
9,
50,
90
]
],
"raw_nearest_rank_witness_values_ms": [
21,
50
]
},
"overflow_fixture": {
"identical_histogram": [
[
10,
20,
50,
null
],
[
1,
3,
3,
4
],
4
],
"raw_max_witness_values_ms": [
51,
1000000000
],
"result": {
"unit": "ms",
"domain": "nonnegative_integer_milliseconds",
"q_ratio": [
1,
1
],
"rank1": 4,
"total": 4,
"boundaries_ms": [
10,
20,
50,
null
],
"pooled_cumulative_counts": [
1,
3,
3,
4
],
"interval": {
"lower_ms": 51,
"upper_ms": null,
"lower_inclusive": true,
"upper_inclusive": false
}
}
},
"empty_population_result": {
"unit": "ms",
"domain": "nonnegative_integer_milliseconds",
"q_ratio": [
3,
4
],
"rank1": null,
"total": 0,
"boundaries_ms": [
10,
20,
50,
null
],
"pooled_cumulative_counts": [
0,
0,
0,
0
],
"interval": null
},
"refined_result": {
"unit": "ms",
"domain": "nonnegative_integer_milliseconds",
"q_ratio": [
3,
4
],
"rank1": 6,
"total": 8,
"boundaries_ms": [
10,
20,
30,
50,
null
],
"pooled_cumulative_counts": [
3,
5,
6,
7,
8
],
"interval": {
"lower_ms": 21,
"upper_ms": 30,
"lower_inclusive": true,
"upper_inclusive": true
}
},
"finite_family_in_ONE_group": {
"passed": true,
"raw_multisets": 791,
"raw_quantile_cases": 3164,
"distinct_histogram_quantile_signatures": 500,
"finite_endpoint_comparisons": 357,
"overflow_lower_comparisons": 143,
"oracle_scope": "finite alphabet0..6, sizes1..5; no global proof or finite overflow upper bound"
},
"invalid_shape_type_cap_cases_in_ONE_group": 29,
"limits": {
"replicas": [
1,
4
],
"finite_boundaries": [
1,
6
],
"boundary_integer_ms": [
0,
10000
],
"counts_and_reported_total_per_replica": [
0,
64
],
"pooled_total_at_most": 256,
"q": "exact Fraction,0<q<=1,normalized denominator<=100",
"raw_observation_value_upper_cap": null,
"provided_window_alignment": "external precondition; no timestamps inspected"
},
"actual_internal_or_service_GETs": 0,
"prometheus_or_PromQL_executed": false,
"statistical_confidence_or_future_latency_guarantee": false,
"checks": {
"manual_aligned_cumulative_merge_does_not_sum_nested_buckets": true,
"exact_rank_at_cumulative_boundary_then_next_rank_changes_bucket": true,
"same_histogram_two_raw_witnesses_attain_both_finite_endpoints": true,
"overflow_is_not_clamped_and_has_no_finite_upper_bound": true,
"zero_total_is_undefined_instead_of_an_invented_zero_quantile": true,
"schemas_repeated_bounds_missing_infinity_and_mismatch_rejected": true,
"cumulative_decrease_and_infinity_total_mismatch_rejected_strictly": true,
"full_shape_exact_types_caps_and_generator_nonconsumption_ONE_group": true,
"exact_Fraction_quantile_contract_and_smallest_allowed_probability": true,
"replica_reordering_and_raw_repartition_preserve_pooled_result": true,
"uniform_count_replication_preserves_interval_not_statistical_confidence": true,
"compatible_boundary_refinement_narrows_the_possible_interval": true,
"independent_raw_multiset_endpoint_oracle_ONE_finite_family": true,
"first_zero_boundary_empty_bins_resource_endpoints_and_fresh_outputs": true
}
}
در شاهدِ سرریز، دو مقدارِ ۵۱ و یکمیلیارد همان خلاصه را میسازند؛ نبودِ کرانِ بالای متناهی از تعریفِ دامنه میآید، نه از رسیدنِ آزمون به بزرگترین عدد. محیطِ اجرا Python 3.14.5 است و مستندِ Python 3.14.8 جدا ثبت میشود. سه دامنهٔ فنی در ۲۱ اکتبرِ ۲۰۲۶ کامل خوانده و ذخیره شدهاند؛ انتشارِ اولیهٔ صفحاتِ زنده معلوم نیست. دو پیوندِ زمینهای از موجودیِ موفقِ ساعتِ ۰۹:۰۰ همان روز انتخاب و متن و کدِ محلیشان کامل خوانده شدهاند؛ بررسیِ HTTP تازهٔ آنها هنوز معلق است.
چهار پرسش دربارهٔ دقت، سرریز و گزارشِ نتیجه

پرسشِ اول: در شاهدِ اصلی، اگر احتمال را پنجهشتم بگیریم، چرا بازهٔ ۲۱ تا ۵۰ درست نیست؟ پاسخ: رتبه پنج میشود و شمارندهٔ مرزِ بیست دقیقاً به پنج رسیده است. بنابراین عضوِ پنجم در سطلِ بزرگتر از ده تا بیست قرار دارد؛ در دامنهٔ صحیح، بازهٔ ۱۱ تا ۲۰ درست است. برابریِ شمارنده و رتبه، ما را به سطلِ بعدی نمیبرد.
پرسشِ دوم: آیا ثبتِ عددِ ۳۵ برای صدکِ سهچهارم از همان خلاصهها، مقدارِ خامِ بازیابیشده است؟ پاسخ: خیر؛ ممکن است برآوردی با فرضِ اضافی باشد، اما دو شاهدِ خامِ ۲۱ و ۵۰ نشان میدهند خلاصهها عددِ یکتا را تعیین نمیکنند. باید روشِ تخمین و فرضِ درونِ سطل جدا گزارش شود؛ بازهٔ این برنامه آن فرض را اضافه نمیکند.
پرسشِ سوم: اگر رتبه داخلِ سطلِ پایانی افتاد، آیا سقفِ مرزِ مجازِ دههزار، کرانِ بالای صدک است؟ پاسخ: خیر؛ آن سقف فقط تنظیمِ مرزها را محدود میکند. دادهٔ پنهان سقف ندارد و عددی بزرگتر همچنان همان سطل را پر میکند. خروجیِ null یعنی کرانِ بالای متناهی نداریم، نه اینکه مقدارِ مشاهده صفر یا نامعتبر بوده است.
پرسشِ چهارم: آیا افزودنِ مرزِ مشترکِ سی به دادهٔ خامِ مناسب، همواره همان دقتِ قبلی را نگه میدارد؟ پاسخ: اطلاعاتِ سازگارِ بیشتر نمیتواند مجموعهٔ مقدارهای ممکن را بزرگتر کند. در شاهدِ کد، رتبهٔ ششم از بازهٔ ۲۱ تا ۵۰ به ۲۱ تا ۳۰ محدود میشود. این افزایشِ دقتِ خلاصه است؛ دادهٔ تازه یا تضمینِ آماریِ تازه تولید نمیکند.
منابع و مطالعهٔ بیشتر
بررسی منابع: ۲۹ مهر ۱۴۰۵. تحلیلها و پیشنهادهای اجرایی، جمعبندی نویسندهاند.

