File tree Expand file tree Collapse file tree 6 files changed +1167
-83
lines changed
dev-packages/node-integration-tests
suites/aws-serverless/aws-integration/s3 Expand file tree Collapse file tree 6 files changed +1167
-83
lines changed Original file line number Diff line number Diff line change 5050 "mysql2" : " ^3.7.1" ,
5151 "nock" : " ^13.1.0" ,
5252 "pg" : " ^8.7.3" ,
53+ "@aws-sdk/client-s3" : " ^3.552.0" ,
5354 "proxy" : " ^2.1.1" ,
5455 "reflect-metadata" : " 0.2.1" ,
5556 "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://public@dsn.ingest.sentry.io/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 6161 "@types/express" : " ^4.17.14"
6262 },
6363 "devDependencies" : {
64- "@types/node" : " ^14.18.0" ,
65- "aws-sdk" : " ^2.765.0" ,
66- "find-up" : " ^5.0.0" ,
67- "nock" : " ^13.0.4" ,
68- "npm-packlist" : " ^2.1.4"
64+ "@types/node" : " ^14.18.0"
6965 },
7066 "scripts" : {
7167 "build" : " run-p build:transpile build:types build:bundle" ,
Original file line number Diff line number Diff line change 6060 "@google-cloud/functions-framework" : " ^1.7.1" ,
6161 "@google-cloud/pubsub" : " ^2.5.0" ,
6262 "@types/node" : " ^14.18.0" ,
63- "find-up" : " ^5.0.0" ,
6463 "google-gax" : " ^2.9.0" ,
65- "nock" : " ^13.0.4" ,
66- "npm-packlist" : " ^2.1.4"
64+ "nock" : " ^13.0.4"
6765 },
6866 "scripts" : {
6967 "build" : " run-p build:transpile build:types" ,
You can’t perform that action at this time.
0 commit comments