---
title: "Tracing"
description: "Learn how to enable tracing in your app using the Sentry Rust SDK and see where requests and jobs fail or slow down."
url: https://docs.sentry.io/platforms/rust/guides/actix-web/tracing/
---

# Set Up Tracing for Actix Web

With [tracing](https://docs.sentry.io/concepts/key-terms/tracing.md), Sentry follows requests and background jobs across services so you can see where they fail or slow down. Spans record each service and the operations inside it. Learn more in [Distributed Tracing](https://docs.sentry.io/concepts/key-terms/tracing/distributed-tracing.md).

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.

## [Configure](https://docs.sentry.io/platforms/rust/guides/actix-web/tracing.md#configure)

First, enable tracing and configure the sample rate for transactions. Set the sample rate for your transactions by either:

* Setting a uniform sample rate for all transactions using the `traces_sample_rate` option in your SDK config to a number between `0` and `1`. (For example, to send 20% of transactions, set `traces_sample_rate` to `0.2`.)
* Controlling the sample rate based on the transaction itself and the context in which it's captured, by providing a function to the `traces_sampler` config option.

These builders select mutually exclusive strategies. The last sampling builder called wins. Tracing defaults to disabled (`TracesSamplingStrategy::Disabled`); you must configure a non-disabled strategy before transactions are sent. An explicit `.traces_sample_rate(0.0)` is not the same as leaving tracing disabled, because the fixed-rate strategy can still honor an inherited parent sampling decision.

```rust
let _guard = sentry::init(
    sentry::ClientOptions::new()
        .maybe_release(sentry::release_name!())
        // To set a uniform sample rate
        .traces_sample_rate(0.2),
);
```

Learn more about tracing [options](https://docs.sentry.io/platforms/rust/guides/actix-web/configuration/options.md#tracing-options), or how to [sample transactions](https://docs.sentry.io/platforms/rust/guides/actix-web/configuration/sampling.md#sampling-transaction-events).

## [Verify](https://docs.sentry.io/platforms/rust/guides/actix-web/tracing.md#verify)

Verify that tracing is working correctly by using our [automatic instrumentation](https://docs.sentry.io/platforms/rust/guides/actix-web/tracing/instrumentation/automatic-instrumentation.md) or by starting and finishing a transaction using [custom instrumentation](https://docs.sentry.io/platforms/rust/guides/actix-web/tracing/instrumentation/custom-instrumentation.md).

While you're testing, set `traces_sample_rate` to `1.0`, as that ensures that every transaction will be sent to Sentry. Once testing is complete, you may want to set a lower `traces_sample_rate` value, or switch to using `traces_sampler` to selectively sample and filter your transactions, based on contextual data.

## [Next Steps](https://docs.sentry.io/platforms/rust/guides/actix-web/tracing.md#next-steps)

* #### [Instrumentation](https://docs.sentry.io/platforms/rust/guides/actix-web/tracing/instrumentation.md)

  Learn how to instrument tracing in your app using Sentry's Rust SDK.

* #### [Trace Propagation](https://docs.sentry.io/platforms/rust/guides/actix-web/tracing/trace-propagation.md)

  Learn how to connect events across applications/services using the Sentry Rust SDK.

## Pages in this section

- [Instrumentation](https://docs.sentry.io/platforms/rust/guides/actix-web/tracing/instrumentation.md)
- [Trace Propagation](https://docs.sentry.io/platforms/rust/guides/actix-web/tracing/trace-propagation.md)

---

Find other pages: [Sitemap](https://docs.sentry.io/sitemap.md) lists every page with a one-line summary, and [llms.txt](https://docs.sentry.io/llms.txt) gives an overview with guidance for agents.
