File tree 6 files changed +1167
-83
lines changed
dev-packages/node-integration-tests
suites/aws-serverless/aws-integration/s3
6 files changed +1167
-83
lines changed Original file line number Diff line number Diff line change 49
49
"mysql2" : " ^3.7.1" ,
50
50
"nock" : " ^13.1.0" ,
51
51
"pg" : " ^8.7.3" ,
52
+ "@aws-sdk/client-s3" : " ^3.552.0" ,
52
53
"proxy" : " ^2.1.1" ,
53
54
"reflect-metadata" : " 0.2.1" ,
54
55
"rxjs" : " ^7.8.1" ,
Original file line number Diff line number Diff line change
1
+ const { loggingTransport } = require ( '@sentry-internal/node-integration-tests' ) ;
2
+ const Sentry = require ( '@sentry/aws-serverless' ) ;
3
+
4
+ Sentry . init ( {
5
+ dsn :
'https://[email protected] /1337' ,
6
+ tracesSampleRate : 1.0 ,
7
+ debug : true ,
8
+ transport : loggingTransport ,
9
+ } ) ;
10
+
11
+ const { S3 } = require ( '@aws-sdk/client-s3' ) ;
12
+ const nock = require ( 'nock' ) ;
13
+
14
+ async function run ( ) {
15
+ const bucketName = 'aws-test-bucket' ;
16
+ const keyName = 'aws-test-object.txt' ;
17
+
18
+ nock ( `https://${ bucketName } .s3.amazonaws.com` ) . get ( `/${ keyName } ` ) . reply ( 200 , 'contents' ) ;
19
+ nock ( `https://${ bucketName } .s3.amazonaws.com` ) . put ( `/${ keyName } ` ) . reply ( 200 , 'contents' ) ;
20
+
21
+ await Sentry . startSpan ( { name : 'Test Transaction' } , async ( ) => {
22
+ const region = 'us-east-1' ;
23
+ const s3Client = new S3 ( { region } ) ;
24
+ nock ( `https://ot-demo-test.s3.${ region } .amazonaws.com/` )
25
+ . put ( '/aws-ot-s3-test-object.txt?x-id=PutObject' )
26
+ . reply ( 200 , 'test' ) ;
27
+
28
+ const params = {
29
+ Bucket : 'ot-demo-test' ,
30
+ Key : 'aws-ot-s3-test-object.txt' ,
31
+ } ;
32
+ await s3Client . putObject ( params ) ;
33
+ } ) ;
34
+ }
35
+
36
+ run ( ) ;
Original file line number Diff line number Diff line change
1
+ import { cleanupChildProcesses , createRunner } from '../../../../utils/runner' ;
2
+
3
+ const EXPECTED_TRANSCATION = {
4
+ transaction : 'Test Transaction' ,
5
+ spans : expect . arrayContaining ( [
6
+ expect . objectContaining ( {
7
+ description : 'S3.PutObject' ,
8
+ op : 'rpc' ,
9
+ origin : 'auto.otel.aws' ,
10
+ data : {
11
+ 'sentry.origin' : 'auto.otel.aws' ,
12
+ 'sentry.op' : 'rpc' ,
13
+ 'rpc.system' : 'aws-api' ,
14
+ 'rpc.method' : 'PutObject' ,
15
+ 'rpc.service' : 'S3' ,
16
+ 'aws.region' : 'us-east-1' ,
17
+ 'otel.kind' : 'CLIENT' ,
18
+ } ,
19
+ } ) ,
20
+ ] ) ,
21
+ } ;
22
+
23
+ describe ( 'awsIntegration' , ( ) => {
24
+ afterAll ( ( ) => {
25
+ cleanupChildProcesses ( ) ;
26
+ } ) ;
27
+
28
+ test ( 'should auto-instrument aws-sdk v2 package.' , done => {
29
+ createRunner ( __dirname , 'scenario.js' ) . expect ( { transaction : EXPECTED_TRANSCATION } ) . start ( done ) ;
30
+ } ) ;
31
+ } ) ;
Original file line number Diff line number Diff line change 62
62
"@types/express" : " ^4.17.14"
63
63
},
64
64
"devDependencies" : {
65
- "@types/node" : " ^14.18.0" ,
66
- "aws-sdk" : " ^2.765.0" ,
67
- "find-up" : " ^5.0.0" ,
68
- "nock" : " ^13.0.4" ,
69
- "npm-packlist" : " ^2.1.4"
65
+ "@types/node" : " ^14.18.0"
70
66
},
71
67
"scripts" : {
72
68
"build" : " run-p build:transpile build:types build:bundle" ,
Original file line number Diff line number Diff line change 60
60
"@google-cloud/functions-framework" : " ^1.7.1" ,
61
61
"@google-cloud/pubsub" : " ^2.5.0" ,
62
62
"@types/node" : " ^14.18.0" ,
63
- "find-up" : " ^5.0.0" ,
64
63
"google-gax" : " ^2.9.0" ,
65
- "nock" : " ^13.0.4" ,
66
- "npm-packlist" : " ^2.1.4"
64
+ "nock" : " ^13.0.4"
67
65
},
68
66
"scripts" : {
69
67
"build" : " run-p build:transpile build:types" ,
You can’t perform that action at this time.
0 commit comments