Skip to content

Attempt to fix test_urls_excluded_from_sampling #158

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

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import json
import logging
import os
import time
from importlib import reload
from logging import getLogger
from unittest import TestCase
Expand Down Expand Up @@ -186,7 +187,11 @@ def test_urls_excluded_from_sampling(self):
except requests.exceptions.RequestException:
pass

timeout = time.time() + 1
span_list = memory_exporter.get_finished_spans()
while len(span_list) != 1 and timeout > time.time():
span_list = memory_exporter.get_finished_spans()
time.sleep(0.1)
self.assertEqual(1, len(span_list))
span_http_url = span_list[0].attributes.get("http.url")
self.assertEqual(span_http_url, "http://this_is_a_fake_url:3849/GetSamplingRules")
Expand All @@ -196,7 +201,11 @@ def test_urls_excluded_from_sampling(self):
except requests.exceptions.RequestException:
pass

timeout = time.time() + 1
span_list = memory_exporter.get_finished_spans()
while len(span_list) != 2 and timeout > time.time():
span_list = memory_exporter.get_finished_spans()
time.sleep(0.1)
self.assertEqual(2, len(span_list))
span_http_url = span_list[1].attributes.get("http.url")
self.assertEqual(span_http_url, "http://this_is_a_fake_url:3849/SamplingTargets")
Expand Down