You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(first of all this feels like a faq, but google tells me it isn't. Sorry if indeed it is)
I have happily instrumented some of my code with ddtrace.tracer.wrap.
But when I try to run pytest unit tests against that code, the tests pass, but on tear-down the test-runner complains of not being able to submit traces like below.
How can I inhibit this behavior when running tests?
thanks
-- johan
Traceback (most recent call last):
File "/Users/johan.ovlinger/.pyenv/versions/3.10.14/lib/python3.10/logging/__init__.py", line 1103, in emit
stream.write(msg + self.terminator)
ValueError: I/O operation on closed file.
Call stack:
File "/Users/johan.ovlinger/Projects/venvs/opp_python3/lib/python3.10/site-packages/ddtrace/internal/writer/writer.py", line 412, in on_shutdown
self.periodic()
File "/Users/johan.ovlinger/Projects/venvs/opp_python3/lib/python3.10/site-packages/ddtrace/internal/writer/writer.py", line 400, in periodic
self.flush_queue(raise_exc=False)
File "/Users/johan.ovlinger/Projects/venvs/opp_python3/lib/python3.10/site-packages/ddtrace/internal/writer/writer.py", line 364, in flush_queue
self._flush_queue_with_client(client, raise_exc=raise_exc)
File "/Users/johan.ovlinger/Projects/venvs/opp_python3/lib/python3.10/site-packages/ddtrace/internal/writer/writer.py", line 389, in _flush_queue_with_client
log.error(
File "/Users/johan.ovlinger/.pyenv/versions/3.10.14/lib/python3.10/logging/__init__.py", line 1506, in error
self._log(ERROR, msg, args, **kwargs)
File "/Users/johan.ovlinger/.pyenv/versions/3.10.14/lib/python3.10/logging/__init__.py", line 1624, in _log
self.handle(record)
File "/Users/johan.ovlinger/Projects/venvs/opp_python3/lib/python3.10/site-packages/ddtrace/internal/logger.py", line 176, in handle
super(DDLogger, self).handle(record)
Message: 'failed to send, dropping %d traces to intake at %s after %d retries'
Arguments: (3, 'http://localhost:8126/v0.5/traces', 3)
EDIT python 3.10 as you see and ddtrace 2.14.2
The text was updated successfully, but these errors were encountered:
jovlinger-numerated
changed the title
Python unit test interaction with pytest: (port 8126)
Python pytest unit test interaction with ddtrace.tracer.wrap: (port 8126)
Oct 24, 2024
Taegyun,
yes. that's correct, and by design. We use datadog in production, but we
don't need it for our unit tests.
So the ask is: how can I disable the dd-trace instrumentation, while
leaving imports and span annotations in place?
thanks!
(first of all this feels like a faq, but google tells me it isn't. Sorry if indeed it is)
I have happily instrumented some of my code with
ddtrace.tracer.wrap
.But when I try to run pytest unit tests against that code, the tests pass, but on tear-down the test-runner complains of not being able to submit traces like below.
How can I inhibit this behavior when running tests?
thanks
-- johan
EDIT python 3.10 as you see and ddtrace 2.14.2
The text was updated successfully, but these errors were encountered: