prometheus / prometheus/client_python

TestGauge::test_time_block_decorator_with_label failure

未关闭
#942 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
4.4k
派生
876
平均合并
8 天 4 小时
30 天内合并 PR
1

描述

Hi, I am running the test suite on some obscure architectures and observed a failure on alpha, with one test:

========================================================================= FAILURES =========================================================================
______________________________________________________ TestGauge.test_time_block_decorator_with_label ______________________________________________________

self = <tests.test_core.TestGauge testMethod=test_time_block_decorator_with_label>

    def test_time_block_decorator_with_label(self):
        value = self.registry.get_sample_value
        self.assertEqual(None, value('g2', {'label1': 'foo'}))
        with self.gauge_with_label.time() as metric:
            metric.labels('foo')
>       self.assertLess(0, value('g2', {'label1': 'foo'}))
E       AssertionError: 0 not less than 0.0

metric     = <prometheus_client.context_managers.Timer object at 0x20007441790>
self       = <tests.test_core.TestGauge testMethod=test_time_block_decorator_with_label>
value      = <bound method CollectorRegistry.get_sample_value of <prometheus_client.registry.CollectorRegistry object at 0x20007441310>>

tests/test_core.py:255: AssertionError

This is fully reproducible, and I tested on both python3.10 and python3.11 with same results.

Complete log: 41y0768.log

Any help on why this test could be failing? I know this is an unusual platform, so I can provide shell access to the machine in question if somebody would mind taking a look. I can also interactively debug, or test patches as needed.

Thank you!

贡献指南

打开贡献指南

从这里开始

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

调研方向

从 tests/test_core.py:255 和 TestGauge.test_time_block_decorator_with_label 测试开始。使用 Python 3.10 或 3.11 在报告的 alpha 平台上重现该失败,然后检查完整的 41y0768.log 和 gauge 的计时行为。当确定了平台特有的原因,并且测试通过且没有使报告的行为发生回归时,即视为完成。

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

评估

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

把新 issue 发到你的邮箱

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