How to use the aws-xray-sdk-core.setSegment 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 terodox / aws-xray-lambda-promise-subsegment / demo / index.js View on Github external
namespace.run(async function () {
            AWSXRay.setSegment(segment);
console.log('segment', segment);
            try {
                await functionToHaveTraced(segment);
                segment.close();
            } catch (error) {
                console.error(error);
                segment.close(error);
            }
            resolve();
        });
    });
github aws / aws-xray-sdk-node / packages / mysql / lib / mysql_p.js View on Github external
session.run(function() {
            AWSXRay.setSegment(subsegment);
            cb(err, data);
          });
github aws / aws-xray-sdk-node / packages / postgres / lib / postgres_p.js View on Github external
session.run(function() {
          AWSXRay.setSegment(subsegment);
          cb(err, data);
        });
github aws-samples / voteapp / src / web / xray-axios.js View on Github external
axios.interceptors.request.use(function (config) {
    var parent = xray.getSegment();
    var subsegment = parent.addNewSubsegment(config.baseURL + config.url.substr(1));
    subsegment.namespace = 'remote';

    let root = parent.segment ? parent.segment : parent;
    let header = 'Root=' + root.trace_id + ';Parent=' + subsegment.id + ';Sampled=' + (!root.notTraced ? '1' : '0');
    config.headers.get={ 'x-amzn-trace-id': header };
    config.headers.post={ 'x-amzn-trace-id': header };

    xray.setSegment(subsegment);

    return config;
  }, function (error) {
    var subsegment = xray.getSegment().addNewSubsegment("Intercept request error");
github aws / aws-xray-sdk-node / packages / express / lib / express_mw.js View on Github external
ns.run(function () {
          AWSXRay.setSegment(segment);

          if (next) { next(); }
        });
      } else {