fluent-plugin-dashing 0.0.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1d6e1c4ae8ee0e41d41a93282209da7a5a762a42
4
+ data.tar.gz: 652f616c4d13c990a2689b23e7a2bd8f52041ea6
5
+ SHA512:
6
+ metadata.gz: 649740e95e4edcbce261d3a7c4d0501ecfda9cc05f8073fcd7e9a2da96e509e4ff58d366ec06e6e01e4e78af6ab277e93597d7ce081eb5c5c70d91c730488826
7
+ data.tar.gz: 16dd1addc548cc851ef0ad80aef0dc4fab89969ed873157b932087bedfe7603f2b998ad69942fd4620eb660519df05ffb606efc3a2372a4061e2a0d1ee037cc5
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ vendor
19
+
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent_parser_s.gemspec
4
+ gemspec
@@ -0,0 +1,52 @@
1
+ # fluent-plugin-dashing
2
+
3
+ ## DashingOutput
4
+
5
+ Plugin to output data(number, text, etc...) to 'Dashing', dashboard framework over HTTP.
6
+
7
+ About Dashing, see:
8
+
9
+ - Web site: http://shopify.github.io/dashing/
10
+ - Github: https://github.com/Shopify/dashing
11
+ - Demo: http://dashingdemo.herokuapp.com/sample
12
+
13
+ ### Configure
14
+
15
+ ````
16
+ <store>
17
+ type dashing
18
+ dashing_url http://localhost:3030/widgets/widget_id
19
+ auth_token MY_AUTH_TOKEN
20
+ event_json_data_key current
21
+ name_key field1
22
+ </store>
23
+ ````
24
+
25
+ - dashing_url
26
+ - Your Dashing API URL
27
+ - see: http://shopify.github.io/dashing/#data -> API
28
+ - auth_token
29
+ - Your Dashing auth_token (which can be found in config.ru)
30
+ - see: http://shopify.github.io/dashing/#data -> API
31
+ - event_json_data_key
32
+ - data key in post data (json format)
33
+ - name_key
34
+
35
+ #### example
36
+
37
+ For messages such as: {"field1":300, "field2":20, "field3diff":-30}
38
+ Send 'field1' value to http://localhost:3030/widgets/widget_id (see: http://shopify.github.io/dashing/#data -> API)
39
+
40
+ Post '{ "auth_token": MY_AUTH_TOKEN, "current": 300 }' to http://localhost:3030/widgets/widget_id
41
+
42
+ ## Contributing
43
+
44
+ 1. Fork it
45
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
46
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
47
+ 4. Push to the branch (`git push origin my-new-feature`)
48
+ 5. Create new Pull Request
49
+
50
+ ## releases
51
+
52
+ - 2013/09/26 0.0.0 1st release
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "fluent-plugin-dashing"
7
+ spec.version = '0.0.0'
8
+ spec.authors = ["bash0C7"]
9
+ spec.email = ["koshiba+github@4038nullpointer.com"]
10
+ spec.description = "Fluentd output plugin to post data to dashing"
11
+ spec.summary = "Fluentd output plugin to post data to dashing"
12
+ spec.homepage = "https://github.com/bash0C7/fluent-plugin-dashing"
13
+ spec.license = "Ruby's"
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "fluentd"
21
+ spec.add_dependency "httparty"
22
+ spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "rake"
24
+ spec.add_development_dependency "rspec"
25
+ spec.add_development_dependency "rr"
26
+ spec.add_development_dependency "pry"
27
+ end
@@ -0,0 +1,44 @@
1
+ require 'httparty'
2
+
3
+ module Fluent
4
+ class Fluent::DashingOutput < Fluent::Output
5
+ Fluent::Plugin.register_output('dashing', self)
6
+
7
+ def initialize
8
+ super
9
+ end
10
+
11
+ config_param :dashing_url, :string
12
+ config_param :auth_token, :string
13
+ config_param :event_json_data_key, :string
14
+ config_param :name_key, :string
15
+
16
+ def configure(conf)
17
+ super
18
+
19
+ end
20
+
21
+ def start
22
+ super
23
+
24
+ end
25
+
26
+ def shutdown
27
+ super
28
+
29
+ end
30
+
31
+ def emit(tag, es, chain)
32
+ es.each {|time,record|
33
+ next unless value = record[@name_key]
34
+
35
+ body = {}
36
+ body[:auth_token] = @auth_token
37
+ body[@event_json_data_key] = value.to_s
38
+ HTTParty.post(@dashing_url, :body => body.to_json)
39
+ }
40
+
41
+ chain.next
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,65 @@
1
+ require 'spec_helper'
2
+
3
+ describe do
4
+ let(:driver) {Fluent::Test::OutputTestDriver.new(Fluent::DashingOutput, 'test.metrics').configure(config)}
5
+ let(:instance) {driver.instance}
6
+
7
+ describe 'config' do
8
+ let(:config) {
9
+ %[
10
+ dashing_url http://localhost:3030/widgets/widget_id
11
+ auth_token YOUR_AUTH_TOKEN
12
+ event_json_data_key current
13
+ name_key field1
14
+ ]
15
+ }
16
+
17
+ context do
18
+ subject {instance.dashing_url}
19
+ it{should == 'http://localhost:3030/widgets/widget_id'}
20
+ end
21
+
22
+ context do
23
+ subject {instance.auth_token}
24
+ it{should == 'YOUR_AUTH_TOKEN'}
25
+ end
26
+
27
+ context do
28
+ subject {instance.event_json_data_key}
29
+ it{should == 'current'}
30
+ end
31
+
32
+ context do
33
+ subject {instance.name_key}
34
+ it{should == 'field1'}
35
+ end
36
+
37
+ end
38
+
39
+ describe 'emit' do
40
+ let(:record) {{ 'field1' => 50, 'otherfield' => 99}}
41
+ let(:time) {0}
42
+ let(:posted) {
43
+ d = driver
44
+ mock(HTTParty).post('http://localhost:3030/widgets/widget_id',
45
+ :body => { auth_token: "YOUR_AUTH_TOKEN", current: '50' }.to_json)
46
+ d.emit(record, Time.at(time))
47
+ d.run
48
+ }
49
+
50
+ context do
51
+ let(:config) {
52
+ %[
53
+ dashing_url http://localhost:3030/widgets/widget_id
54
+ auth_token YOUR_AUTH_TOKEN
55
+ event_json_data_key current
56
+ name_key field1
57
+ ]
58
+ }
59
+
60
+ subject {posted}
61
+ it{should_not be_nil}
62
+ end
63
+
64
+ end
65
+ end
@@ -0,0 +1,25 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ RSpec.configure do |config|
8
+ config.treat_symbols_as_metadata_keys_with_true_values = true
9
+ config.run_all_when_everything_filtered = true
10
+ config.filter_run :focus
11
+
12
+ # Run specs in random order to surface order dependencies. If you find an
13
+ # order dependency and want to debug it, you can fix the order by providing
14
+ # the seed, which is printed after each run.
15
+ # --seed 1234
16
+ config.order = 'random'
17
+
18
+ require 'fluent/load'
19
+ require 'fluent/test'
20
+
21
+ require 'fluent/plugin/out_dashing'
22
+
23
+ require 'pry'
24
+ require 'rr'
25
+ end
metadata ADDED
@@ -0,0 +1,153 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fluent-plugin-dashing
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - bash0C7
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: fluentd
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: httparty
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rr
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Fluentd output plugin to post data to dashing
112
+ email:
113
+ - koshiba+github@4038nullpointer.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - .gitignore
119
+ - .rspec
120
+ - Gemfile
121
+ - README.md
122
+ - Rakefile
123
+ - fluent-plugin-dasing.gemspec
124
+ - lib/fluent/plugin/out_dashing.rb
125
+ - spec/lib/fluent/plugin/out_dashing_spec.rb
126
+ - spec/spec_helper.rb
127
+ homepage: https://github.com/bash0C7/fluent-plugin-dashing
128
+ licenses:
129
+ - Ruby's
130
+ metadata: {}
131
+ post_install_message:
132
+ rdoc_options: []
133
+ require_paths:
134
+ - lib
135
+ required_ruby_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - '>='
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ requirements: []
146
+ rubyforge_project:
147
+ rubygems_version: 2.0.5
148
+ signing_key:
149
+ specification_version: 4
150
+ summary: Fluentd output plugin to post data to dashing
151
+ test_files:
152
+ - spec/lib/fluent/plugin/out_dashing_spec.rb
153
+ - spec/spec_helper.rb