Skip to content

Create Subsegments and Tracing Headers for AWS X-Ray

License

Notifications You must be signed in to change notification settings

bbc/http-transport-xray

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NPM downloads Build Status npm license github-issues stars forks

HTTP Transport Cache

HTTP Transport X-Ray

Create X-Ray subsegments and add Tracing Header for use with X-Ray in manual mode.

Installation

npm install --save @bbc/http-transport-xray

Usage

Use per call. Pass in a segment to create a subsegment for that call, identified by the host name.

const HttpTransport = require('@bbc/http-transport');
const AWSXRay = require('aws-xray-sdk');
const xray = require('@bbc/http-transport-xray').middleware;

const segment = new AWSXRay.Segment('mySegment');

const client = HttpTransport.createClient();

client
  .use(xray(segment))
  .get(url)
  .asResponse();

Test

npm test