Uh oh!
There was an error while loading. Please reload this page.
ref(node): Streamline mongodb instrumentation - #21619
Conversation
size-limit report 📦
|
8c0b859 to
d79e1cdCompareUh oh!
There was an error while loading. Please reload this page.
d79e1cd to
d0846c8CompareUh oh!
There was an error while loading. Please reload this page.
| v4PatchConnectionPool, | ||
| v4UnpatchConnectionPool, | ||
| ), | ||
| new InstrumentationNodeModuleFile( |
There was a problem hiding this comment.
q: Is there a specific reason why this is not needed anymore?
There was a problem hiding this comment.
Those are metrics only, they don't do spans
d0846c8 to
ad2a160CompareStreamlines the vendored `mongodb` instrumentation to use Sentry's span APIs instead of the OpenTelemetry tracing APIs, following the redis/pg/mongoose precedent. - Replace `tracer.startSpan` with `startInactiveSpan`, the `trace.getSpan(context.active())` + `requireParentSpan` guard with a `getActiveSpan()` check, `SpanStatusCode.ERROR` with `SPAN_STATUS_ERROR`, and the `context.with(...)`/`context.bind(...)` propagation with `withActiveSpan` (result-handler re-activation and the pool `checkOut` rebind). Drop `recordException` and the `_diag` logger. - Drop the OTel connection-usage metrics: the SDK wires up no `MeterProvider`, so `this.meter` is the no-op meter and every `add` was dead. Also removes the session and connect patches that existed only to feed those metrics (they create no spans, so span output is unchanged). - Drop the `SemconvStability` dual-emission and keep the OLD semconv attributes only (the STABLE path was env-gated behind `OTEL_SEMCONV_STABILITY_OPT_IN` and never enabled by the SDK). - Remove config the SDK never passes (`responseHook`, the configurable `dbStatementSerializer`, `requireParentSpan`); move the always-on statement serializer into the vendored code and bake the `auto.db.otel.mongo` origin into the span attributes instead of an `index.ts` responseHook. - Drop the blanket eslint-disable, type the module, and split the helpers (`utils.ts`) and wrap factories (`patches.ts`) out of the class to keep each vendored file within `max-lines`. Removes the config-passing `Mongo` unit test (its serializer logic is covered end-to-end by the integration suite) and extends the real suite with an error path: a server-rejected query asserts `status: 'internal_error'` with the origin and `db.statement` preserved.
ad2a160 to
c8f6e1aCompareThere was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c8f6e1a. Configure here.
| kind: SpanKind.CLIENT, | ||
| attributes, | ||
| }); | ||
| } |
There was a problem hiding this comment.
Missing db span metadata
High Severity
startMongoSpan creates native Sentry spans with name mongodb.${operation} and no sentry.op attribute. Finished spans expose description from that name and op from sentry.op in attributes, unlike the prior OTel exporter path that inferred op: db and a statement-based description from db.system / db.statement.
Reviewed by Cursor Bugbot for commit c8f6e1a. Configure here.
Uh oh!
There was an error while loading. Please reload this page.


Streamlines the vendored
mongodbinstrumentation to use Sentry's span APIs instead of the OpenTelemetry tracing APIs.