trifle-stats 0.1.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -1
- data/README.md +7 -65
- data/lib/trifle/stats.rb +11 -0
- data/lib/trifle/stats/configuration.rb +1 -3
- data/lib/trifle/stats/driver/README.md +5 -53
- data/lib/trifle/stats/driver/postgres.rb +69 -0
- data/lib/trifle/stats/driver/process.rb +12 -3
- data/lib/trifle/stats/driver/redis.rb +12 -5
- data/lib/trifle/stats/operations/timeseries/increment.rb +1 -1
- data/lib/trifle/stats/operations/timeseries/set.rb +34 -0
- data/lib/trifle/stats/operations/timeseries/values.rb +1 -1
- data/lib/trifle/stats/version.rb +1 -1
- data/trifle-stats.gemspec +9 -6
- metadata +25 -8
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1172a6216efbeaad062de0f482b9fd3b4bc19173326c9eb1f51c88c9d59889f2
|
|
4
|
+
data.tar.gz: d971dafe8147352aa04162ea7437b88eaf3f94b4cbd7939bda187eb9a2bb0d9d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 20e2bcef27f5a2cce12574ac3b92c13972e8fda1cae6437d6b1ced58fc4d877032048c9650080719d9da68fccd75643379021dddda8de375a380d334a2ae9ed3
|
|
7
|
+
data.tar.gz: 4db1a6c31ec03fc22f519f5f6d508af8ce6ad44b2a9ec15b9b845808b038db297d8dc9551e298865401ee7fa837c9c1f50546c9bbdee710cfd7b64cd9ec218ce
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
trifle-stats (0.
|
|
4
|
+
trifle-stats (0.3.2)
|
|
5
|
+
pg (>= 1.2)
|
|
5
6
|
redis (>= 4.2)
|
|
6
7
|
tzinfo (~> 2.0)
|
|
7
8
|
|
|
@@ -16,6 +17,7 @@ GEM
|
|
|
16
17
|
parallel (1.20.1)
|
|
17
18
|
parser (3.0.0.0)
|
|
18
19
|
ast (~> 2.4.1)
|
|
20
|
+
pg (1.2.3)
|
|
19
21
|
rainbow (3.0.0)
|
|
20
22
|
rake (12.3.3)
|
|
21
23
|
redis (4.2.5)
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Trifle
|
|
1
|
+
# Trifle::Stats
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/rb/trifle-stats)
|
|
4
4
|

|
|
@@ -6,9 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
Simple analytics backed by Redis, Postgres, MongoDB, Google Analytics, Segment, or whatever. [^1]
|
|
8
8
|
|
|
9
|
-
Trifle is a _way too_ simple timeline analytics that helps you track custom metrics. Automatically increments counters for each enabled range. It supports timezones and different week beginning.
|
|
9
|
+
`Trifle::Stats` is a _way too_ simple timeline analytics that helps you track custom metrics. Automatically increments counters for each enabled range. It supports timezones and different week beginning.
|
|
10
10
|
|
|
11
|
-
[^1] TBH only Redis for now 💔.
|
|
11
|
+
[^1]: TBH only Redis for now 💔.
|
|
12
|
+
|
|
13
|
+
## Documentation
|
|
14
|
+
|
|
15
|
+
You can find guides and documentation at https://trifle.io/docs/stats
|
|
12
16
|
|
|
13
17
|
## Installation
|
|
14
18
|
|
|
@@ -54,19 +58,6 @@ Trifle::Stats.track(key: 'event::logs', at: Time.now, values: {count: 1, duratio
|
|
|
54
58
|
=> [{2021-01-25 16:00:00 +0100=>{:count=>1, :duration=>5, :lines=>361}}, {2021-01-25 00:00:00 +0100=>{:count=>1, :duration=>5, :lines=>361}}]
|
|
55
59
|
```
|
|
56
60
|
|
|
57
|
-
You can also store nested counters like
|
|
58
|
-
```ruby
|
|
59
|
-
Trifle::Stats.track(key: 'event::logs', at: Time.now, values: {
|
|
60
|
-
count: 1,
|
|
61
|
-
duration: {
|
|
62
|
-
parsing: 21,
|
|
63
|
-
compression: 8,
|
|
64
|
-
upload: 1
|
|
65
|
-
},
|
|
66
|
-
lines: 25432754
|
|
67
|
-
})
|
|
68
|
-
```
|
|
69
|
-
|
|
70
61
|
### Get values
|
|
71
62
|
|
|
72
63
|
Retrieve your values for specific `range`.
|
|
@@ -75,55 +66,6 @@ Trifle::Stats.values(key: 'event::logs', from: Time.now, to: Time.now, range: :d
|
|
|
75
66
|
=> [{2021-01-25 00:00:00 +0100=>{"count"=>3, "duration"=>8, "lines"=>658}}]
|
|
76
67
|
```
|
|
77
68
|
|
|
78
|
-
### Configuration
|
|
79
|
-
|
|
80
|
-
Configuration allows you to specify:
|
|
81
|
-
- `driver` - backend driver used to persist and retrieve data.
|
|
82
|
-
- `track_ranges` - list of timeline ranges you would like to track. Value must be list of symbols, defaults to `[:minute, :hour, :day, :week, :month, :quarter, :year]`.
|
|
83
|
-
- `separator` - keys can get serialized in backend, separator is used to join these values. Value must be string, defaults to `::`.
|
|
84
|
-
- `time_zone` - TZInfo zone to properly generate range for timeline values. Value must be valid TZ string identifier, otherwise it defaults and fallbacks to `'GMT'`.
|
|
85
|
-
- `beginning_of_week` - first day of week. Value must be string, defaults to `:monday`.
|
|
86
|
-
|
|
87
|
-
Gem expecs global configuration to be present. You can do this by creating initializer, or calling it on the beginning of your ruby script.
|
|
88
|
-
|
|
89
|
-
Custom configuration can be passed as a keyword argument to `Resource` objects and all module methods (`track`, `values`). This way you can pass different driver or ranges for different type of data youre storing - ie set different ranges or set expiration date on your data.
|
|
90
|
-
|
|
91
|
-
```ruby
|
|
92
|
-
configuration = Trifle::Stats::Configuration.new
|
|
93
|
-
configuration.driver = Trifle::Stats::Driver::Redis.new
|
|
94
|
-
configuration.track_ranges = [:day]
|
|
95
|
-
configuration.time_zone = 'GMT'
|
|
96
|
-
configuration.separator = '#'
|
|
97
|
-
|
|
98
|
-
# or use different driver
|
|
99
|
-
mongo_configuration = Trifle::Stats::Configuration.new
|
|
100
|
-
mongo_configuration.driver = Trifle::Stats::Driver::MongoDB.new
|
|
101
|
-
mongo_configuration.time_zone = 'Asia/Dubai'
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
You can then pass it into module methods.
|
|
105
|
-
```ruby
|
|
106
|
-
Trifle::Stats.track(key: 'event#checkout', at: Time.now, values: {count: 1}, config: configuration)
|
|
107
|
-
|
|
108
|
-
Trifle::Stats.track(key: 'event#checkout', at: Time.now, values: {count: 1}, config: mongo_configuration)
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### Driver
|
|
112
|
-
|
|
113
|
-
Driver is a wrapper around existing client libraries that talk to DB or API. It is used to store and retrieve values. You can read more in [Driver Readme](https://github.com/trifle-io/trifle-stats/tree/main/lib/trifle/ruby/driver).
|
|
114
|
-
|
|
115
|
-
## Development
|
|
116
|
-
|
|
117
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
118
|
-
|
|
119
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
120
|
-
|
|
121
|
-
## Gitpod
|
|
122
|
-
|
|
123
|
-
This repository comes Gitpod ready. If you wanna try and get your hands dirty with Trifle, click [here](https://gitpod.io/#https://github.com/trifle-io/trifle-stats) and watch magic happening.
|
|
124
|
-
|
|
125
|
-
It launches from custom base image that includes Redis, MongoDB, Postgres & MariaDB. This should give you enough playground to launch `./bin/console` and start messing around. You can see the Gitpod image in the [hub](https://hub.docker.com/r/trifle/gitpod).
|
|
126
|
-
|
|
127
69
|
## Contributing
|
|
128
70
|
|
|
129
71
|
Bug reports and pull requests are welcome on GitHub at https://github.com/trifle-io/trifle-stats.
|
data/lib/trifle/stats.rb
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'trifle/stats/driver/redis'
|
|
4
|
+
require 'trifle/stats/driver/postgres'
|
|
4
5
|
require 'trifle/stats/driver/process'
|
|
5
6
|
require 'trifle/stats/mixins/packer'
|
|
6
7
|
require 'trifle/stats/nocturnal'
|
|
7
8
|
require 'trifle/stats/configuration'
|
|
8
9
|
require 'trifle/stats/operations/timeseries/increment'
|
|
10
|
+
require 'trifle/stats/operations/timeseries/set'
|
|
9
11
|
require 'trifle/stats/operations/timeseries/values'
|
|
10
12
|
require 'trifle/stats/version'
|
|
11
13
|
|
|
@@ -33,6 +35,15 @@ module Trifle
|
|
|
33
35
|
).perform
|
|
34
36
|
end
|
|
35
37
|
|
|
38
|
+
def self.assert(key:, at:, values:, config: nil)
|
|
39
|
+
Trifle::Stats::Operations::Timeseries::Set.new(
|
|
40
|
+
key: key,
|
|
41
|
+
at: at,
|
|
42
|
+
values: values,
|
|
43
|
+
config: config
|
|
44
|
+
).perform
|
|
45
|
+
end
|
|
46
|
+
|
|
36
47
|
def self.values(key:, from:, to:, range:, config: nil)
|
|
37
48
|
Trifle::Stats::Operations::Timeseries::Values.new(
|
|
38
49
|
key: key,
|
|
@@ -6,11 +6,9 @@ module Trifle
|
|
|
6
6
|
module Stats
|
|
7
7
|
class Configuration
|
|
8
8
|
attr_writer :driver
|
|
9
|
-
attr_accessor :track_ranges, :
|
|
10
|
-
:beginning_of_week
|
|
9
|
+
attr_accessor :track_ranges, :time_zone, :beginning_of_week
|
|
11
10
|
|
|
12
11
|
def initialize
|
|
13
|
-
@separator = '::'
|
|
14
12
|
@ranges = %i[minute hour day week month quarter year]
|
|
15
13
|
@beginning_of_week = :monday
|
|
16
14
|
@time_zone = 'GMT'
|
|
@@ -1,59 +1,11 @@
|
|
|
1
1
|
# Driver
|
|
2
2
|
|
|
3
3
|
Driver is a wrapper class that persists and retrieves values from backend. It needs to implement:
|
|
4
|
-
- `inc(key:, **values)` method to store values
|
|
5
|
-
- `get(key:)` method to retrieve values
|
|
6
|
-
|
|
7
|
-
## Packer Mixin
|
|
8
|
-
|
|
9
|
-
Some databases cannot store nested hashes/values. Or they cannot perform increment on nested values that does not exist. For this reason you can use Packer mixin that helps you convert values to dot notation.
|
|
10
|
-
|
|
11
|
-
```ruby
|
|
12
|
-
class Sample
|
|
13
|
-
include Trifle::Stats::Mixins::Packer
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
values = { a: 1, b: { c: 22, d: 33 } }
|
|
17
|
-
=> {:a=>1, :b=>{:c=>22, :d=>33}}
|
|
18
|
-
|
|
19
|
-
packed = Sample.pack(hash: values)
|
|
20
|
-
=> {"a"=>1, "b.c"=>22, "b.d"=>33}
|
|
21
|
-
|
|
22
|
-
Sample.unpack(hash: packed)
|
|
23
|
-
=> {"a"=>1, "b"=>{"c"=>22, "d"=>33}}
|
|
24
|
-
```
|
|
25
4
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
```ruby
|
|
31
|
-
irb(main):001:1* class Dummy
|
|
32
|
-
irb(main):002:2* def inc(key:, **values)
|
|
33
|
-
irb(main):003:2* puts "Dumping #{key} => #{values}"
|
|
34
|
-
irb(main):004:1* end
|
|
35
|
-
irb(main):005:2* def get(key:)
|
|
36
|
-
irb(main):006:2* puts "Random for #{key}"
|
|
37
|
-
irb(main):007:2* { count: rand(1000) }
|
|
38
|
-
irb(main):008:1* end
|
|
39
|
-
irb(main):009:0> end
|
|
40
|
-
=> :get
|
|
41
|
-
|
|
42
|
-
irb(main):010:0> c = Trifle::Stats::Configuration.new
|
|
43
|
-
=> #<Trifle::Stats::Configuration:0x00007fe179aed848 @separator="::", @ranges=[:minute, :hour, :day, :week, :month, :quarter, :year], @beginning_of_week=:monday, @time_zone="GMT">
|
|
44
|
-
|
|
45
|
-
irb(main):011:0> c.driver = Dummy.new
|
|
46
|
-
=> #<Dummy:0x00007fe176302ac8>
|
|
47
|
-
|
|
48
|
-
irb(main):012:0> c.track_ranges = [:minute, :hour]
|
|
49
|
-
=> [:minute, :hour]
|
|
5
|
+
- `inc(key:, **values)` method add values
|
|
6
|
+
- `set(key:, **values)` method set values
|
|
7
|
+
- `get(key:)` method to retrieve values
|
|
50
8
|
|
|
51
|
-
|
|
52
|
-
Dumping sample::minute::1611696240 => {:count=>1}
|
|
53
|
-
Dumping sample::hour::1611694800 => {:count=>1}
|
|
54
|
-
=> [{2021-01-26 21:24:00 +0000=>{:count=>1}}, {2021-01-26 21:00:00 +0000=>{:count=>1}}]
|
|
9
|
+
## Documentation
|
|
55
10
|
|
|
56
|
-
|
|
57
|
-
Random for sample::hour::1611694800
|
|
58
|
-
=> [{2021-01-26 21:00:00 +0000=>{:count=>405}}]
|
|
59
|
-
```
|
|
11
|
+
For more details about Drivers, please refer to https://trifle.io/docs/stats/drivers
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'pg'
|
|
4
|
+
require_relative '../mixins/packer'
|
|
5
|
+
|
|
6
|
+
module Trifle
|
|
7
|
+
module Stats
|
|
8
|
+
module Driver
|
|
9
|
+
class Postgres
|
|
10
|
+
include Mixins::Packer
|
|
11
|
+
attr_accessor :client, :table_name, :separator
|
|
12
|
+
|
|
13
|
+
def initialize(client = PG::Connection.new, table_name: 'trifle_stats')
|
|
14
|
+
@client = client
|
|
15
|
+
@table_name = table_name
|
|
16
|
+
@separator = '::'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def inc(key:, **values)
|
|
20
|
+
pkey = key.join(separator)
|
|
21
|
+
|
|
22
|
+
self.class.pack(hash: values).each do |k, c|
|
|
23
|
+
_inc_one(key: pkey, name: k, value: c)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def _inc_one(key:, name:, value:)
|
|
28
|
+
data = { name => value }
|
|
29
|
+
query = "INSERT INTO trifle_stats(key, data) VALUES ('#{key}', '#{data.to_json}') ON CONFLICT (key) DO UPDATE SET data = jsonb_set(to_jsonb(trifle_stats.data), '{#{name}}', (COALESCE(trifle_stats.data->>'#{name}','0')::int + #{value})::text::jsonb)" # rubocop:disable Metric/LineLength
|
|
30
|
+
|
|
31
|
+
client.exec(query)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def set(key:, **values)
|
|
35
|
+
pkey = key.join(separator)
|
|
36
|
+
|
|
37
|
+
_set_all(key: pkey, **values)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def _set_all(key:, **values)
|
|
41
|
+
data = self.class.pack(hash: values)
|
|
42
|
+
query = "INSERT INTO trifle_stats(key, data) VALUES ('#{key}', '#{data.to_json}') ON CONFLICT (key) DO UPDATE SET data = '#{data.to_json}'" # rubocop:disable Metric/LineLength
|
|
43
|
+
|
|
44
|
+
client.exec(query)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def get(key:)
|
|
48
|
+
pkey = key.join(separator)
|
|
49
|
+
|
|
50
|
+
data = _get(key: pkey)
|
|
51
|
+
return {} if data.nil?
|
|
52
|
+
|
|
53
|
+
self.class.unpack(hash: data)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def _get(key:)
|
|
57
|
+
result = client.exec_params(
|
|
58
|
+
"SELECT * FROM #{table_name} WHERE key = $1 LIMIT 1;", [key]
|
|
59
|
+
).to_a.first
|
|
60
|
+
return nil if result.nil?
|
|
61
|
+
|
|
62
|
+
JSON.parse(result.try(:fetch, 'data'))
|
|
63
|
+
rescue JSON::ParserError
|
|
64
|
+
nil
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -9,19 +9,28 @@ module Trifle
|
|
|
9
9
|
include Mixins::Packer
|
|
10
10
|
def initialize
|
|
11
11
|
@data = {}
|
|
12
|
+
@separator = '::'
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
def inc(key:, **values)
|
|
15
16
|
self.class.pack(hash: values).each do |k, c|
|
|
16
|
-
d = @data.fetch(key, {})
|
|
17
|
+
d = @data.fetch(key.join(@separator), {})
|
|
17
18
|
d[k] = d[k].to_i + c
|
|
18
|
-
@data[key] = d
|
|
19
|
+
@data[key.join(@separator)] = d
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def set(key:, **values)
|
|
24
|
+
self.class.pack(hash: values).each do |k, c|
|
|
25
|
+
d = @data.fetch(key.join(@separator), {})
|
|
26
|
+
d[k] = c
|
|
27
|
+
@data[key.join(@separator)] = d
|
|
19
28
|
end
|
|
20
29
|
end
|
|
21
30
|
|
|
22
31
|
def get(key:)
|
|
23
32
|
self.class.unpack(
|
|
24
|
-
hash: @data.fetch(key, {})
|
|
33
|
+
hash: @data.fetch(key.join(@separator), {})
|
|
25
34
|
)
|
|
26
35
|
end
|
|
27
36
|
end
|
|
@@ -8,26 +8,33 @@ module Trifle
|
|
|
8
8
|
module Driver
|
|
9
9
|
class Redis
|
|
10
10
|
include Mixins::Packer
|
|
11
|
-
attr_accessor :prefix
|
|
11
|
+
attr_accessor :client, :prefix, :separator
|
|
12
12
|
|
|
13
13
|
def initialize(client = ::Redis.current, prefix: 'trfl')
|
|
14
14
|
@client = client
|
|
15
15
|
@prefix = prefix
|
|
16
|
+
@separator = '::'
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
def inc(key:, **values)
|
|
19
|
-
pkey = [
|
|
20
|
+
pkey = ([prefix] + key).join(separator)
|
|
20
21
|
|
|
21
22
|
self.class.pack(hash: values).each do |k, c|
|
|
22
|
-
|
|
23
|
+
client.hincrby(pkey, k, c)
|
|
23
24
|
end
|
|
24
25
|
end
|
|
25
26
|
|
|
27
|
+
def set(key:, **values)
|
|
28
|
+
pkey = ([prefix] + key).join(separator)
|
|
29
|
+
|
|
30
|
+
client.hmset(pkey, *self.class.pack(hash: values))
|
|
31
|
+
end
|
|
32
|
+
|
|
26
33
|
def get(key:)
|
|
27
|
-
pkey = [
|
|
34
|
+
pkey = ([prefix] + key).join(separator)
|
|
28
35
|
|
|
29
36
|
self.class.unpack(
|
|
30
|
-
hash:
|
|
37
|
+
hash: client.hgetall(pkey)
|
|
31
38
|
)
|
|
32
39
|
end
|
|
33
40
|
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Trifle
|
|
4
|
+
module Stats
|
|
5
|
+
module Operations
|
|
6
|
+
module Timeseries
|
|
7
|
+
class Set
|
|
8
|
+
attr_reader :key, :values
|
|
9
|
+
|
|
10
|
+
def initialize(**keywords)
|
|
11
|
+
@key = keywords.fetch(:key)
|
|
12
|
+
@at = keywords.fetch(:at)
|
|
13
|
+
@values = keywords.fetch(:values)
|
|
14
|
+
@config = keywords[:config]
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def config
|
|
18
|
+
@config || Trifle::Stats.default
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def perform
|
|
22
|
+
config.ranges.map do |range|
|
|
23
|
+
at = Nocturnal.new(@at, config: config).send(range)
|
|
24
|
+
config.driver.set(
|
|
25
|
+
key: [key, range, at.to_i],
|
|
26
|
+
**values
|
|
27
|
+
)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
data/lib/trifle/stats/version.rb
CHANGED
data/trifle-stats.gemspec
CHANGED
|
@@ -6,15 +6,17 @@ Gem::Specification.new do |spec|
|
|
|
6
6
|
spec.authors = ['Jozef Vaclavik']
|
|
7
7
|
spec.email = ['jozef@hey.com']
|
|
8
8
|
|
|
9
|
-
spec.summary = 'Simple analytics
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
'
|
|
13
|
-
|
|
9
|
+
spec.summary = 'Simple analytics backed by Redis, Postgres, MongoDB, '\
|
|
10
|
+
'Google Analytics, Segment, or whatever.'
|
|
11
|
+
spec.description = 'Trifle::Stats is a way too simple timeline analytics '\
|
|
12
|
+
'that helps you track custom metrics. Automatically '\
|
|
13
|
+
'increments counters for each enabled range. '\
|
|
14
|
+
'It supports timezones and different week beginning.'
|
|
15
|
+
spec.homepage = "https://trifle.io"
|
|
14
16
|
spec.required_ruby_version = Gem::Requirement.new('>= 2.6')
|
|
15
17
|
|
|
16
18
|
spec.metadata['homepage_uri'] = spec.homepage
|
|
17
|
-
spec.metadata['source_code_uri'] =
|
|
19
|
+
spec.metadata['source_code_uri'] = 'https://github.com/trifle-io/trifle-stats'
|
|
18
20
|
|
|
19
21
|
# Specify which files should be added to the gem when it is released.
|
|
20
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
@@ -32,5 +34,6 @@ Gem::Specification.new do |spec|
|
|
|
32
34
|
spec.add_development_dependency('rspec', '~> 3.2')
|
|
33
35
|
spec.add_development_dependency('rubocop', '1.0.0')
|
|
34
36
|
spec.add_runtime_dependency('redis', '>= 4.2')
|
|
37
|
+
spec.add_runtime_dependency('pg', '>= 1.2')
|
|
35
38
|
spec.add_runtime_dependency('tzinfo', '~> 2.0')
|
|
36
39
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: trifle-stats
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jozef Vaclavik
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-04-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -108,6 +108,20 @@ dependencies:
|
|
|
108
108
|
- - ">="
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '4.2'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: pg
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '1.2'
|
|
118
|
+
type: :runtime
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ">="
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '1.2'
|
|
111
125
|
- !ruby/object:Gem::Dependency
|
|
112
126
|
name: tzinfo
|
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -122,8 +136,9 @@ dependencies:
|
|
|
122
136
|
- - "~>"
|
|
123
137
|
- !ruby/object:Gem::Version
|
|
124
138
|
version: '2.0'
|
|
125
|
-
description: Trifle
|
|
126
|
-
for each range.
|
|
139
|
+
description: Trifle::Stats is a way too simple timeline analytics that helps you track
|
|
140
|
+
custom metrics. Automatically increments counters for each enabled range. It supports
|
|
141
|
+
timezones and different week beginning.
|
|
127
142
|
email:
|
|
128
143
|
- jozef@hey.com
|
|
129
144
|
executables: []
|
|
@@ -139,7 +154,6 @@ files:
|
|
|
139
154
|
- ".rubocop.yml"
|
|
140
155
|
- ".ruby-version"
|
|
141
156
|
- ".tool-versions"
|
|
142
|
-
- ".travis.yml"
|
|
143
157
|
- Gemfile
|
|
144
158
|
- Gemfile.lock
|
|
145
159
|
- LICENSE
|
|
@@ -150,18 +164,20 @@ files:
|
|
|
150
164
|
- lib/trifle/stats.rb
|
|
151
165
|
- lib/trifle/stats/configuration.rb
|
|
152
166
|
- lib/trifle/stats/driver/README.md
|
|
167
|
+
- lib/trifle/stats/driver/postgres.rb
|
|
153
168
|
- lib/trifle/stats/driver/process.rb
|
|
154
169
|
- lib/trifle/stats/driver/redis.rb
|
|
155
170
|
- lib/trifle/stats/mixins/packer.rb
|
|
156
171
|
- lib/trifle/stats/nocturnal.rb
|
|
157
172
|
- lib/trifle/stats/operations/timeseries/increment.rb
|
|
173
|
+
- lib/trifle/stats/operations/timeseries/set.rb
|
|
158
174
|
- lib/trifle/stats/operations/timeseries/values.rb
|
|
159
175
|
- lib/trifle/stats/version.rb
|
|
160
176
|
- trifle-stats.gemspec
|
|
161
|
-
homepage: https://
|
|
177
|
+
homepage: https://trifle.io
|
|
162
178
|
licenses: []
|
|
163
179
|
metadata:
|
|
164
|
-
homepage_uri: https://
|
|
180
|
+
homepage_uri: https://trifle.io
|
|
165
181
|
source_code_uri: https://github.com/trifle-io/trifle-stats
|
|
166
182
|
post_install_message:
|
|
167
183
|
rdoc_options: []
|
|
@@ -181,5 +197,6 @@ requirements: []
|
|
|
181
197
|
rubygems_version: 3.2.3
|
|
182
198
|
signing_key:
|
|
183
199
|
specification_version: 4
|
|
184
|
-
summary: Simple analytics
|
|
200
|
+
summary: Simple analytics backed by Redis, Postgres, MongoDB, Google Analytics, Segment,
|
|
201
|
+
or whatever.
|
|
185
202
|
test_files: []
|