Metrics [in beta]

Track custom data points about your application to visualize trends, identify anomalies, and fix issues faster with correlated traces. Metrics fit seamlessly into Sentry workflows, so you can move easily from seeing issues to finding solutions.

Custom Metrics for Developers

Create custom metrics to track the data points you care about, like processing time, checkout conversion rate, or user sign-ups. Report metrics as counters, gauges, distributions, or sets. Apply aggregations and enrich metrics with custom tags to easily segment or filter data.

Create metric-based alerts to take action on unexpected changes or spikes. Add widgets to Dashboards for quick comparison and reference.

Drill into specific events and use correlated traces to find the cause of the issue. With code locations, see exactly where a metric is emitted for faster troubleshooting.

With Metrics, we don’t have to guess anymore. We can know for sure when something is wrong. And because Metrics are integrated with Sentry, setup takes maybe a minute of work. It’s really easy.
Jonas Di Dier
Creative Shelter
One of our customers was reporting an error with one of our features – specifically getting our iPad app to sync with a badge printer. We set up Metrics, and within an hour, were able to rule out a network request issue and get to work on finding the real root cause.
Joel Bohman
Founder, Agorify
Getting Started Platforms Scrolling Logo Background
Getting Started Platforms Scrolling Logo Background
Getting Started Platforms Scrolling Logo Background
Getting Started Platforms Scrolling Logo Background
Getting Started Platforms Scrolling Logo Background
Getting Started Platforms Scrolling Logo Background

Getting started with Sentry is simple

We support every technology (except the ones we don't).
Get started with just a few lines of code.

Configure Metrics

Metrics work out of the box by calling Sentry.init no further setup is required.

Click to Copy
// sentry.server.config.js Sentry.init({ dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0', });
Click to Copy
// sentry.client.config.js Sentry.init({ dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0', });

Emit a Counter

Counters are one of the more basic types of metrics and can be used to count certain event occurrences.

To emit a counter, do the following:

Click to Copy
// Increment a counter by one for each button click. Sentry.metrics.increment("button_click", 1, { tags: { browser: "Firefox", app_version: "1.0.0" }, });

Emit a Distribution

Distributions help you get the most insights from your data by allowing you to obtain aggregations such as p90, min, max, and avg.

To emit a distribution, do the following:

Click to Copy
// Add '15.0' to a distribution used for tracking the loading times for component. Sentry.metrics.distribution("component_load_time", 15.0, { tags: { type: "important" }, unit: "millisecond", });

Emit a Set

Sets are useful for looking at unique occurrences and counting the unique elements you added.

To emit a set, do the following:

Click to Copy
// Add 'jane' to a set used for tracking the number of users that viewed a page. Sentry.metrics.set("user_view", "jane");

Emit a Gauge

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.

To emit a gauge, do the following:

Click to Copy
// Add 2 to a gauge tracking CPU usage. Sentry.metrics.gauge("cpu_usage", 34, { tags: { os: "MacOS" }, unit: "percent", });

That's it. Check out our documentation to ensure you have the latest instructions.

FAQs

Metrics help teams measure and visualize custom data points, like processing time, checkout conversion rate, or user sign-ups, to make it easy to spot any issues. If Metrics reveal an unexpected spike or dip, teams can drill into specific events and use correlated traces to solve the cause of the issue. Learn more in our docs.

Metrics is available for all major languages and platforms, including Javascript, Python, and PHP. See the full list here.

Metrics is currently in open beta and free to use for the duration of the beta period. We plan to charge for it in the future once it becomes generally available. We are still finalizing pricing and will communicate any future costs ASAP, well before billing starts.

To use Metrics, you will first need a Sentry account. If you don’t have a Sentry account, you can create one here. Then, follow the instructions in our docs to implement Metrics.

Note that we will be updating our Metrics API to ensure that metrics are explicitly connected to spans. This change will improve debugging capabilities, by ensuring that metrics are always contextually linked with all your Sentry data through traces. You will eventually need to migrate to the new APIs once released. Learn more.

Of course we have more content

Launch Week: Metrics

Launch Week: Metrics

Read about the Metrics beta announcement, including a full demo walkthrough.

Get monthly product updates from Sentry

Sign up for our newsletter.

And yes, it really is monthly. Ok, maybe the occasional twice a month, but for sure not like one of those daily ones that you just tune out after a while.

By filling out this form, you agree to our privacy policy. This form is protected by reCAPTCHA and Google's Privacy Policy and Terms of Service apply.

Fix it.

Get started with the only application monitoring platform that empowers developers to fix application problems without compromising on velocity, code quality, or developer experience.

© 2024 • Sentry is a registered Trademark
of Functional Software, Inc.