Learn how Sentry's command line interface can be used for sending metrics.

Metrics help you track and visualize the data points you care about, making it easier to monitor your application's health and identify issues. Learn more about Metrics.

  • Install the Sentry CLI (min v2.32.0).

The Sentry CLI uses your project's DSN to authorize sending metrics. To set it up, export the SENTRY_DSN environment variable:

export SENTRY_DSN=

Alternatively, you can add it to your ~/.sentryclirc config file:

dsn =

You can send metrics using the CLI's send-metric command. You need to provide at least the --name or -n parameter to identify the metric. When emitting a metric that doesn't exist, the metric will be created for you. If it already exists, it will be updated. All metric types support custom units and tags provided with the -u and -t parameters respectively:

sentry-cli send-metric increment -n "MyMetric" -u "MyUnit" -t "tag1:val1","tag2:val2"

The metric's name, unit, and tags will undergo normalization to only include supported characters. Learn more about Limits and Restrictions.

To increment a counter metric by one, you only need to provide the --name or -n parameter. A counter metric can also be incremented by a custom value using the -v parameter:

sentry-cli send-metric increment -n "button_click" -v 2

To emit a gauge metric, you always need to provide the name and value:

sentry-cli send-metric gauge -n "bundle_size" -v 384 -u "byte"

Similar to gauges, you need to provide the name and value to emit a distribution metric:

sentry-cli send-metric distribution -n "build_time" -v 120 -u "millisecond"

To emit a set metric, you need to provide the name and value where the value can be any number or string:

sentry-cli send-metric set -n "build_platform" -v "android"
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").