Skip to content

fix(llmobs): handle empty langchain chat model stream [backport 4.11]#18990

Open
dd-octo-sts[bot] wants to merge 1 commit into
4.11from
backport-18981-to-4.11
Open

fix(llmobs): handle empty langchain chat model stream [backport 4.11]#18990
dd-octo-sts[bot] wants to merge 1 commit into
4.11from
backport-18981-to-4.11

Conversation

@dd-octo-sts

@dd-octo-sts dd-octo-sts Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Backport #18981 to 4.11

## Description
Signed copy of #18610 by @anneheartrecord.

<!-- Provide an overview of the change and motivation for the change -->

## Testing

<!-- Describe your testing strategy or note what tests are included -->

## Risks

<!-- Note any risks associated with this change, or "None" if no risks -->

## Additional Notes

<!-- Any other information that would be helpful for reviewers -->

Co-authored-by: anneheartrecord <chengxisheng777@gmail.com>
Co-authored-by: yun.kim <yun.kim@datadoghq.com>
(cherry picked from commit 3978223)

Co-authored-by: Yun Kim <35776586+Yun-Kim@users.noreply.github.com>
@dd-octo-sts dd-octo-sts Bot requested review from a team as code owners July 10, 2026 20:23
@dd-octo-sts dd-octo-sts Bot requested review from brettlangdon and emmettbutler and removed request for a team July 10, 2026 20:23
@Yun-Kim Yun-Kim enabled auto-merge (squash) July 10, 2026 20:24
@cit-pr-commenter-54b7da

Copy link
Copy Markdown

Codeowners resolved as

ddtrace/llmobs/_integrations/langchain.py                               @DataDog/ml-observability
releasenotes/notes/fix-langchain-empty-chat-stream-llmobs-d35ddfc15c95dd42.yaml  @DataDog/apm-python
tests/contrib/langchain/test_langchain_llmobs.py                        @DataDog/ml-observability

@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Pipelines  Tests

Fix all issues with BitsAI

⚠️ Warnings

🚦 18 Pipeline jobs failed

System Tests | tracer-release / End-to-end #3 / flask-poc 3   View in Datadog   GitHub Actions

🧪 1 Test failed

tests.otel.test_tracing_otlp.Test_Otel_Tracing_OTLP.test_128bit_trace_id_consistent_across_spans[flask-poc] from system_tests_suite   View in Datadog
AssertionError: Found 6 span(s) in the same logical trace with a different 128-bit traceId than the server span (server traceId=6a515746000000008d4ed3eabbdd8e0c). Mismatched (span_id, trace_id_hex): [(&#39;211815c14a566495&#39;, &#39;00000000000000008d4ed3eabbdd8e0c&#39;), (&#39;9e286d580e868956&#39;, &#39;00000000000000008d4ed3eabbdd8e0c&#39;), (&#39;ab90227facdd4904&#39;, &#39;00000000000000008d4ed3eabbdd8e0c&#39;), (&#39;eb14a3a4340fa701&#39;, &#39;00000000000000008d4ed3eabbdd8e0c&#39;), (&#39;a0940ca0baff65ee&#39;, &#39;00000000000000008d4ed3eabbdd8e0c&#39;), (&#39;6ed1c6ab01007305&#39;, &#39;00000000000000008d4ed3eabbdd8e0c&#39;)]. This indicates the OTLP exporter is not propagating _dd.p.tid (high 64 bits) from the chunk root to the remaining chunk spans.
assert not [(&#39;211815c14a566495&#39;, &#39;00000000000000008d4ed3eabbdd8e0c&#39;), (&#39;9e286d580e868956&#39;, &#39;00000000000000008d4ed3eabbdd8e0c&#39;), (...&#39;), (&#39;a0940ca0baff65ee&#39;, &#39;00000000000000008d4ed3eabbdd8e0c&#39;), (&#39;6ed1c6ab01007305&#39;, &#39;00000000000000008d4ed3eabbdd8e0c&#39;)]

self = &lt;tests.otel.test_tracing_otlp.Test_Otel_Tracing_OTLP object at 0x7fe7e46b66c0&gt;

    def test_128bit_trace_id_consistent_across_spans(self):
        &#34;&#34;&#34;Validates that every span in a trace carries the same full 128-bit OTLP traceId.
    
        DD tracers emit 128-bit trace IDs by default but the v04/v05 msgpack wire format only
        carries the lower 64 bits per span; the upper 64 bits live in the \`_dd.p.tid\` meta tag,
...

System Tests | tracer-release / End-to-end #3 / uds-flask 3   View in Datadog   GitHub Actions

🧪 1 Test failed

tests.otel.test_tracing_otlp.Test_Otel_Tracing_OTLP.test_128bit_trace_id_consistent_across_spans[uds-flask] from system_tests_suite   View in Datadog
AssertionError: Found 6 span(s) in the same logical trace with a different 128-bit traceId than the server span (server traceId=6a5157320000000026c8cb31037f92d2). Mismatched (span_id, trace_id_hex): [(&#39;1922d9ee32b70e0c&#39;, &#39;000000000000000026c8cb31037f92d2&#39;), (&#39;658243ad9dd78f56&#39;, &#39;000000000000000026c8cb31037f92d2&#39;), (&#39;f5355e55597d7498&#39;, &#39;000000000000000026c8cb31037f92d2&#39;), (&#39;0cc5c22150d91e27&#39;, &#39;000000000000000026c8cb31037f92d2&#39;), (&#39;a326e255fcd25f07&#39;, &#39;000000000000000026c8cb31037f92d2&#39;), (&#39;271cd4466a394683&#39;, &#39;000000000000000026c8cb31037f92d2&#39;)]. This indicates the OTLP exporter is not propagating _dd.p.tid (high 64 bits) from the chunk root to the remaining chunk spans.
assert not [(&#39;1922d9ee32b70e0c&#39;, &#39;000000000000000026c8cb31037f92d2&#39;), (&#39;658243ad9dd78f56&#39;, &#39;000000000000000026c8cb31037f92d2&#39;), (...&#39;), (&#39;a326e255fcd25f07&#39;, &#39;000000000000000026c8cb31037f92d2&#39;), (&#39;271cd4466a394683&#39;, &#39;000000000000000026c8cb31037f92d2&#39;)]

self = &lt;tests.otel.test_tracing_otlp.Test_Otel_Tracing_OTLP object at 0x7f2a9c160a10&gt;

    def test_128bit_trace_id_consistent_across_spans(self):
        &#34;&#34;&#34;Validates that every span in a trace carries the same full 128-bit OTLP traceId.
    
        DD tracers emit 128-bit trace IDs by default but the v04/v05 msgpack wire format only
        carries the lower 64 bits per span; the upper 64 bits live in the \`_dd.p.tid\` meta tag,
...

System Tests | tracer-release / End-to-end #3 / uwsgi-poc 3   View in Datadog   GitHub Actions

🧪 1 Test failed

tests.otel.test_tracing_otlp.Test_Otel_Tracing_OTLP.test_128bit_trace_id_consistent_across_spans[uwsgi-poc] from system_tests_suite   View in Datadog
AssertionError: Found 6 span(s) in the same logical trace with a different 128-bit traceId than the server span (server traceId=6a51574200000000acead5ac57901cc7). Mismatched (span_id, trace_id_hex): [(&#39;e09785af751a0b1d&#39;, &#39;0000000000000000acead5ac57901cc7&#39;), (&#39;2044d1500b172e79&#39;, &#39;0000000000000000acead5ac57901cc7&#39;), (&#39;e457b90d900f8328&#39;, &#39;0000000000000000acead5ac57901cc7&#39;), (&#39;32b2680fae869d0e&#39;, &#39;0000000000000000acead5ac57901cc7&#39;), (&#39;691b1062399357d5&#39;, &#39;0000000000000000acead5ac57901cc7&#39;), (&#39;a1b166e1c215e4fc&#39;, &#39;0000000000000000acead5ac57901cc7&#39;)]. This indicates the OTLP exporter is not propagating _dd.p.tid (high 64 bits) from the chunk root to the remaining chunk spans.
assert not [(&#39;e09785af751a0b1d&#39;, &#39;0000000000000000acead5ac57901cc7&#39;), (&#39;2044d1500b172e79&#39;, &#39;0000000000000000acead5ac57901cc7&#39;), (...&#39;), (&#39;691b1062399357d5&#39;, &#39;0000000000000000acead5ac57901cc7&#39;), (&#39;a1b166e1c215e4fc&#39;, &#39;0000000000000000acead5ac57901cc7&#39;)]

self = &lt;tests.otel.test_tracing_otlp.Test_Otel_Tracing_OTLP object at 0x7f2e3a2f0410&gt;

    def test_128bit_trace_id_consistent_across_spans(self):
        &#34;&#34;&#34;Validates that every span in a trace carries the same full 128-bit OTLP traceId.
    
        DD tracers emit 128-bit trace IDs by default but the v04/v05 msgpack wire format only
        carries the lower 64 bits per span; the upper 64 bits live in the \`_dd.p.tid\` meta tag,
...

View all 18 failed jobs.

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 97d90a2 | Docs | Datadog PR Page | Give us feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant