diff --git a/CHANGELOG.md b/CHANGELOG.md index bd8bd017b..5532575f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,9 +24,9 @@ ```ruby # increment a simple counter - Sentry::Metrics.incr('button_click') + Sentry::Metrics.increment('button_click') # set a value, unit and tags - Sentry::Metrics.incr('time', 5, unit: 'second', tags: { browser:' firefox' }) + Sentry::Metrics.increment('time', 5, unit: 'second', tags: { browser:' firefox' }) # distribution - get statistical aggregates from an array of observations Sentry::Metrics.distribution('page_load', 15.0, unit: 'millisecond') diff --git a/sentry-ruby/lib/sentry/metrics.rb b/sentry-ruby/lib/sentry/metrics.rb index ab927b1c5..190c026aa 100644 --- a/sentry-ruby/lib/sentry/metrics.rb +++ b/sentry-ruby/lib/sentry/metrics.rb @@ -10,7 +10,7 @@ module Sentry module Metrics class << self - def incr(key, value = 1.0, unit: 'none', tags: {}, timestamp: nil) + def increment(key, value = 1.0, unit: 'none', tags: {}, timestamp: nil) Sentry.metrics_aggregator&.add(:c, key, value, unit: unit, tags: tags, timestamp: timestamp) end diff --git a/sentry-ruby/spec/sentry/metrics_spec.rb b/sentry-ruby/spec/sentry/metrics_spec.rb index c74e84fa1..1ca8ee7a0 100644 --- a/sentry-ruby/spec/sentry/metrics_spec.rb +++ b/sentry-ruby/spec/sentry/metrics_spec.rb @@ -10,7 +10,7 @@ let(:aggregator) { Sentry.metrics_aggregator } let(:fake_time) { Time.new(2024, 1, 1, 1, 1, 3) } - describe '.incr' do + describe '.increment' do it 'passes default value of 1.0 with only key' do expect(aggregator).to receive(:add).with( :c, @@ -21,7 +21,7 @@ timestamp: nil ) - described_class.incr('foo') + described_class.increment('foo') end it 'passes through args to aggregator' do @@ -34,7 +34,7 @@ timestamp: fake_time ) - described_class.incr('foo', 5.0, unit: 'second', tags: { fortytwo: 42 }, timestamp: fake_time) + described_class.increment('foo', 5.0, unit: 'second', tags: { fortytwo: 42 }, timestamp: fake_time) end end