diff --git a/src/platform-includes/performance/custom-performance-metrics/dart.mdx b/src/platform-includes/performance/custom-performance-metrics/dart.mdx new file mode 100644 index 00000000000000..92ce437adcf26e --- /dev/null +++ b/src/platform-includes/performance/custom-performance-metrics/dart.mdx @@ -0,0 +1,18 @@ +Adding custom metrics is supported in Sentry's Dart/Flutter SDK version `6.11.0` and above. + +```dart +import 'package:sentry/sentry.dart'; + +final transaction = Sentry.getSpan(); + +// Record amount of memory used +transaction?.setMeasurement('memoryUsed', 123, + unit: SentryMeasurementUnit.byte); + +// Record time when Footer component renders on page +transaction?.setMeasurement('ui.footerComponent.render', 1.3, + unit: SentryMeasurementUnit.second); + +// Record amount of times localStorage was read +transaction?.setMeasurement('localStorageRead', 4); +``` diff --git a/src/platforms/common/performance/instrumentation/performance-metrics.mdx b/src/platforms/common/performance/instrumentation/performance-metrics.mdx index f32be1287c533d..3121197656ccaf 100644 --- a/src/platforms/common/performance/instrumentation/performance-metrics.mdx +++ b/src/platforms/common/performance/instrumentation/performance-metrics.mdx @@ -4,10 +4,12 @@ sidebar_order: 20 supported: - javascript - python + - dart + - flutter + - react-native notSupported: - javascript.cordova - javascript.electron - - react-native - dotnet - go - java @@ -16,8 +18,6 @@ notSupported: - java.spring-boot - apple - unity - - dart - - flutter - rust - native - php @@ -31,7 +31,7 @@ description: "Learn how to attach performance metrics to your transactions." Sentry's SDKs support sending performance metrics data to Sentry. These are numeric values attached to transactions that are aggregated and displayed in Sentry. - + @@ -51,7 +51,7 @@ To set a performance metric, you need to supply the following: - name (`string`) - value (any numeric type - `float`, `integer`, etc.) -- unit (`string`, can be empty or the string `'none'`). +- 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](./#supported-performance-metric-units).