Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ title: Transaction Name
description: "Learn how to set or override the transaction name to capture the user and gain critical pieces of information that construct a unique identity in Sentry."
---

<Alert>

This page only applies to transaction mode. In stream mode, there's no separate transaction name — set the span name when you create it with `Sentry.startSpan('name', ...)`. See <PlatformLink to="/tracing/streamed-spans/">Streamed Spans</PlatformLink> for details.

</Alert>

The current transaction name is used to group transactions in our
[Sentry Dashboards](/product/dashboards/sentry-dashboards/) product, as well as annotate error events
with their point of failure.
Expand Down
2 changes: 1 addition & 1 deletion docs/platforms/dart/common/features/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Sentry's Dart SDK enables automatic reporting of errors and exceptions, and iden
your event by storing additional files, such as config or log files.
- <PlatformLink to="/user-feedback/">User Feedback</PlatformLink> provides the
ability to collect user information when an event occurs.
- <Link to="/product/dashboards/sentry-dashboards/">Tracing</Link> creates transactions for:
- <Link to="/product/dashboards/sentry-dashboards/">Tracing</Link> captures spans for:
- <PlatformLink to="/integrations/http-integration/#performance-monitoring-for-http-requests">HTTP requests</PlatformLink>.
- <PlatformLink to="/integrations/dio/#performance-monitoring-for-http-requests">Dio HTTP library</PlatformLink>.
- <PlatformLink to="/integrations/file">File I/O Integration</PlatformLink>.
Expand Down
22 changes: 14 additions & 8 deletions docs/platforms/dart/common/tracing/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,36 @@ With [tracing](/product/dashboards/sentry-dashboards/), Sentry tracks your softw

<Alert>

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.
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.

</Alert>

<Alert>

Sentry can send spans in one of two ways: the default transaction mode or stream mode, where spans are streamed to Sentry as they finish. See <PlatformLink to="/tracing/streamed-spans/">Streamed Spans</PlatformLink> to learn more.

</Alert>

## Configure

First, enable tracing and configure the sample rate for transactions. Set the sample rate for your transactions by either:
First, enable tracing and configure the sample rate for transactions (or service spans in stream mode). Set the sample rate by either:

- Setting a uniform sample rate for all transactions using the <PlatformIdentifier name="traces-sample-rate" /> option in your SDK config to a number between `0` and `1`. (For example, to send 20% of transactions, set <PlatformIdentifier name="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 <PlatformIdentifier name="traces-sampler" /> config option.
- Setting a uniform sample rate for all transactions/service spans using the <PlatformIdentifier name="traces-sample-rate" /> option in your SDK config to a number between `0` and `1`. (For example, to send 20% of transactions/service spans, set <PlatformIdentifier name="traces-sample-rate" /> to `0.2`.)
- Controlling the sample rate based on the transaction/service span itself and the context in which it's captured, by providing a function to the <PlatformIdentifier name="traces-sampler" /> config option.

The two options are meant to be mutually exclusive. If you set both, <PlatformIdentifier name="traces-sampler" /> will take precedence.

<PlatformContent includePath="performance/configure-sample-rate" />

Learn more about tracing <PlatformLink to="/configuration/options/#tracing-options">options</PlatformLink>, how to use the <PlatformLink to="/configuration/sampling/#setting-a-sampling-function">tracesSampler</PlatformLink> function, or how to <PlatformLink to="/configuration/sampling/#sampling-transaction-events">sample transactions</PlatformLink>.
Learn more about tracing <PlatformLink to="/configuration/options/#tracing-options">options</PlatformLink>, how to use the <PlatformLink to="/configuration/sampling/#setting-a-sampling-function">tracesSampler</PlatformLink> function, or how to <PlatformLink to="/configuration/sampling/#sampling-transaction-events">sample transactions and service spans</PlatformLink>.

## Verify

Verify that tracing is working correctly by using our <PlatformLink to="/tracing/instrumentation/automatic-instrumentation/">automatic instrumentation</PlatformLink> or by starting and finishing a transaction using <PlatformLink to="/tracing/instrumentation/custom-instrumentation/">custom instrumentation</PlatformLink>.
Verify that tracing is working correctly by using our <PlatformLink to="/tracing/instrumentation/automatic-instrumentation/">automatic instrumentation</PlatformLink> or by starting and finishing a transaction/service span using <PlatformLink to="/tracing/instrumentation/custom-instrumentation/">custom instrumentation</PlatformLink>.

Test out tracing by starting and finishing a transaction, which you _must_ do so transactions can be sent to Sentry. Learn how in our <PlatformLink to="/tracing/instrumentation/custom-instrumentation/">Custom Instrumentation</PlatformLink> content.
Test out tracing by starting and finishing a transaction/service span, which you _must_ do so data can be sent to Sentry. Learn how in our <PlatformLink to="/tracing/instrumentation/custom-instrumentation/">Custom Instrumentation</PlatformLink> content.

While you're testing, set <PlatformIdentifier name="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 <PlatformIdentifier name="traces-sample-rate" /> value, or switch to using <PlatformIdentifier name="traces-sampler" /> to selectively sample and filter your transactions, based on contextual data.
While you're testing, set <PlatformIdentifier name="traces-sample-rate" /> to `1.0`, as that ensures that every transaction/service span will be sent to Sentry. Once testing is complete, you may want to set a lower <PlatformIdentifier name="traces-sample-rate" /> value, or switch to using <PlatformIdentifier name="traces-sampler" /> to selectively sample and filter your transactions/service spans, based on contextual data.

## Next Steps

Expand Down
Original file line number Diff line number Diff line change
@@ -1,42 +1,48 @@
---
title: Automatic Instrumentation
description: "Learn what transactions are captured after tracing is enabled."
description: "Learn what's captured automatically after tracing is enabled."
sidebar_order: 10
---

<Alert>

Capturing transactions requires that you first <PlatformLink to="/tracing/">set up tracing</PlatformLink> if you haven't already.
Automatic instrumentation requires that you first <PlatformLink to="/tracing/">set up tracing</PlatformLink> if you haven't already.

</Alert>

<Alert>

In stream mode, these instrumentations automatically switch to the streaming span API. No code changes are needed, except for the initial opt-in to stream mode. Learn more about <PlatformLink to="/tracing/streamed-spans/">Streamed Spans</PlatformLink>.

</Alert>

### http.Client Library Instrumentation

The `http.Client` instrumentation, once added the `SentryHttpClient` and enabled the [performance](/platforms/dart/tracing/) feature, starts a span out of the active span bound to the scope for each HTTP Request. The SDK sets the span `operation` to `http.client` and `description` to request `$METHOD $url`; for example, `GET https://sentry.io`.
The `http.Client` instrumentation, once added the `SentryHttpClient` and enabled the [performance](/platforms/dart/tracing/) feature, starts a child span of the active span for each HTTP Request. The SDK sets the span `operation` to `http.client` and `description` to request `$METHOD $url`; for example, `GET https://sentry.io`.

The span finishes once the request has been executed. The span `status` depends on either the HTTP Response `code` or `SpanStatus.internalError()` if the `code` does not match any of Sentry's `SpanStatus`.
The span finishes once the request has been executed. The span status is derived from the HTTP response code, or set to an error status if the code doesn't map to a known status.

When the HTTP request throws an `Exception`, Sentry's SDK associates this exception to the running span. If you haven't set the SDK to swallow the exception and capture it, the span and `SentryEvent` will be linked when viewing it on the **Issue Details** page in sentry.io.

For more information see our [SentryHttpClient integration](/platforms/dart/integrations/http-integration/#performance-monitoring-for-http-requests).

### Dio HTTP Library Instrumentation

The Dio instrumentation starts a span out of the active span bound to the scope for each HTTP request. The SDK sets the span `operation` to `http.client` and the `description` to request `$METHOD $url`. For example, `GET https://sentry.io`.
The Dio instrumentation starts a child span of the active span for each HTTP request. The SDK sets the span `operation` to `http.client` and the `description` to request `$METHOD $url`. For example, `GET https://sentry.io`.

The span finishes once the request has been executed. The span `status` depends on either the HTTP response `code` or `SpanStatus.internalError()` if the `code` does not match any of Sentry's `SpanStatus` options.
The span finishes once the request has been executed. The span status is derived from the HTTP response code, or set to an error status if the code doesn't map to a known status.

When the HTTP request throws an `Exception`, Sentry's SDK associates this exception to the running span. If you haven't set the SDK to swallow the exception and capture it, the span and `SentryEvent` will be linked when viewing it on the **Issue Details** page in [sentry.io](https://sentry.io).

Learn more in our [Dio integration documentation](/platforms/dart/integrations/dio/#performance-monitoring-for-http-requests).

### File I/O Instrumentation

The Sentry-specific file I/O implementation starts a span out of the active span, bound to the scope for each file I/O operation. The SDK sets the span `operation` to `file.copy`, `file.write`, `file.delete`, `file.open`, `file.read` or `file.rename`, and `description` to `filename` (for example, `file.txt`).
The Sentry-specific file I/O implementation starts a child span of the active span for each file I/O operation. The SDK sets the span `operation` to `file.copy`, `file.write`, `file.delete`, `file.open`, `file.read` or `file.rename`, and `description` to `filename` (for example, `file.txt`).

In addition, the span contains other useful information such as `file.size` (raw number of bytes), `file.path` (an absolute path to the file), and `file.async` (`true` if the called method returns a `Future`, or `false` if it's a `Sync` call) as part of the `data` payload.
In addition, the span contains other useful information such as `file.size` (raw number of bytes), `file.path` (an absolute path to the file), and `file.async` (`true` if the called method returns a `Future`, or `false` if it's a `Sync` call) as additional span data.

The span finishes once the operation has been executed. The span `status` is then set to `SpanStatus.ok` if successful, or `SpanStatus.internalError` if there was an error.
The span finishes once the operation has been executed. The span status is set to a success status if it succeeds, or an error status if it fails.

When the operation throws an `Exception`, Sentry's SDK associates it with the running span. If you haven't set the SDK to swallow and capture the exception, the span and `SentryEvent` will be shown as linked on the **Issue Details** page in [sentry.io](https://sentry.io).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ To capture transactions and spans customized to your organization's needs, you m

</Alert>

<Alert>

This page covers both transaction mode (default, using transaction) and stream mode (using service spans). See <PlatformLink to="/tracing/streamed-spans/">Streamed Spans</PlatformLink> to learn more.

</Alert>

<Include name="tracing/span-metrics-application-metrics-callout" />

<PlatformContent includePath="performance/enable-manual-instrumentation" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
title: Performance Metrics
description: "Learn how to attach performance metrics to your transactions."
description: "Learn how to attach performance metrics to your transactions or spans."
sidebar_order: 20
---

Sentry's SDKs support sending performance metrics data to Sentry. These are numeric values attached to transactions that are aggregated and displayed in Sentry.
Sentry's SDKs support sending performance metrics data to Sentry. These are numeric values attached to transactions or spans that are aggregated and displayed in Sentry.

## Custom Measurements

In addition to automatic performance metrics, the SDK supports custom performance measurements on transactions. <Include name="custom-measurements-blurb.mdx" />
In addition to automatic performance metrics, the SDK supports custom performance measurements on transactions or spans. <Include name="custom-measurements-blurb.mdx" />

To set a performance measurement, you need to supply the following:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@ title: Custom Instrumentation
sidebar_order: 40
---

<Alert>

This guide only applies to the default transaction mode.
In <PlatformLink to="/tracing/new-spans/">stream mode</PlatformLink>, continuing an incoming distributed trace isn't supported yet.

</Alert>

<PlatformContent includePath="distributed-tracing/custom-instrumentation/" />
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ sidebar_order: 3000

If the overall application landscape that you want to observe with Sentry consists of more than just a single service or application, distributed tracing can add a lot of value.

<Alert>

This guide only applies to the default transaction mode.
In <PlatformLink to="/tracing/streamed-spans">stream mode</PlatformLink>, continuing an incoming distributed trace (from a `sentry-trace` or `baggage` header) isn't supported yet.

</Alert>

## What is Distributed Tracing?

In the context of tracing events across a distributed system, distributed tracing acts as a powerful debugging tool. Imagine your application as a vast network of interconnected parts. For example, your system might be spread across different servers or your application might split into different backend and frontend services, each potentially having their own technology stack.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ title: Transaction Name
description: "Learn how to set or override the transaction name to capture the user and gain critical pieces of information that construct a unique identity in Sentry."
---

<Alert>

This page only applies to transaction mode. In stream mode, there's no separate transaction name — set the span name when you create it with `Sentry.startSpan('name', ...)`. See <PlatformLink to="/tracing/streamed-spans/">Streamed Spans</PlatformLink> for details.

</Alert>

The current transaction name is used to group transactions in our
[pre-built Sentry Dashboards](/product/dashboards/sentry-dashboards/) product, as well as annotate error events with their point of failure.

Expand Down
22 changes: 14 additions & 8 deletions docs/platforms/dart/guides/flutter/tracing/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,36 @@ With [tracing](/product/dashboards/sentry-dashboards/), Sentry tracks your softw

<Alert>

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.
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.

</Alert>

<Alert>

Sentry can send spans in one of two ways: the default transaction mode or stream mode, where spans are streamed to Sentry as they finish. See <PlatformLink to="/tracing/streamed-spans/">Streamed Spans</PlatformLink> to learn more.

</Alert>

## Configure

First, enable tracing and configure the sample rate for transactions. Set the sample rate for your transactions by either:
First, enable tracing and configure the sample rate for transactions (or service spans in stream mode). Set the sample rate by either:

- Setting a uniform sample rate for all transactions using the <PlatformIdentifier name="traces-sample-rate" /> option in your SDK config to a number between `0` and `1`. (For example, to send 20% of transactions, set <PlatformIdentifier name="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 <PlatformIdentifier name="traces-sampler" /> config option.
- Setting a uniform sample rate for all transactions/service spans using the <PlatformIdentifier name="traces-sample-rate" /> option in your SDK config to a number between `0` and `1`. (For example, to send 20% of transactions/service spans, set <PlatformIdentifier name="traces-sample-rate" /> to `0.2`.)
- Controlling the sample rate based on the transaction/service span itself and the context in which it's captured, by providing a function to the <PlatformIdentifier name="traces-sampler" /> config option.

The two options are meant to be mutually exclusive. If you set both, <PlatformIdentifier name="traces-sampler" /> will take precedence.

<PlatformContent includePath="performance/configure-sample-rate" />

Learn more about tracing <PlatformLink to="/configuration/options/#tracing-options">options</PlatformLink>, how to use the <PlatformLink to="/configuration/sampling/#setting-a-sampling-function">tracesSampler</PlatformLink> function, or how to <PlatformLink to="/configuration/sampling/#sampling-transaction-events">sample transactions</PlatformLink>.
Learn more about tracing <PlatformLink to="/configuration/options/#tracing-options">options</PlatformLink>, how to use the <PlatformLink to="/configuration/sampling/#setting-a-sampling-function">tracesSampler</PlatformLink> function, or how to <PlatformLink to="/configuration/sampling/#sampling-transaction-events">sample transactions and service spans</PlatformLink>.

## Verify

Verify that tracing is working correctly by using our <PlatformLink to="/tracing/instrumentation/automatic-instrumentation/">automatic instrumentation</PlatformLink> or by starting and finishing a transaction using <PlatformLink to="/tracing/instrumentation/custom-instrumentation/">custom instrumentation</PlatformLink>.
Verify that tracing is working correctly by using our <PlatformLink to="/tracing/instrumentation/automatic-instrumentation/">automatic instrumentation</PlatformLink> or by starting and finishing a transaction/service span using <PlatformLink to="/tracing/instrumentation/custom-instrumentation/">custom instrumentation</PlatformLink>.

Test out tracing by starting and finishing a transaction, which you _must_ do so transactions can be sent to Sentry. Learn how in our <PlatformLink to="/tracing/instrumentation/custom-instrumentation/">Custom Instrumentation</PlatformLink> content.
Test out tracing by starting and finishing a transaction/service span, which you _must_ do so data can be sent to Sentry. Learn how in our <PlatformLink to="/tracing/instrumentation/custom-instrumentation/">Custom Instrumentation</PlatformLink> content.

While you're testing, set <PlatformIdentifier name="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 <PlatformIdentifier name="traces-sample-rate" /> value, or switch to using <PlatformIdentifier name="traces-sampler" /> to selectively sample and filter your transactions, based on contextual data.
While you're testing, set <PlatformIdentifier name="traces-sample-rate" /> to `1.0`, as that ensures that every transaction/service span will be sent to Sentry. Once testing is complete, you may want to set a lower <PlatformIdentifier name="traces-sample-rate" /> value, or switch to using <PlatformIdentifier name="traces-sampler" /> to selectively sample and filter your transactions/service spans, based on contextual data.

## Next Steps

Expand Down
Loading
Loading