Socket
Socket
Sign inDemoInstall

@sentry/tracing

Package Overview
Dependencies
Maintainers
11
Versions
312
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sentry/tracing

Sentry Performance Monitoring Package


Version published
Weekly downloads
2.1M
increased by5.2%
Maintainers
11
Weekly downloads
 
Created

What is @sentry/tracing?

The @sentry/tracing package provides performance monitoring and distributed tracing for applications. It allows developers to track the performance of their applications, understand latency issues, and monitor the flow of requests through various services in a distributed system.

What are @sentry/tracing's main functionalities?

Automatic Instrumentation

Automatically instruments the application to collect performance data. This includes capturing data for outgoing HTTP requests when using the Sentry.Integrations.Http integration.

const Sentry = require('@sentry/node');
const Tracing = require('@sentry/tracing');

Sentry.init({
  dsn: 'YOUR_DSN',
  tracesSampleRate: 1.0,
  integrations: [new Sentry.Integrations.Http({ tracing: true })],
});

Manual Instrumentation

Allows developers to manually create transactions to trace specific operations or workflows within their application.

const transaction = Sentry.startTransaction({
  op: 'test',
  name: 'My Transaction',
});

// ... your code here ...

transaction.finish();

Performance Monitoring

Integrates with web frameworks like Express to provide performance monitoring for web applications. This includes automatic tracing of requests and responses.

const express = require('express');
const app = express();
const Sentry = require('@sentry/node');
const Tracing = require('@sentry/tracing');

Sentry.init({
  dsn: 'YOUR_DSN',
  integrations: [
    new Sentry.Integrations.Http({ tracing: true }),
    new Tracing.Integrations.Express({ app }),
  ],
  tracesSampleRate: 1.0,
});

app.use(Sentry.Handlers.requestHandler());
app.use(Sentry.Handlers.tracingHandler());

// All controllers should live here

app.use(Sentry.Handlers.errorHandler());

app.listen(3000);

Distributed Tracing

Supports distributed tracing by allowing services to pass trace context in HTTP headers, enabling the tracking of requests across service boundaries.

const transaction = Sentry.startTransaction({
  op: 'http',
  name: 'My HTTP Request',
});

fetch('https://example.com', {
  method: 'GET',
  headers: {
    'Sentry-Trace': transaction.toTraceparent(),
  },
})
  .then(response => {
    // ... process the response ...
  })
  .finally(() => {
    transaction.finish();
  });

Other packages similar to @sentry/tracing

FAQs

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