@@ -144,12 +144,12 @@ class Tracer implements TracerInterface {
144144 * @param error - Error to serialize as metadata
145145 */
146146 public addErrorAsMetadata ( error : Error ) : void {
147- if ( this . isTracingEnabled ( ) === false ) {
147+ if ( ! this . isTracingEnabled ( ) ) {
148148 return ;
149149 }
150150
151151 const subsegment = this . getSegment ( ) ;
152- if ( this . captureError === false ) {
152+ if ( ! this . captureError ) {
153153 subsegment . addErrorFlag ( ) ;
154154
155155 return ;
@@ -167,7 +167,7 @@ class Tracer implements TracerInterface {
167167 * @param methodName - Name of the method that is being traced
168168 */
169169 public addResponseAsMetadata ( data ?: unknown , methodName ?: string ) : void {
170- if ( data === undefined || this . captureResponse === false || this . isTracingEnabled ( ) === false ) {
170+ if ( data === undefined || ! this . captureResponse || ! this . isTracingEnabled ( ) ) {
171171 return ;
172172 }
173173
@@ -179,7 +179,7 @@ class Tracer implements TracerInterface {
179179 *
180180 */
181181 public addServiceNameAnnotation ( ) : void {
182- if ( this . isTracingEnabled ( ) === false || this . serviceName === undefined ) {
182+ if ( ! this . isTracingEnabled ( ) || this . serviceName === undefined ) {
183183 return ;
184184 }
185185 this . putAnnotation ( 'Service' , this . serviceName ) ;
@@ -188,17 +188,17 @@ class Tracer implements TracerInterface {
188188 /**
189189 * Add ColdStart annotation to the current segment or subsegment.
190190 *
191- * If Tracer has been initialized outside of the Lambda handler then the same instance
192- * of Tracer will be reused throghout the lifecycle of that same Lambda execution environment
191+ * If Tracer has been initialized outside the Lambda handler then the same instance
192+ * of Tracer will be reused throughout the lifecycle of that same Lambda execution environment
193193 * and this method will annotate `ColdStart: false` after the first invocation.
194194 *
195195 * @see https://docs.aws.amazon.com/lambda/latest/dg/runtimes-context.html
196196 */
197197 public annotateColdStart ( ) : void {
198- if ( this . isTracingEnabled ( ) === true ) {
198+ if ( this . isTracingEnabled ( ) ) {
199199 this . putAnnotation ( 'ColdStart' , Tracer . coldStart ) ;
200200 }
201- if ( Tracer . coldStart === true ) {
201+ if ( Tracer . coldStart ) {
202202 Tracer . coldStart = false ;
203203 }
204204 }
@@ -226,7 +226,7 @@ class Tracer implements TracerInterface {
226226 * @returns AWS - Instrumented AWS SDK
227227 */
228228 public captureAWS < T > ( aws : T ) : T {
229- if ( this . isTracingEnabled ( ) === false ) return aws ;
229+ if ( ! this . isTracingEnabled ( ) ) return aws ;
230230
231231 return this . provider . captureAWS ( aws ) ;
232232 }
@@ -255,7 +255,7 @@ class Tracer implements TracerInterface {
255255 * @returns service - Instrumented AWS SDK v2 client
256256 */
257257 public captureAWSClient < T > ( service : T ) : T {
258- if ( this . isTracingEnabled ( ) === false ) return service ;
258+ if ( ! this . isTracingEnabled ( ) ) return service ;
259259
260260 return this . provider . captureAWSClient ( service ) ;
261261 }
@@ -285,7 +285,7 @@ class Tracer implements TracerInterface {
285285 * @returns service - Instrumented AWS SDK v3 client
286286 */
287287 public captureAWSv3Client < T > ( service : T ) : T {
288- if ( this . isTracingEnabled ( ) === false ) return service ;
288+ if ( ! this . isTracingEnabled ( ) ) return service ;
289289
290290 return this . provider . captureAWSv3Client ( service ) ;
291291 }
@@ -326,7 +326,7 @@ class Tracer implements TracerInterface {
326326 const originalMethod = descriptor . value ;
327327
328328 descriptor . value = ( ( event , context , callback ) => {
329- if ( this . isTracingEnabled ( ) === false ) {
329+ if ( ! this . isTracingEnabled ( ) ) {
330330 return originalMethod ?. apply ( target , [ event , context , callback ] ) ;
331331 }
332332
@@ -393,7 +393,7 @@ class Tracer implements TracerInterface {
393393 const originalMethod = descriptor . value ;
394394
395395 descriptor . value = ( ...args : unknown [ ] ) => {
396- if ( this . isTracingEnabled ( ) === false ) {
396+ if ( ! this . isTracingEnabled ( ) ) {
397397 return originalMethod ?. apply ( target , [ ...args ] ) ;
398398 }
399399
@@ -421,16 +421,16 @@ class Tracer implements TracerInterface {
421421 /**
422422 * Retrieve the current value of `ColdStart`.
423423 *
424- * If Tracer has been initialized outside of the Lambda handler then the same instance
425- * of Tracer will be reused throghout the lifecycle of that same Lambda execution environment
424+ * If Tracer has been initialized outside the Lambda handler then the same instance
425+ * of Tracer will be reused throughout the lifecycle of that same Lambda execution environment
426426 * and this method will return `false` after the first invocation.
427427 *
428428 * @see https://docs.aws.amazon.com/lambda/latest/dg/runtimes-context.html
429429 *
430430 * @returns boolean - `true` if is cold start, otherwise `false`
431431 */
432432 public static getColdStart ( ) : boolean {
433- if ( Tracer . coldStart === true ) {
433+ if ( Tracer . coldStart ) {
434434 Tracer . coldStart = false ;
435435
436436 return true ;
@@ -505,7 +505,7 @@ class Tracer implements TracerInterface {
505505 * @param value - Value for annotation
506506 */
507507 public putAnnotation ( key : string , value : string | number | boolean ) : void {
508- if ( this . isTracingEnabled ( ) === false ) return ;
508+ if ( ! this . isTracingEnabled ( ) ) return ;
509509
510510 const document = this . getSegment ( ) ;
511511 if ( document instanceof Segment ) {
@@ -535,10 +535,10 @@ class Tracer implements TracerInterface {
535535 *
536536 * @param key - Metadata key
537537 * @param value - Value for metadata
538- * @param timestamp - Namespace that metadata will lie under, if none is passed it will use the serviceName
538+ * @param namespace - Namespace that metadata will lie under, if none is passed it will use the serviceName
539539 */
540540 public putMetadata ( key : string , value : unknown , namespace ?: string | undefined ) : void {
541- if ( this . isTracingEnabled ( ) === false ) return ;
541+ if ( ! this . isTracingEnabled ( ) ) return ;
542542
543543 const document = this . getSegment ( ) ;
544544 if ( document instanceof Segment ) {
@@ -617,7 +617,7 @@ class Tracer implements TracerInterface {
617617 *
618618 * @param serviceName - Service name to validate
619619 */
620- private isValidServiceName ( serviceName ?: string ) : boolean {
620+ private static isValidServiceName ( serviceName ?: string ) : boolean {
621621 return typeof serviceName === 'string' && serviceName . trim ( ) . length > 0 ;
622622 }
623623
@@ -709,21 +709,21 @@ class Tracer implements TracerInterface {
709709 * @param serviceName - Name of the service to use
710710 */
711711 private setServiceName ( serviceName ?: string ) : void {
712- if ( serviceName !== undefined && this . isValidServiceName ( serviceName ) ) {
712+ if ( serviceName !== undefined && Tracer . isValidServiceName ( serviceName ) ) {
713713 this . serviceName = serviceName ;
714714
715715 return ;
716716 }
717717
718718 const customConfigValue = this . getCustomConfigService ( ) ?. getServiceName ( ) ;
719- if ( customConfigValue !== undefined && this . isValidServiceName ( customConfigValue ) ) {
719+ if ( customConfigValue !== undefined && Tracer . isValidServiceName ( customConfigValue ) ) {
720720 this . serviceName = customConfigValue ;
721721
722722 return ;
723723 }
724724
725725 const envVarsValue = this . getEnvVarsService ( ) ?. getServiceName ( ) ;
726- if ( envVarsValue !== undefined && this . isValidServiceName ( envVarsValue ) ) {
726+ if ( envVarsValue !== undefined && Tracer . isValidServiceName ( envVarsValue ) ) {
727727 this . serviceName = envVarsValue ;
728728
729729 return ;
@@ -737,7 +737,7 @@ class Tracer implements TracerInterface {
737737 * @param enabled - Whether or not tracing is enabled
738738 */
739739 private setTracingEnabled ( enabled ?: boolean ) : void {
740- if ( enabled !== undefined && enabled === false ) {
740+ if ( enabled !== undefined && ! enabled ) {
741741 this . tracingEnabled = enabled ;
742742
743743 return ;
@@ -757,7 +757,7 @@ class Tracer implements TracerInterface {
757757 return ;
758758 }
759759
760- if ( this . isLambdaSamCli ( ) || this . isLambdaExecutionEnv ( ) === false ) {
760+ if ( this . isLambdaSamCli ( ) || ! this . isLambdaExecutionEnv ( ) ) {
761761 this . tracingEnabled = false ;
762762 }
763763 }
0 commit comments