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

ci(tracer): avoids shutting down the global tracer in the main process #12235

Merged
merged 2 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions tests/tracer/test_propagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
from tests.contrib.fastapi.conftest import test_spans as fastapi_test_spans # noqa:F401
from tests.contrib.fastapi.conftest import tracer # noqa:F401

from ..utils import flaky
from ..utils import override_env
from ..utils import override_global_config

Expand Down Expand Up @@ -837,7 +836,6 @@ def test_extract_128bit_trace_ids_tracecontext():
assert child_span.trace_id == trace_id


@flaky(1735812000, reason="FIXME: Failing due to the global tracer being used in all tests")
def test_last_dd_span_id():
non_dd_remote_context = HTTPPropagator.extract(
{
Expand Down
23 changes: 3 additions & 20 deletions tests/tracer/test_tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,9 @@ def test_tracer_shutdown_timeout():
mock_stop.assert_called_once_with(2)


@pytest.mark.subprocess(
err=b"Spans started after the tracer has been shut down will not be sent to the Datadog Agent.\n",
)
def test_tracer_shutdown():
import mock

Expand All @@ -691,26 +694,6 @@ def test_tracer_shutdown():
mock_write.assert_not_called()


def test_tracer_shutdown_warning():
mabdinur marked this conversation as resolved.
Show resolved Hide resolved
import logging

import mock

from ddtrace.trace import tracer as t

t.shutdown()

with mock.patch.object(logging.Logger, "warning") as mock_logger:
with t.trace("something"):
pass

mock_logger.assert_has_calls(
[
mock.call("Spans started after the tracer has been shut down will not be sent to the Datadog Agent."),
]
)


@pytest.mark.skip(reason="Fails to Pickle RateLimiter in the Tracer")
@pytest.mark.subprocess
def test_tracer_fork():
Expand Down
Loading