Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aws-xray-sdk-core

Package Overview
Dependencies
Maintainers
24
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-xray-sdk-core

AWS X-Ray SDK for Javascript

  • 3.10.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
24
Created

What is aws-xray-sdk-core?

The aws-xray-sdk-core package is a library for AWS X-Ray, which helps developers analyze and debug production, distributed applications, such as those built using a microservices architecture. With AWS X-Ray, you can trace requests as they travel through your application, gain insights into performance bottlenecks, and identify errors.

What are aws-xray-sdk-core's main functionalities?

Tracing HTTP Requests

This feature allows you to trace HTTP requests made by your application. The `captureHTTPs` method wraps the HTTP module to automatically capture and record data about outgoing HTTP requests.

const AWSXRay = require('aws-xray-sdk-core');
const http = AWSXRay.captureHTTPs(require('http'));

http.get('http://www.example.com', (res) => {
  res.on('data', (chunk) => {
    console.log(`BODY: ${chunk}`);
  });
  res.on('end', () => {
    console.log('No more data in response.');
  });
});

Tracing AWS SDK Calls

This feature allows you to trace AWS SDK calls. The `captureAWS` method wraps the AWS SDK to automatically capture and record data about AWS service calls made by your application.

const AWSXRay = require('aws-xray-sdk-core');
const AWS = AWSXRay.captureAWS(require('aws-sdk'));

const s3 = new AWS.S3();
s3.listBuckets((err, data) => {
  if (err) console.log(err, err.stack);
  else     console.log(data);
});

Custom Subsegments

This feature allows you to create custom subsegments to add more detailed tracing information. The `captureFunc` method creates a subsegment where you can add annotations and metadata to provide more context about the operation being traced.

const AWSXRay = require('aws-xray-sdk-core');

AWSXRay.captureFunc('annotations', function(subsegment) {
  subsegment.addAnnotation('userId', '12345');
  subsegment.addMetadata('key', 'value');
  // Your code here
  subsegment.close();
});
0

Keywords

FAQs

Package last updated on 19 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc