Set Up Tracing
Learn how to enable tracing in your app.
As soon as you define a tracesSampleRate
for your Sentry SDK, Tracing will be enabled. This will automatically instrument and monitor the performance of your application.
If you’re adopting Tracing in a high-throughput environment, we recommend testing prior to deployment to ensure that your service’s performance characteristics maintain expectations.
instrument.mjs
Copied
import * as Sentry from "@sentry/nestjs";
import { nodeProfilingIntegration } from '@sentry/profiling-node';
// Ensure to call this before importing any other modules!
Sentry.init({
dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
integrations: [
// Add our Profiling integration
nodeProfilingIntegration(),
],
// Add Tracing by setting tracesSampleRate
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
// Set sampling rate for profiling
// This is relative to tracesSampleRate
profilesSampleRate: 1.0,
});
See Automatic Instrumentation to learn about everything the SDK automatically instruments for you.
You can also manually start spans to instrument specific parts of your code. This is useful when you want to measure the performance of a specific operation or function.
See Custom Instrumentation to learn how to manually start spans.
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").