Skip to content

fix(grpc): run fork PR #20780 through CI [DO NOT MERGE] - #22028

Closed
dubloom wants to merge 4 commits into
mainfrom
louis.tricot/mirror-20780
Closed

dubloom wants to merge 4 commits into
mainfrom
louis.tricot/mirror-20780

Conversation

@dubloom

@dubloom dubloom commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

This draft PR exists only to run CI for a fork PR. It must not be merged.

Original PR: #20780

Head SHA: 2cf728056214131fd8ffc763a497565d5d70077b

🤖 Generated with Claude Code

caiotheodoro and others added 4 commits October 3, 2026 21:07
Store the span on the wrapt proxy as _self_span so wrapping a plain generator no longer raises AttributeError, and finish the span on StopIteration when the wrapped iterator has no done callback.

Fixes #20729

Signed-off-by: Caio Theodoro <48462974+caiotheodoro@users.noreply.github.com>
… status

A plain iterator response has no done callback to finish its span: register a weakref finalizer so a dropped generator still finishes the span, record errors and status when iteration raises, and tag grpc.status.code OK on StopIteration. Replace fake-iterator unit tests with tests through a real intercepted SayHelloTwice stream.
A generator that already raised is closed, so the next pull is StopIteration. That path was writing StatusCode.OK over the failure status.

Co-authored-by: Cursor <cursoragent@cursor.com>
@cit-pr-commenter-54b7da

Copy link
Copy Markdown

Codeowners resolved as

Resolved from the full PR diff against main using the target branch CODEOWNERS file.
CODEOWNERS team requests not listed below are not required by the current file set.

ddtrace/contrib/internal/grpc/client_interceptor.py                     @DataDog/apm-python-guild @DataDog/apm-idm-python
releasenotes/notes/fix-grpc-wrapped-generator-response-4b7d1c9e2a6f5083.yaml  @DataDog/apm-python
tests/contrib/grpc/test_grpc.py                                         @DataDog/apm-idm-python

@cit-pr-commenter-54b7da

Copy link
Copy Markdown

Dependency direction analysis

⚠️ Existing dependency direction violations

There are 22 dependency direction violations that already exist on the base branch and have not been changed by this PR.

Show existing violations (showing 5 of 22 highest severity)
ddtrace.internal.tracemethods -×-> ddtrace.trace  (internal-core -> product:tracing, score=103)
ddtrace.llmobs._integrations.base -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=101)
ddtrace.llmobs._integrations.bedrock_agents -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=101)
ddtrace.internal.span_bus -×-> ddtrace._trace.span  (internal-core -> product:tracing, score=35)
ddtrace.llmobs._llmobs -×-> ddtrace._trace.span  (product:llmobs -> product:tracing, score=33)

To see all violations, download the layers-base.json and layers-pr.json artifacts from this CI job and run:

uv run --script scripts/import-analysis/layers.py compare layers-base.json layers-pr.json

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Tests

⚠️ Warnings

Your PR has warnings. Please review the issues below.

❄️ 1 New flaky test detected

GrpcTestCase::test_server_stream_generator_response_dropped[py3.11] from test_grpc.py
assert 0 == 2
 &#43;  where 0 = len([])

View in Flaky Test Management

ℹ️ Info

No other issues found (see more)

🧪 All tests passed

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 2cf7280 | Docs | View more details | Give us feedback!

@dubloom dubloom closed this Nov 23, 2026
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.

2 participants