How to use the aws-xray-sdk-core.captureHTTPsGlobal 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 jaydp17 / series-notifier-serverless / src / process-query-function / index.ts View on Github external
import { env } from '../common/environment';
import * as InternalTypes from '../common/internal-message-types';
import { invokeMessengerReply } from '../common/lambda-utils';
import * as Subscription from '../models/subscription';
import * as ActionHelper from './action-helper';
import * as NextEpisodeController from './controllers/next-episode.controller';
import * as SearchController from './controllers/search.controller';
import * as TrendingController from './controllers/trending.controller';

const { ActionTypes, ReplyKind } = InternalTypes;

if (!process.env.IS_LOCAL) {
  // tslint:disable-next-line: no-console
  console.log('capturing outgoing http calls in X-Ray');
  // tslint:disable-next-line no-var-requires
  AWSXRay.captureHTTPsGlobal(require('http'));
}

export async function handler(
  action: InternalTypes.AnyAction,
  context: {},
  callback: LambdaCallback,
): Promise {
  if (env !== 'test') {
    console.log('entry'); // tslint:disable-line:no-console
    prettyPrint(action);
  }

  const socialId = ActionHelper.getSocialId(action);

  // compute the reply
  let reply;
github jaydp17 / series-notifier-serverless / src / messenger-reply-function / index.ts View on Github external
import { LambdaCallback } from '../common/aws-lambda-types';
import { getError } from '../common/common-utils';
import { errorMessages } from '../common/constants';
import { env } from '../common/environment';
import * as InternalTypes from '../common/internal-message-types';
import * as MessengerTypes from '../common/messenger-types';
import * as MessengerAPI from '../common/messenger.api';
import { generateGenericTemplate } from './messenger.formatter';

const { ReplyKind } = InternalTypes;

if (!process.env.IS_LOCAL) {
  // tslint:disable-next-line: no-console
  console.log('capturing outgoing http calls in X-Ray');
  // tslint:disable-next-line no-var-requires
  AWSXRay.captureHTTPsGlobal(require('http'));
}

export async function handler(
  reply: InternalTypes.AnyReplyKind,
  context: {},
  callback: LambdaCallback,
): Promise {
  if (env !== 'test') {
    console.log('input', JSON.stringify(reply)); // tslint:disable-line:no-console
  }

  if (isEmpty(reply.metaData)) {
    return callback(new Error('no metaData'));
  }
  const metaData = reply.metaData.fbMessenger;
  if (isEmpty(metaData)) {
github luisfarzati / chromda / src / captureScreenshot.js View on Github external
const AWSXRay = require("aws-xray-sdk-core");
AWSXRay.captureHTTPsGlobal(require("https"), true);
const { URL } = require("url");
const chromeLambda = require("chrome-aws-lambda");
const MrPuppetshot = require("mrpuppetshot");
const normalizeEvent = require("./helpers/normalizeEvent");
const S3Bucket = require("./helpers/s3bucket");

// Defaults
const CHROMIUM_ARGS = JSON.parse(process.env.CHROMIUM_ARGS || "[]");
const TIMEOUT = Number(process.env.TIMEOUT) || 30 * 1000;
const IGNORE_HTTPS_ERRORS = process.env.IGNORE_HTTPS_ERRORS === "true";
const VIEWPORT_WIDTH = Number(process.env.VIEWPORT_WIDTH) || 1920;
const VIEWPORT_HEIGHT = Number(process.env.VIEWPORT_HEIGHT) || 1200;
const DEVICE_SCALE_FACTOR = Number(process.env.DEVICE_SCALE_FACTOR) || 1;
const IS_MOBILE = process.env.IS_MOBILE === "true";
const IS_LANDSCAPE = process.env.IS_LANDSCAPE === "true";
github lifeomic / lambda-tools / src / xray.js View on Github external
exports.captureWithXRay = function (awsSdk) {
  const xray = require('aws-xray-sdk-core');

  xray.captureHTTPsGlobal(require('http'));
  xray.capturePromise();
  return xray.captureAWS(awsSdk);
};