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

dd-trace

Package Overview
Dependencies
Maintainers
1
Versions
583
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dd-trace

Datadog APM tracing client for JavaScript

  • 3.48.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.6M
decreased by-17.15%
Maintainers
1
Weekly downloads
 
Created

What is dd-trace?

The dd-trace npm package is a Node.js APM (Application Performance Monitoring) client for Datadog. It allows you to monitor the performance of your Node.js applications, providing insights into the runtime and helping you to diagnose and optimize your code.

What are dd-trace's main functionalities?

Tracing

This feature allows you to trace the execution of your application, marking and timing various operations within your code. You can tag spans with metadata and monitor the performance of individual requests or tasks.

const tracer = require('dd-trace').init();

// Instrument a function
tracer.trace('web.request', (span) => {
  // Do some work
  span.setTag('http.status_code', 200);
});

Automatic Instrumentation

dd-trace can automatically instrument popular libraries and frameworks such as Express, Koa, GraphQL, and many others. This means that you can get insights into how these libraries are performing without having to manually instrument code.

const tracer = require('dd-trace').init();

// Automatically instruments supported libraries
const express = require('express');
const app = express();

app.get('/', (req, res) => res.send('Hello World!'));
app.listen(3000);

Custom Tags and Metrics

You can add custom tags and metrics to your traces to provide additional context and granularity. This can be useful for filtering and searching through your traces in the Datadog APM interface.

const tracer = require('dd-trace').init();

// Add custom tags to a span
tracer.trace('web.request', (span) => {
  span.setTag('my_tag', 'my_value');
  span.setMetric('my_metric', 100);
});

Distributed Tracing

Distributed tracing allows you to trace requests as they move across different services and components in your system. This is essential for understanding the performance of microservices architectures.

const tracer = require('dd-trace').init();

// Continue a trace across asynchronous boundaries
async function part1() {
  return tracer.trace('part1', async () => {
    // Do something
  });
}

async function part2() {
  return tracer.trace('part2', async (span) => {
    // Do something else
    span.context().toTraceId();
  });
}

Other packages similar to dd-trace

Keywords

FAQs

Package last updated on 14 Feb 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