How to use the aws-xray-sdk-core.utils function in aws-xray-sdk-core

To help you get started, we’ve selected a few aws-xray-sdk-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws / aws-xray-sdk-node / packages / express / lib / express_mw.js View on Github external
var endSegment = function () {
        // ensure `endSegment` is only called once
        // in some versions of node.js 10.x and in all versions of node.js 11.x and higher,
        // the 'finish' and 'close' event are BOTH triggered.
        // Previously, only one or the other was triggered:
        // https://github.com/nodejs/node/pull/20611
        if (didEnd) return;
        didEnd = true;
        if (this.statusCode === 429)
          segment.addThrottleFlag();
        if (AWSXRay.utils.getCauseTypeFromHttpStatus(this.statusCode))
          segment[AWSXRay.utils.getCauseTypeFromHttpStatus(this.statusCode)] = true;

        segment.http.close(this);
        segment.close();

        AWSXRay.getLogger().debug('Closed express segment successfully: { url: ' + req.url + ', name: ' + segment.name + ', trace_id: ' +
          segment.trace_id + ', id: ' + segment.id + ', sampled: ' + !segment.notTraced + ' }');
      };
github aws / aws-xray-sdk-node / packages / express / lib / express_mw.js View on Github external
var endSegment = function () {
        // ensure `endSegment` is only called once
        // in some versions of node.js 10.x and in all versions of node.js 11.x and higher,
        // the 'finish' and 'close' event are BOTH triggered.
        // Previously, only one or the other was triggered:
        // https://github.com/nodejs/node/pull/20611
        if (didEnd) return;
        didEnd = true;
        if (this.statusCode === 429)
          segment.addThrottleFlag();
        if (AWSXRay.utils.getCauseTypeFromHttpStatus(this.statusCode))
          segment[AWSXRay.utils.getCauseTypeFromHttpStatus(this.statusCode)] = true;

        segment.http.close(this);
        segment.close();

        AWSXRay.getLogger().debug('Closed express segment successfully: { url: ' + req.url + ', name: ' + segment.name + ', trace_id: ' +
          segment.trace_id + ', id: ' + segment.id + ', sampled: ' + !segment.notTraced + ' }');
      };