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 4949    "mysql2" : " ^3.7.1" 
5050    "nock" : " ^13.1.0" 
5151    "pg" : " ^8.7.3" 
52+     "@aws-sdk/client-s3" : " ^3.552.0" 
5253    "proxy" : " ^2.1.1" 
5354    "reflect-metadata" : " 0.2.1" 
5455    "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 }  ) . get ( `/${ keyName }  ) . reply ( 200 ,  'contents' ) ; 
19+   nock ( `https://${ bucketName }  ) . 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 }  ) 
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 6262    "@types/express" : " ^4.17.14" 
6363  },
6464  "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" 
7066  },
7167  "scripts" : {
7268    "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