Skip to content
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
48 changes: 24 additions & 24 deletions tests/integration/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,33 +326,33 @@ def test_metrics_partial_flush_disabled(encoding, monkeypatch):
@allencodings
def test_single_trace_too_large(encoding, monkeypatch):
monkeypatch.setenv("DD_TRACE_API_VERSION", encoding)
# setting writer interval to 5 seconds so that buffer can fit larger traces
monkeypatch.setenv("DD_TRACE_WRITER_INTERVAL_SECONDS", "10.0")

t = Tracer()
assert t._partial_flush_enabled is True
with mock.patch("ddtrace.internal.writer.writer.log") as log:
key = "a" * 250
with t.trace("huge"):
for i in range(200000):
with t.trace("operation") as s:
# Need to make the strings unique so that the v0.5 encoding doesn’t compress the data
s.set_tag(key + str(i), key + str(i))
t.shutdown()
assert (
mock.call(
"trace buffer (%s traces %db/%db) cannot fit trace of size %db, dropping (writer status: %s)",
AnyInt(),
AnyInt(),
AnyInt(),
AnyInt(),
AnyStr(),
)
in log.warning.mock_calls
), log.mock_calls[
:20
] # limits number of logs, this test could generate hundreds of thousands of logs.
log.error.assert_not_called()
# This test asserts that a BufferFull exception is raised. We need to ensure the encoders queue is not flushed
# while trace chunks are being queued.
with mock.patch.object(AgentWriter, "flush_queue", return_value=None):
with mock.patch("ddtrace.internal.writer.writer.log") as log:
key = "a" * 250
with t.trace("huge"):
for i in range(30000):
with t.trace("operation") as s:
# Need to make the strings unique so that the v0.5 encoding doesn’t compress the data
s.set_tag(key + str(i), key + str(i))
assert (
mock.call(
"trace buffer (%s traces %db/%db) cannot fit trace of size %db, dropping (writer status: %s)",
AnyInt(),
AnyInt(),
AnyInt(),
AnyInt(),
AnyStr(),
)
in log.warning.mock_calls
), log.mock_calls[
:20
] # limits number of logs, this test could generate hundreds of thousands of logs.
log.error.assert_not_called()


@allencodings
Expand Down