Get started with sentry-tracing CDN

MIT licensed

Sentry-tracing is a library for automatic instrumentation and distributed tracing of application performance.

Tags:
  • crash-reporting
  • error-monitoring
  • sentry
  • raven
  • sentry-client

Stable version

Copied!

How to start using sentry-tracing CDN


const express = require('express');
const { SentryTrace } = require('@sentry/tracing');
const { SentryInit } = require('@sentry/node');

const app = express();
const tracing = new SentryTrace();

SentryInit({
  dsn: 'your-dsn-here', // replace with your Sentry DSN
  integrations: [
    new SentryTrace.Integrations.Express({ app }),
  ],
});

app.get('/', async (req, res) => {
  const transaction = tracing.startTransaction('handle-request', {
    op: 'handle-request',
    description: 'Processing request',
  });

  try {
    // Your request handling logic here
    const data = 'Hello, World!';

    transaction.setTag('status', 'success');
    transaction.finish();

    res.send(data);
  } catch (error) {
    transaction.setTag('status', 'error');
    transaction.setTag('error.message', error.message);
    transaction.finish();

    res.status(500).send('An error occurred');
  }
});

app.listen(3000, () => {
  console.log('Server listening on port 3000');
});

// Include the CDN script at the end of your HTML files
<script src="https://cdn.cdnhub.io/sentry-tracing/7.107.0/bundle.tracing.min.js"></script>

All versions

6.17.4 6.17.5 6.17.6 6.17.7 6.17.8 6.17.8-beta.0 6.17.9 6.18.0 6.18.1 6.18.1-beta.0 6.18.2 6.19.0 6.19.1 6.19.2 6.19.3 6.19.4 6.19.5 6.19.6 6.19.7 7.0.0 7.0.0-alpha.0 7.0.0-alpha.1 7.0.0-beta.0 7.0.0-beta.1 7.0.0-beta.2 7.0.0-rc.0 7.1.0 7.1.1 7.10.0 7.100.0 7.100.1 7.101.0 7.101.1 7.102.0 7.102.1 7.103.0 7.104.0 7.105.0 7.106.0 7.106.1 7.107.0 7.108.0 7.109.0 7.11.0 7.11.1 7.110.0 7.110.1 7.111.0 7.112.0 7.112.1 7.112.2 7.113.0 7.114.0 7.115.0 7.116.0 7.117.0 *** 7.118.0 7.12.0 7.12.1 7.13.0 7.14.0 7.14.1 7.14.2 7.15.0 7.16.0 7.17.0 7.17.1 7.17.2 7.17.3 7.17.4 7.18.0 7.19.0 7.2.0 7.20.0 7.20.1 7.21.0 7.21.1 7.22.0 7.23.0 7.24.0 7.24.1 7.24.2 7.25.0 7.26.0 7.27.0 7.28.0 7.28.1 7.29.0 7.3.0 7.3.1 7.30.0 7.31.0 7.31.1 7.32.0 7.32.1 7.33.0 7.34.0 7.34.0-beta.0 7.35.0 7.36.0 7.37.0 7.37.1 7.37.2 7.38.0 7.39.0 7.4.0 7.4.1 7.40.0 7.41.0 7.42.0 7.43.0 7.44.0 7.44.1 7.44.2 7.45.0 7.46.0 7.47.0 7.48.0 7.49.0 7.5.0 7.5.1 7.50.0 7.51.0 7.51.1 7.51.2 7.52.0 7.52.1 7.53.0 7.53.1 7.54.0 7.55.0 7.55.1 7.55.2 7.56.0 7.57.0 7.57.0-beta.0 7.58.0 7.58.1 7.59.0 7.59.0-beta.0 7.59.0-beta.1 7.59.1 7.59.2 7.59.3 7.6.0 7.60.0 7.60.1 7.61.0 7.61.1 7.62.0 7.63.0 7.64.0 7.64.0-alpha.0 7.65.0 7.65.0-alpha.0 7.66.0 7.66.0-alpha.0 7.67.0 7.67.0-beta.0 7.68.0 7.69.0 7.7.0 7.70.0 7.70.0-beta.0 7.70.0-beta.1 7.71.0 7.72.0 7.73.0 7.74.0 7.74.1 7.74.2-alpha.1 7.75.0 7.75.1 7.76.0 7.77.0 7.78.0 7.79.0 7.8.0 7.8.1 7.80.0 7.80.1 7.80.2-alpha.0 7.80.2-alpha.1 7.81.0 7.81.1 7.82.0 7.83.0 7.84.0 7.85.0 7.86.0 7.87.0 7.88.0 7.89.0 7.9.0 7.90.0 7.91.0 7.92.0 7.93.0 7.94.1 7.95.0 7.97.0 7.98.0 7.99.0