diff --git a/CHANGELOG.md b/CHANGELOG.md index 1833fa6..3342bbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Sidekiq-InfluxDB Changelog +## 1.2.0 (2019-05-03) + +* Support all InfluxDB time resolutions (added `ns`, `m`, `h`) + ## 1.1.0 (2018-09-03) * ActiveJob support added diff --git a/README.md b/README.md index 79ec91a..5c3afb2 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ When you deploy this code, you will start getting the following series in your I Tags (repetitive, indexed data — for filtering and grouping by): -* `time` — Standard InfluxDB timestamp. Precision of the supplied client is respected. Only `s`, `ms`, and `u` precisions are supported. +* `time` — Standard InfluxDB timestamp. Precision of the supplied client is respected. * `queue` — Queue name. * `class` — Job class name. Classes from `except:` keyword argument are skipped (no data is sent to InfluxDB). * `event` — What happened to the job at the specified `time`: `start`, `finish`, or `error`. If you initialize the middleware with `start_events: false`, there will be no `start` events. diff --git a/lib/sidekiq/influxdb/version.rb b/lib/sidekiq/influxdb/version.rb index 4d3a86e..e5cc0e2 100644 --- a/lib/sidekiq/influxdb/version.rb +++ b/lib/sidekiq/influxdb/version.rb @@ -1,5 +1,5 @@ module Sidekiq module InfluxDB - VERSION = "1.1.0" + VERSION = "1.2.0" end end diff --git a/lib/sidekiq/middleware/server/influxdb.rb b/lib/sidekiq/middleware/server/influxdb.rb index fcc8b37..fe9bede 100644 --- a/lib/sidekiq/middleware/server/influxdb.rb +++ b/lib/sidekiq/middleware/server/influxdb.rb @@ -70,9 +70,12 @@ def precision def in_correct_precision(t) case precision # In order of probability in real-world setups - when 'ms' then (t * 1000).to_i + when 'ms' then (t * 1_000).to_i when 's' then t.to_i - when 'u' then (t * 1000000).to_i + when 'u' then (t * 1_000_000).to_i + when 'ns' then (t * 1_000_000_000).to_i + when 'm' then (t / 60).to_i + when 'h' then (t / 60 / 60).to_i end end