idea-aws 4.4.6 → 4.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,6 +32,8 @@ export declare abstract class ResourceController extends GenericController {
32
32
  protected logRequestsWithKey: string;
33
33
  protected metrics: CloudWatchMetrics;
34
34
  protected tracer: Tracer;
35
+ protected tracerLambdaSegment: any;
36
+ protected tracerRCSegment: any;
35
37
  protected currentLang: string;
36
38
  protected defaultLang: string;
37
39
  protected translations: any;
@@ -55,12 +55,11 @@ class ResourceController extends genericController_1.GenericController {
55
55
  if (this.initError)
56
56
  return;
57
57
  this.logger.info('START', { event: this.getEventSummary() });
58
- let lambdaSegment, rcSegment;
59
58
  if (this.tracer) {
60
- lambdaSegment = this.tracer.getSegment();
61
- if (lambdaSegment) {
62
- rcSegment = lambdaSegment.addNewSubsegment('RC');
63
- this.tracer.setSegment(rcSegment);
59
+ this.tracerLambdaSegment = this.tracer.getSegment();
60
+ if (this.tracerLambdaSegment) {
61
+ this.tracerRCSegment = this.tracerLambdaSegment.addNewSubsegment('RC');
62
+ this.tracer.setSegment(this.tracerRCSegment);
64
63
  }
65
64
  this.tracer.annotateColdStart();
66
65
  this.tracer.addServiceNameAnnotation();
@@ -129,12 +128,6 @@ class ResourceController extends genericController_1.GenericController {
129
128
  catch (err) {
130
129
  this.done(this.handleControllerError(err, 'AUTH-CHECK-ERROR', 'Forbidden'));
131
130
  }
132
- finally {
133
- if (this.tracer && lambdaSegment && rcSegment) {
134
- rcSegment.close();
135
- this.tracer.setSegment(lambdaSegment);
136
- }
137
- }
138
131
  };
139
132
  this.event = event;
140
133
  this.callback = callback;
@@ -251,6 +244,12 @@ class ResourceController extends genericController_1.GenericController {
251
244
  }
252
245
  else
253
246
  this.logger.info('END-SUCCESS', finalLogContent);
247
+ if (this.tracer) {
248
+ if (this.tracerRCSegment)
249
+ this.tracerRCSegment.close();
250
+ if (this.tracerLambdaSegment)
251
+ this.tracer.setSegment(this.tracerLambdaSegment);
252
+ }
254
253
  if (this.logRequestsWithKey)
255
254
  this.storeLog(!error);
256
255
  if (this.metrics)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idea-aws",
3
- "version": "4.4.6",
3
+ "version": "4.4.7",
4
4
  "description": "AWS wrappers to use in IDEA's back-ends",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",