11import type { TransactionEvent } from '@sentry/core' ;
22import { afterAll , describe , expect } from 'vitest' ;
3+ import { isOrchestrionEnabled } from '../../../utils' ;
34import { cleanupChildProcesses , createEsmAndCjsTests } from '../../../utils/runner' ;
45
6+ // The suite runs twice on CI: once with the OTel `Aws` integration (default) and once with the
7+ // orchestrion diagnostics-channel integration auto-injected (`INJECT_ORCHESTRION`). Both emit the
8+ // same spans; only the origin differs.
9+ const ORIGIN = isOrchestrionEnabled ( ) ? 'auto.aws.orchestrion.aws-sdk' : 'auto.otel.aws' ;
10+
511// The aws-sdk instrumentation creates spans by patching the underlying smithy middleware stack. The
612// patch target differs between aws-sdk versions, so we run the exact same assertions against both:
713// - the current aws-sdk (default, resolved from the workspace) which routes through `@smithy/core` >= 3.24.0
@@ -40,10 +46,10 @@ function assertAwsServiceSpans(transaction: TransactionEvent): void {
4046 expectSpan ( 'S3.PutObject' , {
4147 description : 'S3.PutObject' ,
4248 op : 'rpc' ,
43- origin : 'auto.otel.aws' ,
49+ origin : ORIGIN ,
4450 status : 'ok' ,
4551 data : expect . objectContaining ( {
46- 'sentry.origin' : 'auto.otel.aws' ,
52+ 'sentry.origin' : ORIGIN ,
4753 'sentry.op' : 'rpc' ,
4854 'rpc.system' : 'aws-api' ,
4955 'rpc.method' : 'PutObject' ,
@@ -58,7 +64,7 @@ function assertAwsServiceSpans(transaction: TransactionEvent): void {
5864 expectSpan ( 'S3.GetObject (success)' , {
5965 description : 'S3.GetObject' ,
6066 op : 'rpc' ,
61- origin : 'auto.otel.aws' ,
67+ origin : ORIGIN ,
6268 status : 'ok' ,
6369 data : expect . objectContaining ( { 'rpc.method' : 'GetObject' , 'rpc.service' : 'S3' , 'aws.s3.bucket' : 'ot-demo-test' } ) ,
6470 } ) ;
@@ -67,7 +73,7 @@ function assertAwsServiceSpans(transaction: TransactionEvent): void {
6773 expectSpan ( 'S3.GetObject (error)' , {
6874 description : 'S3.GetObject' ,
6975 op : 'rpc' ,
70- origin : 'auto.otel.aws' ,
76+ origin : ORIGIN ,
7177 status : 'internal_error' ,
7278 data : expect . objectContaining ( { 'rpc.method' : 'GetObject' , 'rpc.service' : 'S3' } ) ,
7379 } ) ;
@@ -76,7 +82,7 @@ function assertAwsServiceSpans(transaction: TransactionEvent): void {
7682 expectSpan ( 'DynamoDB.PutItem' , {
7783 description : 'DynamoDB.PutItem' ,
7884 op : 'db' ,
79- origin : 'auto.otel.aws' ,
85+ origin : ORIGIN ,
8086 data : expect . objectContaining ( {
8187 'sentry.op' : 'db' ,
8288 'rpc.method' : 'PutItem' ,
@@ -92,7 +98,7 @@ function assertAwsServiceSpans(transaction: TransactionEvent): void {
9298 expectSpan ( 'DynamoDB.Query' , {
9399 description : 'DynamoDB.Query' ,
94100 op : 'db' ,
95- origin : 'auto.otel.aws' ,
101+ origin : ORIGIN ,
96102 data : expect . objectContaining ( {
97103 'rpc.method' : 'Query' ,
98104 'db.operation' : 'Query' ,
@@ -105,7 +111,7 @@ function assertAwsServiceSpans(transaction: TransactionEvent): void {
105111 expectSpan ( 'SQS SendMessage' , {
106112 description : 'my-queue send' ,
107113 op : 'rpc' ,
108- origin : 'auto.otel.aws' ,
114+ origin : ORIGIN ,
109115 data : expect . objectContaining ( {
110116 'rpc.method' : 'SendMessage' ,
111117 'rpc.service' : 'SQS' ,
@@ -121,7 +127,7 @@ function assertAwsServiceSpans(transaction: TransactionEvent): void {
121127 expectSpan ( 'SQS ReceiveMessage' , {
122128 description : 'my-queue receive' ,
123129 op : 'rpc' ,
124- origin : 'auto.otel.aws' ,
130+ origin : ORIGIN ,
125131 data : expect . objectContaining ( {
126132 'rpc.method' : 'ReceiveMessage' ,
127133 'messaging.system' : 'aws_sqs' ,
@@ -135,7 +141,7 @@ function assertAwsServiceSpans(transaction: TransactionEvent): void {
135141 expectSpan ( 'SNS Publish' , {
136142 description : 'my-topic send' ,
137143 op : 'rpc' ,
138- origin : 'auto.otel.aws' ,
144+ origin : ORIGIN ,
139145 data : expect . objectContaining ( {
140146 'rpc.method' : 'Publish' ,
141147 'rpc.service' : 'SNS' ,
@@ -150,7 +156,7 @@ function assertAwsServiceSpans(transaction: TransactionEvent): void {
150156 expectSpan ( 'Lambda Invoke' , {
151157 description : 'my-function Invoke' ,
152158 op : 'rpc' ,
153- origin : 'auto.otel.aws' ,
159+ origin : ORIGIN ,
154160 data : expect . objectContaining ( {
155161 'rpc.method' : 'Invoke' ,
156162 'rpc.service' : 'Lambda' ,
@@ -164,7 +170,7 @@ function assertAwsServiceSpans(transaction: TransactionEvent): void {
164170 expectSpan ( 'Kinesis.PutRecord' , {
165171 description : 'Kinesis.PutRecord' ,
166172 op : 'rpc' ,
167- origin : 'auto.otel.aws' ,
173+ origin : ORIGIN ,
168174 status : 'ok' ,
169175 data : expect . objectContaining ( {
170176 'rpc.method' : 'PutRecord' ,
@@ -177,7 +183,7 @@ function assertAwsServiceSpans(transaction: TransactionEvent): void {
177183 expectSpan ( 'SecretsManager.GetSecretValue' , {
178184 description : 'SecretsManager.GetSecretValue' ,
179185 op : 'rpc' ,
180- origin : 'auto.otel.aws' ,
186+ origin : ORIGIN ,
181187 data : expect . objectContaining ( {
182188 'rpc.method' : 'GetSecretValue' ,
183189 'rpc.service' : 'SecretsManager' ,
@@ -189,7 +195,7 @@ function assertAwsServiceSpans(transaction: TransactionEvent): void {
189195 expectSpan ( 'StepFunctions.StartExecution' , {
190196 description : 'SFN.StartExecution' ,
191197 op : 'rpc' ,
192- origin : 'auto.otel.aws' ,
198+ origin : ORIGIN ,
193199 data : expect . objectContaining ( {
194200 'rpc.method' : 'StartExecution' ,
195201 'rpc.service' : 'SFN' ,
0 commit comments