Skip to content

Conversation

@nina9753
Copy link
Contributor

@nina9753 nina9753 commented Jan 9, 2026

What does this PR do?

Small clean up PR to :

  • remove redundant pubsub.batch.request_span_id span tag which is the same as the pubsub.batch.request_trace_id tag.
  • added pubsub.delivery_duration_ms to push subscriptions for tag parity with pull subscriptions
  • Update synthetic span for push subscription name from pubsub.delivery to pubsub.push.receive
  • Updates tests to test the new changes with garbage collector

Motivation

Plugin Checklist

Additional Notes

@codecov
Copy link

codecov bot commented Jan 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.90%. Comparing base (4f81eaf) to head (44d7e36).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7205      +/-   ##
==========================================
- Coverage   84.56%   77.90%   -6.66%     
==========================================
  Files         532      384     -148     
  Lines       22656    17739    -4917     
==========================================
- Hits        19159    13820    -5339     
- Misses       3497     3919     +422     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4f36e20970

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 209 to 211
const requestSpanId = attrs['_dd.pubsub_request.span_id']
if (requestTraceId && requestSpanId) {
span.setTag('pubsub.batch.request_trace_id', requestTraceId)
if (requestSpanId) {
span.setTag('pubsub.batch.request_span_id', requestSpanId)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore batch request trace ID tag

By only emitting pubsub.batch.request_span_id here, the delivery span no longer carries the batch request’s trace ID. That’s not redundant: in producer.js the batch trace ID is derived from spanCtx.toTraceId(true) while the span ID comes from spanCtx.toSpanId(true), so they differ whenever the publish happens under an existing trace (non‑root batch span). Without the trace ID, pubsub.batch.request_span_id becomes ambiguous (span IDs are only unique within a trace), so downstream correlation that relies on the public pubsub.batch.* tags can’t reliably link back to the batch request. Consider restoring pubsub.batch.request_trace_id (or emitting an equivalent public trace ID tag) alongside the span ID.

Useful? React with 👍 / 👎.

@github-actions
Copy link

github-actions bot commented Jan 9, 2026

Overall package size

Self size: 4.39 MB
Deduped: 5.21 MB
No deduping: 5.21 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 2.0.0 | 68.46 kB | 797.03 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

Copy link
Collaborator

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our tests seem to not reflect this change properly.

When I ran the tests locally, the span assertion always returned early and never found a match. It should actually not contain the return. Our test helper would pass, if any trace contains the correct span, which does not seem to be the case.

Please have a look at that and update the test so that it would now need an update due to the changed code.

I just removed the early returns in the tests and now the following all fail:

      1) should create BOTH pubsub.delivery span AND HTTP span in same trace
      2) should propagate distributed trace context from producer to push delivery
      3) should add batch metadata to delivery span
      4) should set service name with -pubsub suffix

@datadog-official

This comment has been minimized.

@pr-commenter
Copy link

pr-commenter bot commented Jan 12, 2026

Benchmarks

Benchmark execution time: 2026-01-14 15:56:07

Comparing candidate commit 44d7e36 in PR branch nina.rei/gcp_pubsub_span_tag_cleanup with baseline commit 4f81eaf in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 290 metrics, 30 unstable metrics.

@nina9753 nina9753 requested a review from BridgeAR January 13, 2026 19:17
Copy link
Collaborator

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! The tests are now seemingly running correct, thank you for fixing them! I believe this should be good to land as soon as the type changes are undone

@nina9753 nina9753 requested a review from BridgeAR January 14, 2026 14:40
@nina9753 nina9753 merged commit 145d856 into master Jan 14, 2026
795 checks passed
@nina9753 nina9753 deleted the nina.rei/gcp_pubsub_span_tag_cleanup branch January 14, 2026 16:25
dd-octo-sts bot pushed a commit that referenced this pull request Jan 15, 2026
* add pubsub.delivery_duration_ms to push subscriptions

* update push tests and names of span tags

* update tests for push subscriptions

* update tests: remove K_SERVICE delete

* Update all tests and naming convention of inferred span

* create global const for gc

* remove ts error check for gc
@dd-octo-sts dd-octo-sts bot mentioned this pull request Jan 15, 2026
nina9753 added a commit that referenced this pull request Jan 15, 2026
* add pubsub.delivery_duration_ms to push subscriptions

* update push tests and names of span tags

* update tests for push subscriptions

* update tests: remove K_SERVICE delete

* Update all tests and naming convention of inferred span

* create global const for gc

* remove ts error check for gc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants