meeseeks 0.1.4 → 0.1.5
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/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +41 -2
- data/lib/meeseeks/harvester.rb +12 -5
- data/lib/meeseeks/http_trap.rb +8 -0
- data/lib/meeseeks/meeseeks.rb +8 -0
- data/lib/meeseeks/payload.rb +2 -2
- data/lib/meeseeks/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8a0a151c08bf506a173bb9de62e082287bfd445e3fa472c418d95e5db737703
|
4
|
+
data.tar.gz: 380a26f7598ba2ad6cdb8860235957a65527dd34c13e68fe7f00b3764fdd42c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96f1db2392ebebc6e843ee117fdfa80ad1aedb4194eaa2834cb36be3b54b80bac16925f048ede997ff6a6ba2c7c23a56c21afd4499ed63040617fe0b061a12a7
|
7
|
+
data.tar.gz: 5a487c1c8c8167ed5af4b87aca6e2f18a22e74fb179b49781d3447f33d408d391689538027cf980ccca3e38666f23446d52fdf4ee135dbc34ac1ed1e6327e0a3
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -7,6 +7,7 @@
|
|
7
7
|
|
8
8
|
⚠️ Do not use in production ⚠️
|
9
9
|
|
10
|
+
|
10
11
|
## Usage
|
11
12
|
|
12
13
|
Asynchronously submit metrics to a Circonus HTTPTrap:
|
@@ -36,35 +37,73 @@ and use the singleton (to the same effect as the example above):
|
|
36
37
|
Meeseeks.instance.record('group', 'metric', 22.02)
|
37
38
|
```
|
38
39
|
|
40
|
+
|
39
41
|
### Meeseeks statistics
|
40
42
|
|
41
|
-
Meeseeks will instrument itself on Circonus
|
43
|
+
Meeseeks will instrument itself on Circonus (these metrics will be added to each
|
44
|
+
batch submitted to Circonus, so for `max_batch_size: 100` we will really submit
|
45
|
+
104 metrics each time). Look for these metrics:
|
42
46
|
|
43
47
|
- ``meeseeks`batch_size`` (how many measurements were submitted per request to Circonus?)
|
44
48
|
- ``meeseeks`cycle_count`` (how many intervals did this meeseeks instance do?)
|
45
49
|
- ``meeseeks`queue_size`` (how many measurements are waiting in the queue to be submitted?)
|
46
|
-
- ``meeseeks`
|
50
|
+
- ``meeseeks`submit_count`` (how many requests to Circonus did this meeseeks instance do?)
|
51
|
+
|
52
|
+
|
53
|
+
### Debugging
|
54
|
+
|
55
|
+
We tried to make Meeseeks inspectable:
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
# Basic stats
|
59
|
+
> Meeseeks.stats
|
60
|
+
=> {
|
61
|
+
"queue_size": 0,
|
62
|
+
"harvester": {
|
63
|
+
"cycle_count": 7,
|
64
|
+
"running": true
|
65
|
+
},
|
66
|
+
"http_trap": {
|
67
|
+
"submit_count": 7,
|
68
|
+
"last_submit_at": "2018-10-19 10:42:35 +0000"
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
# You can even dive into the requests to Circonus, and the responses
|
73
|
+
# received (including bodies):
|
74
|
+
> Meeseeks.http_trap.last.request
|
75
|
+
=> #<Net::HTTP::Put PUT>
|
76
|
+
> Meeseeks.http_trap.last.response
|
77
|
+
=> #<Net::HTTPOK 200 OK readbody=true>
|
78
|
+
|
79
|
+
```
|
80
|
+
|
47
81
|
|
48
82
|
## Development
|
49
83
|
|
50
84
|
After checking out the repo, run `make build` - you need only docker on your machine, no ruby, rvm, or any of that.
|
51
85
|
|
86
|
+
|
52
87
|
### Launch a shell or console
|
53
88
|
|
54
89
|
To try it out locally while developing, you can `make shell` to open a shell in a container where the gem's dependencies are installed, and you can use `make console` as an alias for entering `make shell` and `rake console`.
|
55
90
|
|
91
|
+
|
56
92
|
### Run the tests
|
57
93
|
|
58
94
|
During development, you can just keep `make guard` running and it will test files as you edit them. You can also run `make test` to run all of the tests.
|
59
95
|
|
96
|
+
|
60
97
|
### Automatically fix rubocop offenses
|
61
98
|
|
62
99
|
Run `make rubocop`.
|
63
100
|
|
101
|
+
|
64
102
|
## Contributing
|
65
103
|
|
66
104
|
Bug reports and pull requests are welcome on GitHub at https://github.com/coup-mobility/meeseeks. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
67
105
|
|
106
|
+
|
68
107
|
## Code of Conduct
|
69
108
|
|
70
109
|
Everyone interacting in the Meeseeks project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/coup-mobility/meeseeks/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/meeseeks/harvester.rb
CHANGED
@@ -17,6 +17,13 @@ module Meeseeks
|
|
17
17
|
@lock = Mutex.new
|
18
18
|
end
|
19
19
|
|
20
|
+
def stats
|
21
|
+
{
|
22
|
+
cycle_count: @cycle_count,
|
23
|
+
running: running?
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
20
27
|
def start
|
21
28
|
@continue = true
|
22
29
|
return if @thread&.alive?
|
@@ -61,15 +68,15 @@ module Meeseeks
|
|
61
68
|
rescue StandardError
|
62
69
|
# TODO: think about whether or not this is a good idea. It's nice to
|
63
70
|
# recover from the occasional HTTP hickup, but when we can't submit
|
64
|
-
# to Circonus for whatever reason, we'll fill up the RAM. Do we
|
65
|
-
# to implement limited retries here, or do we want to impose a
|
66
|
-
# length on the queue, or what do we want to do?
|
71
|
+
# to Circonus at all for whatever reason, we'll fill up the RAM. Do we
|
72
|
+
# want to implement limited retries here, or do we want to impose a
|
73
|
+
# max length on the queue, or what do we want to do?
|
67
74
|
batch.map { |d| @queue.push(d) }
|
68
75
|
end
|
69
76
|
|
70
77
|
# Even if the batch is empty, we want to submit our own statistics
|
71
78
|
# for this cycle, and that's why we don't break before the submit
|
72
|
-
break if
|
79
|
+
break if @queue.empty?
|
73
80
|
end
|
74
81
|
end
|
75
82
|
|
@@ -90,7 +97,7 @@ module Meeseeks
|
|
90
97
|
{ meeseeks: {} }.tap do |stats|
|
91
98
|
stats[:meeseeks].merge!(Payload.for('batch_size', batch_size))
|
92
99
|
stats[:meeseeks].merge!(Payload.for('queue_size', @queue.size))
|
93
|
-
stats[:meeseeks].merge!(Payload.for('
|
100
|
+
stats[:meeseeks].merge!(Payload.for('submit_count', submit_count))
|
94
101
|
stats[:meeseeks].merge!(Payload.for('cycle_count', @cycle_count))
|
95
102
|
end
|
96
103
|
end
|
data/lib/meeseeks/http_trap.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'net/http'
|
4
4
|
require 'json'
|
5
5
|
|
6
|
+
# See https://login.circonus.com/resources/docs/user/Data/CheckTypes/HTTPTrap.html
|
6
7
|
module Meeseeks
|
7
8
|
class HTTPTrap
|
8
9
|
attr_reader :last, :submit_count
|
@@ -22,6 +23,13 @@ module Meeseeks
|
|
22
23
|
JSON.parse res.body
|
23
24
|
end
|
24
25
|
|
26
|
+
def stats
|
27
|
+
{
|
28
|
+
submit_count: @submit_count,
|
29
|
+
last_submit_at: @last&.time
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
25
33
|
private
|
26
34
|
|
27
35
|
def request(measurements)
|
data/lib/meeseeks/meeseeks.rb
CHANGED
data/lib/meeseeks/payload.rb
CHANGED
@@ -14,9 +14,9 @@ module Meeseeks
|
|
14
14
|
def self.for(metric, value, time = DateTime.now)
|
15
15
|
{
|
16
16
|
metric.to_s => {
|
17
|
-
'_ts' => time.to_datetime.strftime('%Q'),
|
17
|
+
'_ts' => time.to_datetime.strftime('%Q').to_i,
|
18
18
|
'_value' => value,
|
19
|
-
'_type' => '
|
19
|
+
'_type' => 'n'
|
20
20
|
}
|
21
21
|
}
|
22
22
|
end
|
data/lib/meeseeks/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meeseeks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jannis Hermanns
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|