Skip to content

Commit

Permalink
incr -> increment
Browse files Browse the repository at this point in the history
  • Loading branch information
sl0thentr0py committed Feb 29, 2024
1 parent c1217cd commit 8f9dabb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion sentry-ruby/lib/sentry/metrics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions sentry-ruby/spec/sentry/metrics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -21,7 +21,7 @@
timestamp: nil
)

described_class.incr('foo')
described_class.increment('foo')
end

it 'passes through args to aggregator' do
Expand All @@ -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

Expand Down

0 comments on commit 8f9dabb

Please sign in to comment.