|
| 1 | +--- |
| 2 | +title: Set Up Metrics |
| 3 | +description: "Learn how to measure the data points you care about by configuring Metrics in your React Native app." |
| 4 | +--- |
| 5 | + |
| 6 | +<PlatformContent includePath="metrics/version-support-note" /> |
| 7 | + |
| 8 | +Sentry metrics help you pinpoint and solve issues that impact user experience and app performance by measuring the data points that are important to you. You can track things like processing time, event size, user signups, and conversion rates, then correlate them back to tracing data in order to get deeper insights and solve issues faster. |
| 9 | + |
| 10 | +## Configure Metrics |
| 11 | + |
| 12 | +<PlatformContent includePath="metrics/configure" /> |
| 13 | + |
| 14 | +## Emit a Counter |
| 15 | + |
| 16 | +Counters are one of the more basic types of metrics and can be used to count certain event occurrences. |
| 17 | + |
| 18 | +To emit a counter, do the following: |
| 19 | + |
| 20 | +<PlatformContent includePath="metrics/counter-snippet" /> |
| 21 | + |
| 22 | +## Emit a Distribution |
| 23 | + |
| 24 | +Distributions help you get the most insights from your data by allowing you to obtain aggregations such as `p90`, `min`, `max`, and `avg`. |
| 25 | + |
| 26 | +To emit a distribution, do the following: |
| 27 | + |
| 28 | +<PlatformContent includePath="metrics/distribution-snippet" /> |
| 29 | + |
| 30 | +## Emit a Set |
| 31 | + |
| 32 | +Sets are useful for looking at unique occurrences and counting the unique elements you added. |
| 33 | + |
| 34 | +To emit a set, do the following: |
| 35 | + |
| 36 | +<PlatformContent includePath="metrics/set-snippet" /> |
| 37 | + |
| 38 | +## Emit a Gauge |
| 39 | + |
| 40 | +Gauges let you obtain aggregates like `min`, `max`, `avg`, `sum`, and `count`. They can be represented in a more space-efficient way than distributions, but they can't be used to get percentiles. If percentiles aren't important to you, we recommend using gauges. |
| 41 | + |
| 42 | +To emit a gauge, do the following: |
| 43 | + |
| 44 | +<PlatformContent includePath="metrics/gauge-snippet" /> |
| 45 | + |
| 46 | +## Supported Performance Metric Units |
| 47 | + |
| 48 | +Adding a unit as a metric parameter will give meaning to what may otherwise look like abstract numbers. It also allows Sentry to offer controls - unit conversions, filters, and so on - based on the unit you select. You can pass a unit as an optional parameter of the third argument of the `increment`, `distribution`, `set`, and `gauge` methods. If a value has no units, you can supply an empty string or `none`. |
| 49 | + |
| 50 | +The following units are understood by the Sentry backend, but you can add any arbitrary unit you want. |
| 51 | + |
| 52 | +### Duration Units |
| 53 | + |
| 54 | +- `nanosecond` |
| 55 | +- `microsecond` |
| 56 | +- `millisecond` |
| 57 | +- `second` |
| 58 | +- `minute` |
| 59 | +- `hour` |
| 60 | +- `day` |
| 61 | +- `week` |
| 62 | + |
| 63 | +### Information Units |
| 64 | + |
| 65 | +- `bit` |
| 66 | +- `byte` |
| 67 | +- `kilobyte` |
| 68 | +- `kibibyte` |
| 69 | +- `megabyte` |
| 70 | +- `mebibyte` |
| 71 | +- `gigabyte` |
| 72 | +- `gibibyte` |
| 73 | +- `terabyte` |
| 74 | +- `tebibyte` |
| 75 | +- `petabyte` |
| 76 | +- `pebibyte` |
| 77 | +- `exabyte` |
| 78 | +- `exbibyte` |
| 79 | + |
| 80 | +### Fraction Units |
| 81 | + |
| 82 | +- `ratio` |
| 83 | +- `percent` |
| 84 | + |
| 85 | +You can find additional details about supported units in our [event ingestion documentation](https://getsentry.github.io/relay/relay_metrics/enum.MetricUnit.html). |
0 commit comments