---
title: "Performance Metrics"
description: "Learn how to attach performance metrics to your transactions."
url: https://docs.sentry.io/platforms/dotnet/guides/apple/tracing/instrumentation/performance-metrics/
---

# Performance Metrics | Sentry for .NET for iOS, macOS, and Mac Catalyst

The SDK supports sending performance metrics data to Sentry. These are numeric values attached to transactions that are aggregated and displayed in Sentry.

## [Custom Measurements](https://docs.sentry.io/platforms/dotnet/guides/apple/tracing/instrumentation/performance-metrics.md#custom-measurements)

In addition to automatic performance metrics, the SDK supports custom performance measurements on transactions.

Sentry supports **custom performance measurements** on transactions: you define measurements that matter to your application (for example, memory usage, query time, or user action counts) and send them with the transaction from your SDK. They appear in **Dashboards**, **Discover**, and transaction trace detail. You can define up to 10 custom measurements per transaction; any additional ones are truncated. Configure and send them in your SDK; supported platforms:

* [Android (version `6.5.0` or later)](https://docs.sentry.io/platforms/android/performance/instrumentation/performance-metrics.md)
* [Apple (version `7.28.0` or later)](https://docs.sentry.io/platforms/apple/performance/instrumentation/performance-metrics.md)
* [Dart (version `6.11.0` or later)](https://docs.sentry.io/platforms/dart/performance/instrumentation/performance-metrics.md)
* [Flutter (version `6.11.0` or later)](https://docs.sentry.io/platforms/dart/guides/flutter/performance/instrumentation/performance-metrics.md)
* [Java (version `6.5.0` or later)](https://docs.sentry.io/platforms/java/performance/instrumentation/performance-metrics.md)
* [JavaScript (version `7.0.0` or later)](https://docs.sentry.io/platforms/javascript/performance/instrumentation/performance-metrics.md)
* [.NET (version `3.23.0` or later)](https://docs.sentry.io/platforms/dotnet/performance/instrumentation/performance-metrics.md)
* [Python (version `1.5.12` or later)](https://docs.sentry.io/platforms/python/tracing/instrumentation/custom-instrumentation.md)
* [React Native (version `4.0.0` or later)](https://docs.sentry.io/platforms/react-native/performance/instrumentation/performance-metrics.md)
* [Ruby (version `5.8.0` or later)](https://docs.sentry.io/platforms/ruby/performance/instrumentation/performance-metrics.md)
* [Rails (version `5.8.0` or later)](https://docs.sentry.io/platforms/ruby/guides/rails/performance/instrumentation/performance-metrics.md)

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

* name (`string`)
* value (any numeric type - `float`, `integer`, etc.)
* unit (`string`, defaults to the string `none` if omitted)

Sentry supports adding arbitrary custom units, but we recommend using one of the [supported units listed below](https://docs.sentry.io/platforms/dotnet/guides/apple/tracing/instrumentation/performance-metrics.md#supported-measurement-units).

Adding custom measurements is supported in Sentry's .NET SDK, version `3.23.0` and above.

The following example shows how to set custom measurements on a `transaction`, including how obtain the current `span` and get its `transaction`. If you already have the `transaction` or `span`, you can use it directly.

```csharp
var span = SentrySdk.GetSpan();  // or hub.GetSpan()
if (span != null)
{
    var transaction = span.GetTransaction();

    // Record amount of memory used
    transaction.SetMeasurement("memory_used", 64, MeasurementUnit.Information.Megabyte);

    // Record time it took to load user profile
    transaction.SetMeasurement("user_profile_loading_time", 1.3, MeasurementUnit.Duration.Second);

    // Record number of times the screen was loaded
    transaction.SetMeasurement("screen_load_count", 4);
}
```

Currently, unit conversion is only supported once the data has already been stored. This means that, for example, `('myMeasurement', 60, 'second')` and `('myMeasurement', 3, 'minute')` would not be aggregated, but rather stored as two separate measurements. To avoid this, make sure to use a consistent unit when recording a custom measurement.

## [Supported Measurement Units](https://docs.sentry.io/platforms/dotnet/guides/apple/tracing/instrumentation/performance-metrics.md#supported-measurement-units)

Units augment measurement values by giving meaning to what otherwise might be abstract numbers. Adding units also allows Sentry to offer controls - unit conversions, filters, and so on - based on those units. For values that are unitless, you can supply an empty string or `none`.

### [Duration Units](https://docs.sentry.io/platforms/dotnet/guides/apple/tracing/instrumentation/performance-metrics.md#duration-units)

* `nanosecond`
* `microsecond`
* `millisecond`
* `second`
* `minute`
* `hour`
* `day`
* `week`

### [Information Units](https://docs.sentry.io/platforms/dotnet/guides/apple/tracing/instrumentation/performance-metrics.md#information-units)

* `bit`
* `byte`
* `kilobyte`
* `kibibyte`
* `megabyte`
* `mebibyte`
* `gigabyte`
* `gibibyte`
* `terabyte`
* `tebibyte`
* `petabyte`
* `pebibyte`
* `exabyte`
* `exbibyte`

### [Fraction Units](https://docs.sentry.io/platforms/dotnet/guides/apple/tracing/instrumentation/performance-metrics.md#fraction-units)

* `ratio`
* `percent`

If you want to explore further, you can find details about supported units in our [event ingestion documentation](https://getsentry.github.io/relay/relay_metrics/enum.MetricUnit.html).
