File tree Expand file tree Collapse file tree 3 files changed +7
-8
lines changed
opentelemetry-instrumentation-aws-lambda/src
opentelemetry-instrumentation-aws-sdk/src/services Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ const tracer = setupTracing('example-redis-server');
77import * as express from 'express' ;
88import axios from 'axios' ;
99import * as tracerHandlers from './express-tracer-handlers' ;
10+ import { randomBytes } from 'crypto' ;
1011const redisPromise = require ( './setup-redis' ) . redis ;
1112
1213// Setup express
@@ -20,12 +21,7 @@ async function setupRoutes() {
2021 const redis = await redisPromise ;
2122
2223 app . get ( '/run_test' , async ( req : express . Request , res : express . Response ) => {
23- const uuid = Math . random ( )
24- . toString ( 36 )
25- . substring ( 2 , 15 )
26- + Math . random ( )
27- . toString ( 36 )
28- . substring ( 2 , 15 ) ;
24+ const uuid = randomBytes ( 16 ) . toString ( 'hex' ) ;
2925 await axios . get ( `http://localhost:${ PORT } /set?args=uuid,${ uuid } ` ) ;
3026 const body = await axios . get ( `http://localhost:${ PORT } /get?args=uuid` ) ;
3127
Original file line number Diff line number Diff line change @@ -90,7 +90,10 @@ export class AwsLambdaInstrumentation extends InstrumentationBase<AwsLambdaInstr
9090 }
9191
9292 const handler = path . basename ( handlerDef ) ;
93- const moduleRoot = handlerDef . substr ( 0 , handlerDef . length - handler . length ) ;
93+ const moduleRoot = handlerDef . substring (
94+ 0 ,
95+ handlerDef . length - handler . length
96+ ) ;
9497
9598 const [ module , functionName ] = handler . split ( '.' , 2 ) ;
9699
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ export class SnsServiceExtension implements ServiceExtension {
9393 if ( topicArn || targetArn ) {
9494 const arn = topicArn ?? targetArn ;
9595 try {
96- return arn . substr ( arn . lastIndexOf ( ':' ) + 1 ) ;
96+ return arn . substring ( arn . lastIndexOf ( ':' ) + 1 ) ;
9797 } catch ( err ) {
9898 return arn ;
9999 }
You can’t perform that action at this time.
0 commit comments