[Bug]: [Python] HistogramResult.p95 raises AttributeError because Histogram has no p95()

未关闭
#41,709 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

@leninworld 已经在做这个了。

开始于 2026年11月27日。

  • #41710 来自 @leninworld —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
python
领域
data

调研方向

The issue identifies sdks/python/apache_beam/metrics/cells.py and apache_beam.utils.histogram.Histogram. Read the percentile properties and the existing p50(), p90() and p99() methods, then run the relevant Python histogram and metrics tests. Done when HistogramResult.p95 returns the interpolated 95th percentile and the tests cover it; pull request #41710 is already open.

由索引模型根据 Issue 内容生成。

描述

P2 python
What happened?

HistogramResult.p95 in sdks/python/apache_beam/metrics/cells.py returns self.data.histogram.p95(), but apache_beam.utils.histogram.Histogram only defines p50(), p90() and p99(). Reading .p95 on a histogram metric result therefore raises AttributeError, while .p90 and .p99 work.

Reproduction
from apache_beam.metrics.cells import HistogramData, HistogramResult
from apache_beam.utils.histogram import Histogram, LinearBucket

histogram = Histogram(LinearBucket(0, 1, 100))
histogram.record(*range(100))
result = HistogramResult(HistogramData(histogram))
print(result.p90, result.p99)  # 90.0 99.0
print(result.p95)
# AttributeError: 'Histogram' object has no attribute 'p95'. Did you mean: 'p90'?

Seen on master (f168ee3f6def2e8cf325d40337c3796375366806), Python 3.12.

Expected

result.p95 returns the linearly interpolated 95th percentile, like p90/p99 (95.0 here).

Issue Priority

Priority: 2 (default / most bugs should be filed as P2)

Issue Components
  • Component: Python SDK
主要语言
Java
星标
8.7k
派生
4.8k
平均合并
3 天 16 小时
30 天内合并 PR
445

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/beam 的其他 Issue

查看 apache/beam 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。