How to use the aws-xray-sdk.captureHTTPs function in aws-xray-sdk

To help you get started, we’ve selected a few aws-xray-sdk 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 linuxacademy / eks-deep-dive-2019 / 4-3-XRay / demo-app / service-a / server.js View on Github external
var XRay = require('aws-xray-sdk');            // Initialize X-ray SDK
var AWS = XRay.captureAWS(require('aws-sdk')); // Capture all AWS SDK calls
var http = XRay.captureHTTPs(require('http')); // Capture all HTTP/HTTPS calls

const express = require('express');
var bodyParser = require('body-parser');
var queryString = require('querystring');


// Constants
const PORT = 8080;
const apiCNAME = process.env.API_CNAME || 'localhost';

// App
const app = express();

XRay.config([XRay.plugins.EC2Plugin, XRay.plugins.ECSPlugin]);
XRay.middleware.enableDynamicNaming();
github aws-samples / aws-xray-fargate / src / service-a / server.js View on Github external
// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// A copy of the License is located at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// or in the "license" file accompanying this file. This file is distributed
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
// express or implied. See the License for the specific language governing
// permissions and limitations under the License.

var XRay = require('aws-xray-sdk');
var AWS = XRay.captureAWS(require('aws-sdk'));
var http = XRay.captureHTTPs(require('http'));

const express = require('express');
var bodyParser = require('body-parser');
var queryString = require('querystring');


// Constants
const PORT = 8080;
const apiCNAME = process.env.API_CNAME || 'localhost';

// App
const app = express();

XRay.config([XRay.plugins.ECSPlugin]);
XRay.middleware.enableDynamicNaming();
github cloudacademy / aws-xray-microservices-calc / node-calc / server.js View on Github external
var express     = require('express');
var app         = express();
var bodyParser  = require('body-parser');
var mathsolver  = require("./mathsolver.js");
var calcmetrics = require("./calcmetrics.js");
var xray        = require('aws-xray-sdk');
var querystring = require('querystring');
var shortid     = require('shortid');

var serviceName = "CALCULATOR";
var servicePort = 8080;

xray.middleware.setSamplingRules('sampling-rules.json');
var http = xray.captureHTTPs(require('http'));

app.use(xray.express.openSegment(serviceName));

// configure app to use bodyParser()
// this will let us get the data from a POST
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());

var port = process.env.PORT || servicePort;

// ROUTES FOR OUR API
// =============================================================================
var router = express.Router();

// test route to make sure everything is working (accessed at GET http://localhost:8080/api)
router.get('/', function(req, res) {
github aws-samples / aws-xray-kubernetes / demo-app / service-a / server.js View on Github external
// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// A copy of the License is located at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// or in the "license" file accompanying this file. This file is distributed
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
// express or implied. See the License for the specific language governing
// permissions and limitations under the License.

var XRay = require('aws-xray-sdk');
var AWS = XRay.captureAWS(require('aws-sdk'));
var http = XRay.captureHTTPs(require('http'));

const express = require('express');
var bodyParser = require('body-parser');
var queryString = require('querystring');


// Constants
const PORT = 8080;
const apiCNAME = process.env.API_CNAME || 'localhost';

// App
const app = express();

XRay.config([XRay.plugins.EC2Plugin, XRay.plugins.ECSPlugin]);
XRay.middleware.enableDynamicNaming();
github aws-samples / aws-workshop-for-kubernetes / 03-path-application-development / 306-app-tracing-with-jaeger-and-x-ray / x-ray / nodejs-microservices / webapp / server.js View on Github external
'use strict';

// Include the AWS X-Ray Node.js SDK and set configuration
//ref:  https://docs.aws.amazon.com/xray-sdk-for-nodejs/latest/reference/
const XRay = require('aws-xray-sdk');
const AWS  = XRay.captureAWS(require('aws-sdk'));
const http = XRay.captureHTTPs(require('http'));
const express = require('express');
// const request = require('sync-request');

// Constants
const PORT = 8080;
const HOST = '0.0.0.0';
AWS.config.region = process.env.REGION

XRay.config([XRay.plugins.EC2Plugin, XRay.plugins.ECSPlugin]);
//XRay.middleware.setSamplingRules('sampling-rules.json');
XRay.middleware.enableDynamicNaming('*.elb.amazonaws.com');

// App
const app = express();
app.use(XRay.express.openSegment('webapp'));
github cloudacademy / aws-xray-microservices-calc / node-calc / mathsolver.js View on Github external
var XRay = require('aws-xray-sdk');

XRay.middleware.setSamplingRules('sampling-rules.json');
//XRay.middleware.enableDynamicNaming();
var http = XRay.captureHTTPs(require('http'));

String.prototype.isNumeric = function() {
    return !isNaN(parseFloat(this)) && isFinite(this);
}

Array.prototype.clean = function() {
    for(var i = 0; i < this.length; i++) {
        if(this[i] === "") {
            this.splice(i, 1);
        }
    }
    return this;
}

module.exports = {
    infixToPostfix: function(infix) {