Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flask instrumentation flaky test #2596

Closed
emdneto opened this issue Jun 11, 2024 · 2 comments · Fixed by #2645
Closed

flask instrumentation flaky test #2596

emdneto opened this issue Jun 11, 2024 · 2 comments · Fixed by #2645
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@emdneto
Copy link
Member

emdneto commented Jun 11, 2024

instrumentations-0 (pypy3, flask, ubuntu-20.04)

=================================== FAILURES ===================================
_______________ TestProgrammatic.test_flask_metrics_new_semconv ________________

self = <tests.test_programmatic.TestProgrammatic testMethod=test_flask_metrics_new_semconv>

    def test_flask_metrics_new_semconv(self):
        start = default_timer()
        self.client.get("/hello/123")
        self.client.get("/hello/321")
        self.client.get("/hello/756")
        duration = max(round((default_timer() - start) * 1000), 0)
        metrics_list = self.memory_metrics_reader.get_metrics_data()
        number_data_point_seen = False
        histogram_data_point_seen = False
        self.assertTrue(len(metrics_list.resource_metrics) != 0)
        for resource_metric in metrics_list.resource_metrics:
            self.assertTrue(len(resource_metric.scope_metrics) != 0)
            for scope_metric in resource_metric.scope_metrics:
                self.assertTrue(len(scope_metric.metrics) != 0)
                for metric in scope_metric.metrics:
                    self.assertIn(metric.name, _expected_metric_names_new)
                    data_points = list(metric.data.data_points)
                    self.assertEqual(len(data_points), 1)
                    for point in data_points:
                        if isinstance(point, HistogramDataPoint):
                            self.assertEqual(point.count, 3)
>                           self.assertAlmostEqual(
                                duration, point.sum, delta=10
                            )
E                           AssertionError: 17 != 0.011322596000013618 within 10 delta (16.988677403999986 difference)

Steps to reproduce
Describe exactly how to reproduce the error. Include a code sample if applicable.
Run tox -f pypy3-flask

What is the expected behavior?
test pass everytime

What did you see instead?
test is flaky

Additional context
Add any other context about the problem here.

@emdneto emdneto added the bug Something isn't working label Jun 11, 2024
@emdneto emdneto changed the title flask flaky test flask instrumentation flaky test Jun 11, 2024
@xrmx xrmx added the good first issue Good for newcomers label Jun 13, 2024
@rahulhacker
Copy link
Contributor

@emdneto @xrmx
Please assign the issue to me if the issue is still open

@xrmx
Copy link
Contributor

xrmx commented Jun 18, 2024

@rahulhacker looking forward for your PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants