Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
New benchmark helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
metaskills committed Aug 7, 2020
1 parent 455ba26 commit ca9a215
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

See this https://keepachangelog.com link for information on how we want this documented formatted.

## v0.3.0

### Added

- New `benchmark` helper.

## v0.2.0

### Changed
Expand Down
7 changes: 7 additions & 0 deletions lib/aws-embedded-metrics-customink/logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ def flush
@sink.accept(message) unless empty?
end

def benchmark
value = nil
seconds = Benchmark.realtime { value = yield }
milliseconds = (seconds * 1000).to_i
[value, milliseconds]
end

def put_dimension(name, value)
@dimensions << { name => value }
self
Expand Down
2 changes: 1 addition & 1 deletion lib/aws-embedded-metrics-customink/version.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Aws
module Embedded
module Metrics
VERSION = '0.2.0'.freeze
VERSION = '0.3.0'.freeze
end
end
end

0 comments on commit ca9a215

Please sign in to comment.