You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -5,7 +5,11 @@ description: "Learn how to set up Sentry's Metrics feature using our supported S
5
5
---
6
6
7
7
<Alertlevel="info">
8
-
Metrics is currently in Open Beta for non-Enterprise plans running the JavaScript or Python SDKs. If you'd like access, please comment with your org slug on [this GitHub discussion](https://github.com/getsentry/sentry/discussions/102275) or contact us at [email protected].
8
+
Metrics is currently in Open Beta for non-Enterprise plans running the
9
+
JavaScript or Python SDKs. If you'd like access, please comment with your org
10
+
slug on [this GitHub
11
+
discussion](https://github.com/getsentry/sentry/discussions/102275) or contact
To set up Sentry Metrics, use the links below for supported SDKs. After it's been set up, you'll be able to send counters, gauges, and distributions from your code and view them in Sentry with direct links to related traces.
@@ -14,8 +18,6 @@ To set up Sentry Metrics, use the links below for supported SDKs. After it's bee
We're actively working on adding Metrics functionality to additional SDKs. Check out these GitHub issues for the latest updates:
237
241
238
-
239
242
- <LinkWithPlatformIcon
240
243
platform="ruby"
241
244
label="Ruby (incl. Rails)"
@@ -292,159 +295,6 @@ We're actively working on adding Metrics functionality to additional SDKs. Check
292
295
293
296
If you don't see your platform listed above, please reach out to us on [GitHub](https://github.com/getsentry/sentry/discussions/102275), [Discord](https://discord.gg/sentry) or contact us at [[email protected]](mailto:[email protected]), we'll get it prioritized!
294
297
295
-
## Quick Start Examples
296
-
297
-
### JavaScript Example
298
-
299
-
First, enable metrics in your Sentry initialization:
300
-
301
-
```javascript
302
-
import*asSentryfrom"@sentry/node"; // or your specific framework
303
-
304
-
Sentry.init({
305
-
dsn:'<your-dsn>',
306
-
_experiments: {
307
-
enableMetrics:true
308
-
},
309
-
});
310
-
```
311
-
312
-
Then use the metrics API to send counters, gauges, and distributions:
313
-
314
-
```javascript
315
-
// Counter — increment a metric (defaults to +1)
316
-
Sentry.metrics.count('checkout.failed', 1, {
317
-
attributes: {
318
-
route:'/checkout',
319
-
tenant:'acme',
320
-
provider:'stripe',
321
-
},
322
-
});
323
-
324
-
// Gauge — set a current value
325
-
Sentry.metrics.gauge('queue.depth', 42, {
326
-
unit:'items',
327
-
attributes: {
328
-
queue:'emails',
329
-
region:'us-east-1',
330
-
},
331
-
});
332
-
333
-
// Distribution — record numeric values to compute p95, avg, sum, etc.
Copy file name to clipboardExpand all lines: platform-includes/metrics/default-attributes/javascript.mdx
+8-9Lines changed: 8 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,17 @@
1
1
By default the SDK will attach the following attributes to a metric:
2
2
3
-
-`sentry.environment`: The environment set in the SDK if defined.
4
-
-`sentry.release`: The release set in the SDK if defined.
5
-
-`sentry.sdk.name`: The name of the SDK that sent the metric.
6
-
-`sentry.sdk.version`: The version of the SDK that sent the metric.
3
+
-`environment`: The environment set in the SDK if defined. This is sent from the SDK as `sentry.environment`.
4
+
-`release`: The release set in the SDK if defined. This is sent from the SDK as `sentry.release`.
5
+
-`sdk.name`: The name of the SDK that sent the metric. This is sent from the SDK as `sentry.sdk.name`.
6
+
-`sdk.version`: The version of the SDK that sent the metric. This is sent from the SDK as `sentry.sdk.version`.
7
7
8
8
### User Attributes
9
9
10
-
The SDK will optionally attach user information as attributes (guarded by [`sendDefaultPii`](/platforms/javascript/configuration/options/#sendDefaultPii)):
11
-
12
-
-`user.id`
13
-
-`user.name`
14
-
-`user.email`
10
+
If user information is available in the current scope, the following attributes are added to the log:
0 commit comments