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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac99676944c67bc64c93a2297aa481518119d8cf
4
- data.tar.gz: a4f670b8c599a4f4ea57208f4647a82cbc77cd6e
3
+ metadata.gz: d2f39dfdbc6fdc05a0fd4e28748784ca1189acf9
4
+ data.tar.gz: b2081766249b24d542c21250c915a9d3510517a9
5
5
  SHA512:
6
- metadata.gz: 13ea2e22c5062d2c91626b90776126ee8fd15272197ea03621128b04ede7903acedfd0503fc9d85715ad12a264638d18bd9fbb153d0c23fb5dda768302bba993
7
- data.tar.gz: 606d586a2bc999e0c7cc5e276609421bf449265f0e89fbabeb4d7115508c58b86bab5885d5feb95b7877f4321358efbd0e70c64d6ce860d68a14db6ca855b2de
6
+ metadata.gz: 6fa6eea5b0b46095592ac292ca44c4918245688b38dd29c903e397b88a9ed09588e843348564c1f2dc98b128bf964089e789028f8fbc4b390c981f902bca32e3
7
+ data.tar.gz: c95cb3da2fd558c8784525317172e55bf8fde339ed35f37b11f2add9b99cc21794631ea86ff817c4564cef1b0e7662c73d92698b4c3b58797dadf31bf2b1b89b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## Tremolo 0.2.1 ##
2
+
3
+ * Add `Tremolo.fetch` in place of using Celluloid
4
+
5
+ *Tony Pitale*
6
+
1
7
  ## Tremolo 0.2.0 ##
2
8
 
3
9
  * Adds tags to `Tracker` and `Series`
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
- # Get an unsupervised tracker
27
- tracker = Tremolo.tracker('0.0.0.0', 4444)
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('0.0.0.0', 4444, namespace: 'appname')
32
+ tracker = Tremolo.supervised_tracker(:tracker, '0.0.0.0', 4444, namespace: 'appname')
32
33
 
33
- # tracker is a Celluloid Actor, it will not be GC'd like you would expect so I'd advise against doing it this way.
34
+ # whenever you want to use this tracker, you can fetch it
35
+ tracker = Tremolo.fetch(:tracker)
34
36
 
35
- # Because we're using celluloid, we probably want to create a supervised tracker
36
- Tremolo.supervised_tracker(:tracker, '0.0.0.0', 4444, namespace: 'appname')
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
- # whenever you want to use this supervised tracker, you can always ask Celluloid
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`, and `time`, and `write_point`, as the last argument.
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
- if host.nil? || port.nil?
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
@@ -1,3 +1,3 @@
1
1
  module Tremolo
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
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.0
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-06 00:00:00.000000000 Z
11
+ date: 2015-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: celluloid-io