tremolo 0.0.4 → 0.1.0

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: 32a54e2c56f4c0dc08262bed5ff4b8bf74ad037d
4
- data.tar.gz: 5781e18979cf200095c21a4a6abca08473055917
3
+ metadata.gz: 8cd301464b545211094d14f81fb7f5fabae6ee2b
4
+ data.tar.gz: 3f00b4c4eef1277501e6ba5107c4a87a0a7ae07c
5
5
  SHA512:
6
- metadata.gz: 59cd090fc5980557f1dec2608bac50d2f9bafae025e811dbee903fb7ab944ef3f9c9375e378023ea98df9bee9799cff0581a1c932ebc95a128478a756bd3a9f5
7
- data.tar.gz: d3936ce56375039d9a769fd6cd1b1bf440a2b49eba236a4140c763d000a9d08a47649e68b8b49c7ce8c282ddaf2cf5745292752a4e5fe3ad0bd9c23130978bec
6
+ metadata.gz: bfb314678ffd0ac4ce31be0cb679c6153f02ef1bed74665a7870bfaa0a02bc585e2b0138d8d6d807f1905db0277e014dab2a71913a6b03c00da6ea043e18ba69
7
+ data.tar.gz: 0eb35699d48509e6d2d363b87683d50d7c6591ee1193cf76cb3c6a6dc1070aa770fbe510e7446d3bcf7c50d53072cd2e30e80a16daf45d18569186b38eb1954c
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.1.2
1
+ 2.2.2
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+ sudo: false
3
+ rvm:
4
+ - 2.1.0
5
+ - 2.2.2
6
+ script: bundle exec rake
7
+ notifications:
8
+ webhooks:
9
+ urls:
10
+ - "https://pitaleerb.slack.com/services/hooks/travis?token=wNtbVP9B3j1npZkLzK4bpq8Q"
11
+ on_success: change # options: [always|never|change] default: always
12
+ on_failure: always # options: [always|never|change] default: always
13
+ on_start: false # default: false
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## Tremolo 0.1.0 ##
2
+
3
+ * Wireline compatibility with Influxdb 0.9 series
4
+ * Update celluloid to 0.17.2+
5
+
6
+ *Tony Pitale*
7
+
1
8
  ## Tremolo 0.0.4 ##
2
9
 
3
10
  * Make Tremolo::Tracker a Celluloid actor so that it can be supervised if desired
@@ -0,0 +1,22 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
6
+
7
+ Examples of unacceptable behavior by participants include:
8
+
9
+ * The use of sexualized language or imagery
10
+ * Personal attacks
11
+ * Trolling or insulting/derogatory comments
12
+ * Public or private harassment
13
+ * Publishing other's private information, such as physical or electronic addresses, without explicit permission
14
+ * Other unethical or unprofessional conduct.
15
+
16
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
17
+
18
+ This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
19
+
20
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
21
+
22
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
@@ -1,28 +1,27 @@
1
1
  module Tremolo
2
2
  class DataPoint
3
- def self.from_hash(series_name, h)
4
- new(series_name, h.reduce(:merge).keys, h)
5
- end
6
-
7
- attr_accessor :series_name, :columns
3
+ attr_accessor :series_name, :data, :time
8
4
 
9
- def initialize(series_name, columns, data)
5
+ def initialize(series_name, data, time=nil)
10
6
  self.series_name = series_name
11
- self.columns = columns.sort
7
+ self.data = data
8
+ self.time = time.nil? ? nil : time.to_i
9
+ end
10
+
11
+ def values
12
+ @data.map {|h| h.map {|k,v| "#{k}=#{cast(v)}" }.join(',')}
13
+ end
12
14
 
13
- @data = data
15
+ def cast(value)
16
+ value
14
17
  end
15
18
 
16
- def points
17
- @points ||= @data.map {|h| h.values_at(*columns) }
19
+ def line
20
+ @line ||= lambda {|values| [series_name, values, time].compact.join(' ')}
18
21
  end
19
22
 
20
- def as_json
21
- [{
22
- name: series_name,
23
- columns: columns,
24
- points: points
25
- }]
23
+ def lines
24
+ values.map {|v| line.call(v)}.join("\n")
26
25
  end
27
26
  end
28
27
  end
@@ -17,7 +17,7 @@ module Tremolo
17
17
 
18
18
  private
19
19
  def prepare(series_name, data)
20
- JSON.generate(DataPoint.from_hash(series_name, data).as_json)
20
+ DataPoint.new(series_name, data).lines
21
21
  end
22
22
  end
23
23
  end
@@ -1,3 +1,3 @@
1
1
  module Tremolo
2
- VERSION = "0.0.4"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/tremolo.rb CHANGED
@@ -1,6 +1,9 @@
1
1
  require "tremolo/version"
2
2
 
3
3
  require "json"
4
+ require "celluloid"
5
+ Celluloid.boot
6
+
4
7
  require "celluloid/io"
5
8
 
6
9
  module Tremolo
@@ -16,7 +19,7 @@ module Tremolo
16
19
  if host.nil? || port.nil?
17
20
  NoopTracker.new(host, port, options)
18
21
  else
19
- Tracker.supervise_as as.to_sym, host, port, options
22
+ Celluloid.supervise type: Tracker, as: as.to_sym, args: [host, port, options]
20
23
  Celluloid::Actor[as.to_sym]
21
24
  end
22
25
  end
@@ -14,37 +14,37 @@ describe Tremolo::Series do
14
14
  it 'sends point data formatted for InfluxDB', :celluloid => true do
15
15
  series.write_point({value: 111, associated_id: 81102})
16
16
 
17
- json = '[{"name":"accounts.created","columns":["associated_id","value"],"points":[[81102,111]]}]'
17
+ line = 'accounts.created value=111,associated_id=81102'
18
18
 
19
19
  sleep 0.1
20
- expect(socket).to have_received(:send).with(json, 0)
20
+ expect(socket).to have_received(:send).with(line, 0)
21
21
  end
22
22
 
23
23
  it 'sends single point with value 1', :celluloid => true do
24
24
  series.increment
25
25
 
26
- json = '[{"name":"accounts.created","columns":["value"],"points":[[1]]}]'
26
+ line = 'accounts.created value=1'
27
27
 
28
28
  sleep 0.1
29
- expect(socket).to have_received(:send).with(json, 0)
29
+ expect(socket).to have_received(:send).with(line, 0)
30
30
  end
31
31
 
32
32
  it 'sends single point with value -1', :celluloid => true do
33
33
  series.decrement
34
34
 
35
- json = '[{"name":"accounts.created","columns":["value"],"points":[[-1]]}]'
35
+ line = 'accounts.created value=-1'
36
36
 
37
37
  sleep 0.1
38
- expect(socket).to have_received(:send).with(json, 0)
38
+ expect(socket).to have_received(:send).with(line, 0)
39
39
  end
40
40
 
41
41
  it 'tracks timing value for ms', :celluloid => true do
42
42
  series.timing(89)
43
43
 
44
- json = '[{"name":"accounts.created","columns":["value"],"points":[[89]]}]'
44
+ line = 'accounts.created value=89'
45
45
 
46
46
  sleep 0.1
47
- expect(socket).to have_received(:send).with(json, 0)
47
+ expect(socket).to have_received(:send).with(line, 0)
48
48
  end
49
49
 
50
50
  it 'tracks block timing value for ms', :celluloid => true do
@@ -60,10 +60,10 @@ describe Tremolo::Series do
60
60
  'returning another thing'
61
61
  end
62
62
 
63
- json = '[{"name":"accounts.created","columns":["value"],"points":[[1050]]}]'
63
+ line = 'accounts.created value=1050'
64
64
 
65
65
  sleep 0.1
66
66
  expect(returned).to eq('returning another thing')
67
- expect(socket).to have_received(:send).with(json, 0)
67
+ expect(socket).to have_received(:send).with(line, 0)
68
68
  end
69
69
  end
@@ -13,38 +13,37 @@ describe Tremolo::Tracker do
13
13
  it 'sends point data formatted for InfluxDB', :celluloid => true do
14
14
  tracker.write_point('accounts.created', {value: 111, associated_id: 81102})
15
15
 
16
- json = '[{"name":"accounts.created","columns":["associated_id","value"],"points":[[81102,111]]}]'
17
-
16
+ line = 'accounts.created value=111,associated_id=81102'
18
17
 
19
18
  sleep 0.1
20
- expect(socket).to have_received(:send).with(json, 0)
19
+ expect(socket).to have_received(:send).with(line, 0)
21
20
  end
22
21
 
23
22
  it 'sends single point with value 1', :celluloid => true do
24
23
  tracker.increment('accounts.created')
25
24
 
26
- json = '[{"name":"accounts.created","columns":["value"],"points":[[1]]}]'
25
+ line = 'accounts.created value=1'
27
26
 
28
27
  sleep 0.1
29
- expect(socket).to have_received(:send).with(json, 0)
28
+ expect(socket).to have_received(:send).with(line, 0)
30
29
  end
31
30
 
32
31
  it 'sends single point with value -1', :celluloid => true do
33
32
  tracker.decrement('accounts.created')
34
33
 
35
- json = '[{"name":"accounts.created","columns":["value"],"points":[[-1]]}]'
34
+ line = 'accounts.created value=-1'
36
35
 
37
36
  sleep 0.1
38
- expect(socket).to have_received(:send).with(json, 0)
37
+ expect(socket).to have_received(:send).with(line, 0)
39
38
  end
40
39
 
41
40
  it 'tracks timing value for ms', :celluloid => true do
42
41
  tracker.timing('timing.accounts.created', 89)
43
42
 
44
- json = '[{"name":"timing.accounts.created","columns":["value"],"points":[[89]]}]'
43
+ line = 'timing.accounts.created value=89'
45
44
 
46
45
  sleep 0.1
47
- expect(socket).to have_received(:send).with(json, 0)
46
+ expect(socket).to have_received(:send).with(line, 0)
48
47
  end
49
48
 
50
49
  it 'tracks block timing value for ms', :celluloid => true do
@@ -60,11 +59,11 @@ describe Tremolo::Tracker do
60
59
  'returning a thing'
61
60
  end
62
61
 
63
- json = '[{"name":"timing.accounts.created","columns":["value"],"points":[[1014]]}]'
62
+ line = 'timing.accounts.created value=1014'
64
63
 
65
64
  sleep 0.1
66
65
  expect(returned).to eq('returning a thing')
67
- expect(socket).to have_received(:send).with(json, 0)
66
+ expect(socket).to have_received(:send).with(line, 0)
68
67
  end
69
68
 
70
69
  context "with a namespace" do
@@ -73,10 +72,10 @@ describe Tremolo::Tracker do
73
72
  it 'tracks timing value for ms', :celluloid => true do
74
73
  tracker.timing('timing.accounts.created', 14)
75
74
 
76
- json = '[{"name":"alf.timing.accounts.created","columns":["value"],"points":[[14]]}]'
75
+ line = 'alf.timing.accounts.created value=14'
77
76
 
78
77
  sleep 0.1
79
- expect(socket).to have_received(:send).with(json, 0)
78
+ expect(socket).to have_received(:send).with(line, 0)
80
79
  end
81
80
  end
82
81
  end
data/tremolo.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "celluloid-io", ">= 0.16.0.pre2"
21
+ spec.add_dependency "celluloid-io", ">= 0.17.2"
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.6"
24
24
  spec.add_development_dependency "rake"
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.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Pitale
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-20 00:00:00.000000000 Z
11
+ date: 2015-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: celluloid-io
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.16.0.pre2
19
+ version: 0.17.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.16.0.pre2
26
+ version: 0.17.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -118,7 +118,9 @@ files:
118
118
  - ".gitignore"
119
119
  - ".rspec"
120
120
  - ".ruby-version"
121
+ - ".travis.yml"
121
122
  - CHANGELOG.md
123
+ - CODE_OF_CONDUCT.md
122
124
  - CONTRIBUTING.md
123
125
  - Gemfile
124
126
  - LICENSE.txt
@@ -156,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
158
  version: '0'
157
159
  requirements: []
158
160
  rubyforge_project:
159
- rubygems_version: 2.2.2
161
+ rubygems_version: 2.4.5
160
162
  signing_key:
161
163
  specification_version: 4
162
164
  summary: InfluxDB UDP Tracker built on Celluloid::IO