Skip to content

feat(mongodb): open a parent span for Collection#bulkWrite#9109

Merged
BridgeAR merged 5 commits into
masterfrom
BridgeAR/2026-06-25-mongo-bulkwrite-span
Jul 7, 2026
Merged

feat(mongodb): open a parent span for Collection#bulkWrite#9109
BridgeAR merged 5 commits into
masterfrom
BridgeAR/2026-06-25-mongo-bulkwrite-span

Conversation

@BridgeAR

Copy link
Copy Markdown
Member

Summary

A bulkWrite fans out into separate insert/update/delete wire commands, so it
surfaced only as flat insert/update/delete spans with no indicator that
one logical call drove all of them. This wraps Collection#bulkWrite to open a
single bulkWrite <ns> parent span the per-type wire commands nest under as
children.

The wrap covers both driver shapes without sniffing the version: pre-v5 takes a
trailing callback and returns undefined (or a promise when none is given) and
validates its arguments synchronously, so the callback is wrapped and the
synchronous throw is guarded; v5+ always returns a promise and the span
finishes on it. The parent span records only namespace and resource — the child
wire commands keep carrying the statements, host, and DBM comment.

Test plan

  • PACKAGE_VERSION_RANGE=3.3.0 SERVICES=mongo mongodb-core plugin spec (legacy callback path)
  • PACKAGE_VERSION_RANGE=">=6.4.0" SERVICES=mongo mongodb-core plugin spec (promise path)

Fixes: #4073

A `bulkWrite` fans out into separate insert/update/delete wire commands, so
until now it surfaced only as flat `insert`/`update`/`delete` spans with no
indicator that one logical call drove all of them. This wraps
`Collection.prototype.bulkWrite` to open a single `bulkWrite <ns>` parent span
that the per-type wire commands nest under as children.

The wrap covers both driver shapes without sniffing the version: pre-v5 takes a
trailing callback and returns `undefined` (or a promise when none is given) and
validates its arguments synchronously, so the callback is wrapped and the
synchronous throw is guarded; v5+ always returns a promise and the span
finishes on it. The parent span only records namespace and resource — the child
wire commands keep carrying the statements, host, and DBM comment.

Fixes: #4073
@dd-octo-sts

dd-octo-sts Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Overall package size

Self size: 6.6 MB
Deduped: 7.26 MB
No deduping: 7.26 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.3.1 | 122.62 kB | 437.94 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |

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

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Jun 26, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🔄 Datadog auto-retried 1 job - 1 passed on retry View in Datadog

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 96.49% (+0.00%)

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

@pr-commenter

pr-commenter Bot commented Jun 27, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-07-07 20:12:06

Comparing candidate commit eaa90a9 in PR branch BridgeAR/2026-06-25-mongo-bulkwrite-span with baseline commit 1ed6244 in branch master.

📊 Benchmarking dashboard

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

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:appsec-appsec-enabled-24

  • unstable execution_time [-182829.270µs; +182773.836µs] or [-6.893%; +6.891%]

scenario:appsec-appsec-enabled-26

  • unstable execution_time [-206.553ms; +214.857ms] or [-8.186%; +8.515%]

scenario:appsec-appsec-enabled-with-attacks-26

  • unstable execution_time [-161.703ms; +150.405ms] or [-5.609%; +5.217%]

scenario:appsec-control-20

  • unstable execution_time [-164.103ms; +119.182ms] or [-9.402%; +6.828%]

scenario:appsec-control-24

  • unstable execution_time [-89.554ms; +116.007ms] or [-7.424%; +9.617%]

scenario:appsec-control-26

  • unstable execution_time [-113350.298µs; +112597.298µs] or [-9.383%; +9.320%]

scenario:debugger-line-probe-with-snapshot-minimal-24

  • unstable cpu_user_time [-3337.027ms; +2160.342ms] or [-36.821%; +23.837%]
  • unstable execution_time [-3375.041ms; +2167.182ms] or [-34.651%; +22.250%]
  • unstable instructions [-28.7G instructions; +18.2G instructions] or [-38.627%; +24.541%]
  • unstable max_rss_usage [-12.231MB; +7.885MB] or [-7.534%; +4.857%]
  • unstable throughput [-648.055op/s; +987.317op/s] or [-18.470%; +28.139%]

scenario:debugger-line-probe-with-snapshot-minimal-26

  • unstable cpu_user_time [-2107.357ms; +3393.876ms] or [-22.680%; +36.526%]
  • unstable execution_time [-2140.421ms; +3433.785ms] or [-21.472%; +34.447%]
  • unstable instructions [-18.5G instructions; +30.1G instructions] or [-23.940%; +38.869%]
  • unstable max_rss_usage [-7.013MB; +9.749MB] or [-4.390%; +6.103%]
  • unstable throughput [-759.824op/s; +469.980op/s] or [-23.013%; +14.235%]

scenario:debugger-line-probe-without-snapshot-24

  • unstable cpu_user_time [-2.663s; +0.353s] or [-31.248%; +4.140%]
  • unstable execution_time [-2.681s; +0.346s] or [-29.087%; +3.756%]
  • unstable instructions [-22.5G instructions; +3.0G instructions] or [-32.431%; +4.340%]
  • unstable throughput [-98.630op/s; +778.707op/s] or [-2.697%; +21.292%]

scenario:debugger-line-probe-without-snapshot-26

  • unstable cpu_user_time [-1776.590ms; +648.173ms] or [-19.010%; +6.935%]
  • unstable execution_time [-1800.161ms; +650.549ms] or [-17.891%; +6.466%]
  • unstable instructions [-16.0G instructions; +5.6G instructions] or [-20.577%; +7.207%]
  • unstable throughput [-153.548op/s; +387.046op/s] or [-4.703%; +11.856%]

scenario:dogstatsd-with-tags-20

  • unstable cpu_user_time [-359.472ms; +302.562ms] or [-7.352%; +6.188%]
  • unstable execution_time [-359.025ms; +303.008ms] or [-7.234%; +6.105%]
  • unstable throughput [-105964.649op/s; +123188.585op/s] or [-6.266%; +7.284%]

scenario:plugin-graphql-long-with-depth-and-collapse-off-24

  • unstable cpu_user_time [-282.042ms; +371.816ms] or [-6.286%; +8.286%]
  • unstable execution_time [-291.325ms; +392.942ms] or [-6.106%; +8.236%]
  • unstable max_rss_usage [-33.707MB; +50.141MB] or [-6.318%; +9.398%]
  • unstable throughput [-3.701op/s; +2.656op/s] or [-8.253%; +5.923%]

scenario:plugin-graphql-long-with-depth-off-20

  • unstable max_rss_usage [-14.936MB; +12.671MB] or [-10.483%; +8.893%]

scenario:plugin-graphql-long-with-depth-off-26

  • unstable max_rss_usage [-12.580MB; +4.436MB] or [-7.775%; +2.742%]

scenario:spans-finish-later-26

  • unstable max_rss_usage [-6.176MB; +9.942MB] or [-4.190%; +6.746%]

scenario:test-optimization-large-suite-20

  • unstable max_rss_usage [-5154.564KB; +3755.231KB] or [-6.503%; +4.737%]

@codecov

codecov Bot commented Jun 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.52%. Comparing base (1ed6244) to head (eaa90a9).
⚠️ Report is 71 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9109      +/-   ##
==========================================
+ Coverage   93.69%   96.52%   +2.83%     
==========================================
  Files         889      907      +18     
  Lines       50846   119421   +68575     
  Branches    11801    20176    +8375     
==========================================
+ Hits        47640   115272   +67632     
- Misses       3206     4149     +943     
Flag Coverage Δ
aiguard 53.54% <ø> (+18.59%) ⬆️
aiguard-integration 57.37% <ø> (+15.58%) ⬆️
apm-bucket-0 53.76% <ø> (+18.84%) ⬆️
apm-bucket-1 58.08% <ø> (+17.66%) ⬆️
apm-bucket-2 56.10% <ø> (+18.68%) ⬆️
apm-capabilities-tracing 61.00% <27.63%> (+12.42%) ⬆️
apm-integrations-aerospike 52.92% <ø> (+19.71%) ⬆️
apm-integrations-confluentinc-kafka-javascript 57.05% <ø> (+16.94%) ⬆️
apm-integrations-couchbase 53.23% <ø> (+19.64%) ⬆️
apm-integrations-http 57.96% <ø> (+15.85%) ⬆️
apm-integrations-kafkajs 57.70% <ø> (+17.35%) ⬆️
apm-integrations-next 54.21% <ø> (+24.64%) ⬆️
apm-integrations-prisma 54.16% <31.02%> (+19.05%) ⬆️
apm-integrations-tedious 53.01% <ø> (+19.04%) ⬆️
appsec 69.09% <ø> (+11.73%) ⬆️
appsec-express_fastify_graphql 65.66% <ø> (+11.88%) ⬆️
appsec-integration 45.79% <18.91%> (+9.62%) ⬆️
appsec-kafka_ldapjs_lodash 59.11% <ø> (+15.44%) ⬆️
appsec-mongodb-core_mongoose_mysql 62.27% <31.88%> (+13.40%) ⬆️
appsec-next 52.84% <ø> (+24.77%) ⬆️
appsec-node-serialize_passport_postgres 61.98% <ø> (+13.91%) ⬆️
appsec-sourcing_stripe_template 60.25% <ø> (+14.63%) ⬆️
debugger 65.70% <ø> (+21.57%) ⬆️
instrumentations-bucket-0 48.74% <ø> (+20.51%) ⬆️
instrumentations-bucket-1 54.95% <ø> (+17.46%) ⬆️
instrumentations-bucket-10 56.62% <ø> (+16.12%) ⬆️
instrumentations-bucket-11 48.70% <ø> (+20.67%) ⬆️
instrumentations-bucket-12 48.81% <ø> (+20.07%) ⬆️
instrumentations-bucket-13 48.64% <ø> (+20.78%) ⬆️
instrumentations-bucket-2 49.71% <ø> (+19.40%) ⬆️
instrumentations-bucket-3 53.81% <ø> (+17.83%) ⬆️
instrumentations-bucket-4 49.13% <ø> (+20.98%) ⬆️
instrumentations-bucket-5 52.99% <ø> (+16.64%) ⬆️
instrumentations-bucket-6 55.60% <ø> (+17.26%) ⬆️
instrumentations-bucket-7 53.58% <31.88%> (+17.51%) ⬆️
instrumentations-bucket-8 54.62% <ø> (+17.59%) ⬆️
instrumentations-bucket-9 56.08% <ø> (+16.48%) ⬆️
instrumentations-instrumentation-couchbase 48.13% <ø> (+1.62%) ⬆️
instrumentations-integration-esbuild 34.18% <18.91%> (+9.43%) ⬆️
llmobs-ai_anthropic_bedrock 57.26% <ø> (+17.66%) ⬆️
llmobs-google-genai_langchain_vertex-ai 55.76% <ø> (+18.84%) ⬆️
llmobs-openai 57.56% <ø> (+17.91%) ⬆️
llmobs-sdk 59.97% <ø> (+16.29%) ⬆️
master-coverage 96.52% <100.00%> (?)
openfeature 54.58% <ø> (+16.82%) ⬆️
openfeature-unit 49.79% <ø> (-0.61%) ⬇️
platform-core_esbuild_instrumentations-misc 38.64% <18.91%> (+15.38%) ⬆️
platform-integration 62.17% <ø> (+14.73%) ⬆️
platform-shimmer_unit-guardrails_webpack 37.43% <18.91%> (+18.62%) ⬆️
plugins-bucket-0 53.16% <ø> (+16.76%) ⬆️
plugins-bucket-1 55.05% <ø> (+15.44%) ⬆️
plugins-bucket-11 56.71% <ø> (+18.17%) ⬆️
plugins-bucket-17 56.73% <ø> (+17.51%) ⬆️
plugins-bucket-18 57.55% <ø> (+15.40%) ⬆️
plugins-bucket-19 57.07% <ø> (+17.44%) ⬆️
plugins-bucket-20 59.37% <ø> (+16.03%) ⬆️
plugins-bucket-4 53.83% <ø> (+16.04%) ⬆️
plugins-bullmq_cassandra_cookie 57.38% <ø> (+17.54%) ⬆️
plugins-cookie-parser_crypto_dd-trace-api 52.29% <ø> (+18.99%) ⬆️
plugins-fetch_fs_generic-pool 54.44% <ø> (+18.31%) ⬆️
plugins-google-cloud-pubsub_grpc_handlebars 59.87% <ø> (+16.69%) ⬆️
plugins-hapi_hono_ioredis 55.85% <ø> (+17.99%) ⬆️
plugins-jest_knex_langgraph 51.64% <ø> (+18.95%) ⬆️
plugins-ldapjs_light-my-request_limitd-client 53.39% <ø> (+25.46%) ⬆️
plugins-lodash_mariadb_memcached 54.19% <ø> (+18.93%) ⬆️
plugins-mongodb_mongodb-core_mongoose 55.44% <99.65%> (+19.06%) ⬆️
plugins-multer_mysql_mysql2 54.35% <ø> (+19.12%) ⬆️
plugins-nats_node-serialize_opensearch 56.05% <ø> (+18.82%) ⬆️
plugins-passport-http_pino_postgres 54.72% <ø> (+19.11%) ⬆️
plugins-process_pug_redis 53.82% <ø> (+19.48%) ⬆️
plugins-undici_url_valkey 54.28% <ø> (+18.33%) ⬆️
plugins-vm_winston_ws 55.25% <ø> (+17.62%) ⬆️
profiling 58.19% <ø> (+14.50%) ⬆️
serverless-aws-sdk-aws-sdk 50.63% <ø> (+17.27%) ⬆️
serverless-aws-sdk-bedrockruntime 50.65% <ø> (+18.42%) ⬆️
serverless-aws-sdk-client 51.93% <ø> (+14.76%) ⬆️
serverless-aws-sdk-dynamodb 51.72% <ø> (+17.50%) ⬆️
serverless-aws-sdk-eventbridge 46.18% <ø> (+18.87%) ⬆️
serverless-aws-sdk-kinesis 54.68% <ø> (+17.21%) ⬆️
serverless-aws-sdk-lambda 52.76% <ø> (+18.09%) ⬆️
serverless-aws-sdk-s3 51.50% <ø> (+18.83%) ⬆️
serverless-aws-sdk-serverless-peer-service 54.71% <ø> (+15.07%) ⬆️
serverless-aws-sdk-sns 55.46% <ø> (+17.13%) ⬆️
serverless-aws-sdk-sqs 55.89% <ø> (+17.82%) ⬆️
serverless-aws-sdk-stepfunctions 51.22% <ø> (+17.97%) ⬆️
serverless-aws-sdk-util 48.42% <ø> (+0.47%) ⬆️
serverless-bucket-0 55.21% <ø> (+15.74%) ⬆️
serverless-bucket-1 56.00% <ø> (?)
serverless-lambda ?
test-optimization-cucumber 72.98% <ø> (+20.52%) ⬆️
test-optimization-cypress 66.54% <ø> (+16.88%) ⬆️
test-optimization-jest 73.94% <ø> (+18.44%) ⬆️
test-optimization-mocha 74.31% <ø> (+20.74%) ⬆️
test-optimization-playwright-playwright-atr 61.57% <ø> (+18.07%) ⬆️
test-optimization-playwright-playwright-efd 61.81% <ø> (+18.02%) ⬆️
test-optimization-playwright-playwright-final-status 61.71% <ø> (+17.87%) ⬆️
test-optimization-playwright-playwright-impacted-tests 61.43% <ø> (+18.02%) ⬆️
test-optimization-playwright-playwright-reporting 61.60% <ø> (+18.19%) ⬆️
test-optimization-playwright-playwright-test-management 62.31% <ø> (+17.46%) ⬆️
test-optimization-playwright-playwright-test-span 61.54% <ø> (+16.84%) ⬆️
test-optimization-selenium 60.68% <ø> (+15.22%) ⬆️
test-optimization-testopt 59.13% <ø> (+10.94%) ⬆️
test-optimization-vitest 72.82% <ø> (+21.98%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.

BridgeAR added 2 commits June 27, 2026 18:00
This lets `assertFirstTraceSpan` target a span other than `traces[0][0]`.
When a `spanResourceMatch` is passed in the options, the first span across
the payload whose resource matches it is asserted instead of the first
span of the first trace. A heartbeat command (`ismaster admin.$cmd`) or a
parent `bulkWrite` span that lands ahead of the span under test no longer
forces the assertion onto the wrong span. Without a matcher the behaviour
is unchanged, so existing callers keep asserting `traces[0][0]`.
The `bulkWrite` parent span and heartbeat commands share a payload with the
per-command write spans, so `traces[0][0]` is no longer reliably the span
under test. The specs worked around this with a local `findSpanByResource`
helper plus `assertSomeTraces`, which re-runs and throws on every
non-matching payload until one matches.

Pass `spanResourceMatch` so the agent gates the handler to the payload that
holds the target span and `assertFirstTraceSpan` asserts that span directly.
The local helper is gone, and the per-command and parent assertions read as
plain `assertFirstTraceSpan` calls again.

As a side effect this fixes two flaky `obfuscateQuery: "types"` find specs
that asserted `traces[0][0]` and intermittently caught the `ismaster`
heartbeat span instead of the find span under full-suite heartbeat noise.
@BridgeAR
BridgeAR marked this pull request as ready for review June 27, 2026 18:26
@BridgeAR
BridgeAR requested a review from a team as a code owner June 27, 2026 18:26
@BridgeAR
BridgeAR requested review from wconti27 and removed request for a team June 27, 2026 18:26

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

Copy link
Copy Markdown

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: d30f5c2a3a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/datadog-instrumentations/src/mongodb.js
For the MongoDB <5 callback-style `bulkWrite`, the driver invokes the wrapped
callback from work scheduled while the bulkWrite span was active. The custom
`apm:mongodb:bulkwrite:finish` channel only had a subscriber and no store bind,
so its `runStores` ran the callback with the just-finished bulkWrite span still
active. A traced operation started in the callback became a child of the
already-finished span. Bind the finish channel to `ctx.parentStore` so the
callback runs under the original parent, mirroring how the query finish channel
binds finish via `OutboundPlugin.bindFinish`.
Comment thread packages/datadog-plugin-mongodb-core/src/index.js Outdated
@BridgeAR
BridgeAR marked this pull request as draft July 7, 2026 18:17
@BridgeAR
BridgeAR force-pushed the BridgeAR/2026-06-25-mongo-bulkwrite-span branch from 97f0eb1 to 975aeaf Compare July 7, 2026 19:14
The bulkWrite span lived inside the query plugin's constructor, which
hand-wired its start/finish/error channels and re-implemented the
parent-store restore that `OutboundPlugin.bindFinish` already provides.
Move it into a `MongodbCoreBulkWritePlugin` (operation `bulkwrite`, so it
resolves the `apm:mongodb:bulkwrite:*` channels) that inherits `finish`,
`error`, and the finish-time parent restore from the tracing/outbound base
classes, and wire both spans through a `CompositePlugin`. It extends the
query plugin to reuse the shared id, component, and collection-stripping
`getPeerService`.

Adding a third MongoDB logical span is now another small child plugin
rather than more ad hoc constructor wiring, and the lifecycle contract is
enforced by the base classes instead of by convention.
@BridgeAR
BridgeAR force-pushed the BridgeAR/2026-06-25-mongo-bulkwrite-span branch from 975aeaf to eaa90a9 Compare July 7, 2026 20:00
@BridgeAR
BridgeAR marked this pull request as ready for review July 7, 2026 20:17
@BridgeAR
BridgeAR merged commit 44972dc into master Jul 7, 2026
652 of 653 checks passed
@BridgeAR
BridgeAR deleted the BridgeAR/2026-06-25-mongo-bulkwrite-span branch July 7, 2026 20:42
dd-octo-sts Bot pushed a commit that referenced this pull request Jul 7, 2026
A `bulkWrite` fans out into separate insert/update/delete wire commands, so it surfaced only as flat per-command spans with no indicator that one logical call drove all of them. This adds a `bulkWrite <ns>` parent span while preserving the child wire-command spans as the source for statements, host, and DBM comment data.

The span lifecycle goes through a dedicated child plugin so callback-style MongoDB <5 restores the original parent context after finish, matching the existing outbound plugin contract.

Fixes: #4073
@dd-octo-sts dd-octo-sts Bot mentioned this pull request Jul 7, 2026
dd-octo-sts Bot pushed a commit that referenced this pull request Jul 7, 2026
A `bulkWrite` fans out into separate insert/update/delete wire commands, so it surfaced only as flat per-command spans with no indicator that one logical call drove all of them. This adds a `bulkWrite <ns>` parent span while preserving the child wire-command spans as the source for statements, host, and DBM comment data.

The span lifecycle goes through a dedicated child plugin so callback-style MongoDB <5 restores the original parent context after finish, matching the existing outbound plugin contract.

Fixes: #4073
@dd-octo-sts dd-octo-sts Bot mentioned this pull request Jul 7, 2026
juan-fernandez pushed a commit that referenced this pull request Jul 8, 2026
A `bulkWrite` fans out into separate insert/update/delete wire commands, so it surfaced only as flat per-command spans with no indicator that one logical call drove all of them. This adds a `bulkWrite <ns>` parent span while preserving the child wire-command spans as the source for statements, host, and DBM comment data.

The span lifecycle goes through a dedicated child plugin so callback-style MongoDB <5 restores the original parent context after finish, matching the existing outbound plugin contract.

Fixes: #4073
juan-fernandez pushed a commit that referenced this pull request Jul 8, 2026
A `bulkWrite` fans out into separate insert/update/delete wire commands, so it surfaced only as flat per-command spans with no indicator that one logical call drove all of them. This adds a `bulkWrite <ns>` parent span while preserving the child wire-command spans as the source for statements, host, and DBM comment data.

The span lifecycle goes through a dedicated child plugin so callback-style MongoDB <5 restores the original parent context after finish, matching the existing outbound plugin contract.

Fixes: #4073
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.

Properly name bulkWrite operations in the mongo plugin

2 participants