prometheus / prometheus/client_python

TestGauge::test_time_block_decorator_with_label failure

Open
#942 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
4.4k
Forks
876
Avg merge
8d 4h
Merged PRs (30d)
1

Description

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!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tests/test_core.py:255 and the TestGauge.test_time_block_decorator_with_label test. Reproduce the failure on the reported alpha platform with Python 3.10 or 3.11, then inspect the complete 41y0768.log and the gauge timing behavior. Done means the platform-specific cause is identified and the test passes without regressing the reported behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.