Skip to main content

Embrace Metrics API

The Embrace Metrics API allows you to query your metrics from Embrace using PromQL. The queryable information includes any standard metrics as well as any Custom Metrics you have created.

Get Started

  1. Navigate to Settings -> Organization -> API in the Embrace dashboard.
  2. Get the "Metrics API" token.
Image showing the
settings page for API tokens

How to Consume Metrics?

You can consume metrics from the Embrace Metrics API in two ways:

All metrics are queried using PromQL (Prometheus Query Language). See some examples here.

  • Sessions grouped by session property city and state for a given app version.
sum(daily_sessions_total{app_id="<app ID>", app_version="1.2.3"}) by (city, state)
  • Percentage of crash free sessions by devices.
1 - sum(hourly_crashes_total{app_id="$app_id"}) by (device_model) / sum(hourly_sessions_total{app_id="$app_id"}) by (device_model) * 100
  • Percentage of crash sessions by devices.
sum(hourly_crashes_total{app_id="$app_id"}) by (device_model) / sum(hourly_sessions_total{app_id="$app_id"}) by (device_model) * 100

Also, you can pull data for one, multiple, or all of your organization's apps in a single query.

  • To pull for a single app, include the app_id in the PromQL filter,
sum(hourly_custom_metric_sessions_total{app_id="a1b2C3"})
  • To pull for multiple apps, include a pipe-delimited array in the filter,
sum(hourly_custom_metric_sessions_total{app_id=~"a1b2C3|Z9Y8x7"}) 
  • To pull for all apps, do not include any app ID in the filter,
sum(hourly_custom_metric_sessions_total{})

Supported Metrics

View all the metrics supported in the Metrics Forwarding page.

Metrics Availability

This is the time when the metrics will be available to consume in the Embrace Metrics API.

  • Five minute metrics will be available to consume in about 4 minutes. Data point calculated at 2024-11-25 00:05:00 will be available to consume after 2024-11-25 00:10:00.
  • Hourly metrics will be available to consume in about 15 minutes. Data point calculated at 2024-11-25 01:00:00 will be available to consume after 2024-11-25 01:14:00.
  • Daily metrics will be available to consume in about 14 hours. Data point calculated at 2024-11-25 00:00:00 will be available to consume after 2024-11-25 14:00:00.