-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(perf): Add Performance Metrics Docs
Adds documentation around automatic and custom performance metrics.
- Loading branch information
1 parent
d3896a1
commit d4b0d53
Showing
3 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
src/includes/performance/automatic-performance-metrics/javascript.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
The JavaScript Browser SDKs automatically collect the following performance metrics | ||
|
||
- First Paint: `fp` | ||
- First Contentful Paint: `fcp` | ||
- Larget Contentful Paint: `lcp` | ||
- First Input Delay: `fcp` | ||
- Cumulative Layout Shift: `cls` | ||
- Time to First Byte: `ttfb` | ||
- Time to First Byte Request Time: `ttfb.requesttime` |
14 changes: 14 additions & 0 deletions
14
src/includes/performance/custom-performance-metrics/javascript.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Supported in Sentry's JavaScript SDK version `7.0.0` and above. | ||
|
||
```javascript | ||
const transaction = Sentry.getCurrentHub().getScope().getTransaction(); | ||
|
||
// Record amount of memory used | ||
transaction.setMeasurement('memoryUsed', 123, 'byte'); | ||
|
||
// Record time when Footer component renders on page | ||
transaction.setMeasurement('ui.footerComponent.render', 1.3, 'second'); | ||
|
||
// Record amount of times localStorage was read | ||
transaction.setMeasurement('localStorageRead', 4); | ||
``` |
84 changes: 84 additions & 0 deletions
84
src/platforms/common/performance/instrumentation/performance-metrics.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
--- | ||
title: Performance Metrics | ||
sidebar_order: 20 | ||
supported: | ||
- javascript | ||
notSupported: | ||
- javascript.cordova | ||
- javascript.electron | ||
- react-native | ||
- dotnet | ||
- python | ||
- go | ||
- java | ||
- android | ||
- ruby | ||
- java.spring-boot | ||
- apple | ||
- unity | ||
- dart | ||
- flutter | ||
- rust | ||
- native | ||
- php | ||
- native.breakpad | ||
- native.crashpad | ||
- native.minidumps | ||
- unreal | ||
- native.wasm | ||
description: "Learn how to attach performance metrics to your transactions." | ||
--- | ||
|
||
The Sentry SDK supports sending performance metrics data to Sentry. These are numeric values attached to transactions that are aggregated and displayed in Sentry. | ||
|
||
<PlatformContent includePath="performance/automatic-performance-metrics" /> | ||
|
||
In addition to automatic performance metrics, the SDK supports setting custom performance metrics on transactions. This allows you to define metrics that are important to your application and send them to Sentry. | ||
|
||
To set a performance metric, supply a name (string), value (numeric - float, integer, etc.), and unit (string). Sentry supports adding arbitrary custom units, but we recommend using one of the [supported units listed below](./#supported-performance-metric-units). | ||
|
||
<PlatformContent includePath="performance/custom-performance-metrics" /> | ||
|
||
## Supported Performance Metric Units | ||
|
||
Units augment metric values by giving them a magnitude and semantics. Sentry leverages units associated with performance metrics to apply built-in unit conversions and controls in the product. For values that are unitless, you can supply an empty string or `none`. | ||
|
||
### Duration Units | ||
|
||
A time duration. | ||
|
||
- `nanosecond` | ||
- `microsecond` | ||
- `millisecond` | ||
- `second` | ||
- `minute` | ||
- `hour` | ||
- `day` | ||
- `week` | ||
|
||
### Information Units | ||
|
||
Size of information derived from bytes. | ||
|
||
- `bit` | ||
- `byte` | ||
- `kilobyte` | ||
- `kibibyte` | ||
- `megabyte` | ||
- `mebibyte` | ||
- `gigabyte` | ||
- `gibibyte` | ||
- `terabyte` | ||
- `tebibyte` | ||
- `petabyte` | ||
- `petabyte` | ||
- `pebibyte` | ||
- `exabyte` | ||
- `exbibyte` | ||
|
||
## Fraction Units | ||
|
||
- `ratio` | ||
- `percent` | ||
|
||
For those looking to explore further, details about the supported list of units can be found in our [event ingestion documentation](https://getsentry.github.io/relay/relay_metrics/enum.MetricUnit.html). |