tremolo 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +16 -12
- data/lib/tremolo.rb +8 -4
- data/lib/tremolo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2f39dfdbc6fdc05a0fd4e28748784ca1189acf9
|
4
|
+
data.tar.gz: b2081766249b24d542c21250c915a9d3510517a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fa6eea5b0b46095592ac292ca44c4918245688b38dd29c903e397b88a9ed09588e843348564c1f2dc98b128bf964089e789028f8fbc4b390c981f902bca32e3
|
7
|
+
data.tar.gz: c95cb3da2fd558c8784525317172e55bf8fde339ed35f37b11f2add9b99cc21794631ea86ff817c4564cef1b0e7662c73d92698b4c3b58797dadf31bf2b1b89b
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -16,28 +16,32 @@ Or install it yourself as:
|
|
16
16
|
|
17
17
|
$ gem install tremolo
|
18
18
|
|
19
|
-
## Is it any good?
|
19
|
+
## Is it any good? ##
|
20
20
|
|
21
21
|
It's getting there, but some of the nuance of the method API and Celluloid's behavior are still being worked out. I'll let you know when it's settled down a bit more.
|
22
22
|
|
23
|
-
## Usage
|
23
|
+
## Usage ##
|
24
24
|
|
25
25
|
```ruby
|
26
|
-
#
|
27
|
-
|
26
|
+
# Start by creating a supervised tracker
|
27
|
+
# and point it at our InfluxDB server's UDP port
|
28
|
+
Tremolo.supervised_tracker(:tracker, '0.0.0.0', 4444)
|
28
29
|
|
29
30
|
# options that can be set on the tracker:
|
30
31
|
# namespace, a string prefix for all series names on this tracker, joined with '.' (default="")
|
31
|
-
tracker = Tremolo.tracker
|
32
|
+
tracker = Tremolo.supervised_tracker(:tracker, '0.0.0.0', 4444, namespace: 'appname')
|
32
33
|
|
33
|
-
#
|
34
|
+
# whenever you want to use this tracker, you can fetch it
|
35
|
+
tracker = Tremolo.fetch(:tracker)
|
34
36
|
|
35
|
-
#
|
36
|
-
|
37
|
+
# if there is no tracker by this name, it will return a NoopTracker
|
38
|
+
# useful when in testing or development
|
39
|
+
tracker = Tremolo.fetch(:notreallythere)
|
40
|
+
```
|
37
41
|
|
38
|
-
|
39
|
-
tracker = Celluloid::Actor[:tracker]
|
42
|
+
Now that we have our tracker, let's send some data to InfluxDB:
|
40
43
|
|
44
|
+
```ruby
|
41
45
|
# Write a point to 'series-name' series
|
42
46
|
tracker.write_point('series-name', {:value => 121, :otherdata => 998142})
|
43
47
|
|
@@ -72,7 +76,7 @@ value = series.time { Net::HTTP.get(URI('http://google.com')) }
|
|
72
76
|
|
73
77
|
## Tags ##
|
74
78
|
|
75
|
-
A Hash of `tags` data can be passed to `increment`, `decrement`, `timing`,
|
79
|
+
A Hash of `tags` data can be passed to `increment`, `decrement`, `timing`, `time`, and `write_point`, as the last argument. Very useful for segmenting data by some "metadata".
|
76
80
|
|
77
81
|
```ruby
|
78
82
|
series.write_point({:value => 18}, {:otherdata => 1986})
|
@@ -83,7 +87,7 @@ series.write_point({:value => 18}, {:otherdata => 1986})
|
|
83
87
|
Since version 0.7.1 of InfluxDB, multiple databases can be configured for different UDP ports. All
|
84
88
|
tracking in Tremolo is done by way of UDP.
|
85
89
|
|
86
|
-
So, port 4444 from the above goes to one database as configured, and port 8191 could go to a second DB.
|
90
|
+
So, port 4444 from the examples above goes to one database as configured, and port 8191 could go to a second DB.
|
87
91
|
|
88
92
|
This somewhat negates the need for the `namespace` option to be set for a `tracker` since each application
|
89
93
|
could be configured to go to its own InfluxDB database.
|
data/lib/tremolo.rb
CHANGED
@@ -16,14 +16,18 @@ module Tremolo
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def supervised_tracker(as, host, port, options={})
|
19
|
-
|
20
|
-
NoopTracker.new(host, port, options)
|
21
|
-
else
|
19
|
+
unless host.nil? || port.nil?
|
22
20
|
Celluloid.supervise type: Tracker, as: as.to_sym, args: [host, port, options]
|
23
|
-
Celluloid::Actor[as.to_sym]
|
24
21
|
end
|
22
|
+
|
23
|
+
fetch(as, NoopTracker.new(host, port, options))
|
24
|
+
end
|
25
|
+
|
26
|
+
def fetch(as, default = NoopTracker.new(nil, nil))
|
27
|
+
Celluloid::Actor[as.to_sym] || default
|
25
28
|
end
|
26
29
|
|
30
|
+
module_function :fetch
|
27
31
|
module_function :tracker
|
28
32
|
module_function :supervised_tracker
|
29
33
|
end
|
data/lib/tremolo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tremolo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Pitale
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid-io
|