Skip to content

Conversation

@Litarnus
Copy link
Contributor

@Litarnus Litarnus commented Nov 19, 2025

Introducing metrics for PHP!

Metrics have 3 supported types

  • Counter
  • Gauge
  • Distribution

Each of those metrics can be submitted by calling
\Sentry\metrics()->count('test-counter', 1, ['tag' => 'foo'])

It's also possible to attach units:
\Sentry\metrics()->gauge('test-gauge', 10, ['tag' => 'foo'], \Sentry\Metrics\Unit::second())

Up to 1000 metrics can be stored per request. Older metrics are dropped when the limit is reached.

Metrics need to be flushed manually by calling \Sentry\metrics()->flush().

@Litarnus Litarnus marked this pull request as ready for review November 19, 2025 10:54
string $key,
float $value,
?MetricsUnit $unit = null,
?Unit $unit = null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
?Unit $unit = null,
?MetricsUnit $unit = null,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants