Skip to content

Commit d64ba71

Browse files
committed
Expect the default manual origin on streamed mysql and postgres db spans
Under the SentryTracerProvider, streamed spans carry `sentry.origin` as a first-class attribute including the default `manual` value, whereas the OpenTelemetry SDK path omits the `manual` default. The `mysql` (v1) db spans and the `pg.connect` span set no explicit origin, so they surface as `manual` here. Assert it for now. When those instrumentations are reworked to set an explicit `auto.db.otel.*` origin (e.g. #21568 for mysql), these expectations will be updated to the real origin then.
1 parent fe8bf1f commit d64ba71

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

  • dev-packages/node-integration-tests/suites/tracing/postgres-streamed

dev-packages/node-integration-tests/suites/tracing/postgres-streamed/test.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,14 @@ const COMMON_DB_ATTRIBUTES = {
7373

7474
/**
7575
* Builds the expected strict shape of a streamed postgres db span.
76-
* The `pg.connect` span has neither a `db.statement` nor a `sentry.origin`,
77-
* whereas query spans carry both.
7876
*
79-
* `host` defaults to `localhost`, but the `pg-native` scenarios connect to the
80-
* IPv4 loopback (`127.0.0.1`) explicitly, so the reported peer name and
81-
* connection string reflect that.
77+
* Query spans carry a `db.statement` and the `auto.db.otel.postgres` origin. The `pg.connect` span
78+
* has no `db.statement`, and since the pg instrumentation sets no origin on it, it carries the
79+
* default `manual` origin (written as an attribute on the streamed-span path; the non-streamed/SDK
80+
* path omits the `manual` default).
81+
*
82+
* `host` defaults to `localhost`, but the `pg-native` scenarios connect to the IPv4 loopback
83+
* (`127.0.0.1`) explicitly, so the reported peer name and connection string reflect that.
8284
*/
8385
function expectedDbSpan({
8486
name,
@@ -110,6 +112,11 @@ function expectedDbSpan({
110112
type: 'string',
111113
value: 'auto.db.otel.postgres',
112114
};
115+
} else {
116+
attributes['sentry.origin'] = {
117+
type: 'string',
118+
value: 'manual',
119+
};
113120
}
114121

115122
return {

0 commit comments

Comments
 (0)