logstash-output-dogstatsd 1.3.0 → 2.0.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: b5ddb05f4531bbcabcd244a0dba19614a95a003a
4
- data.tar.gz: b8a1da9467d14137a19f35320b9c40f35fbc81d5
3
+ metadata.gz: fb60ee39b04f8b4cc73d0ae258eb98ec9a24c275
4
+ data.tar.gz: 89d5c802803972370fcf61125c0b8a5f85e6c677
5
5
  SHA512:
6
- metadata.gz: 7b63850c1cf2c3e37e80297d04ee405f05f96eed298676353158387ba477c6f709b6cfda1bdc5f75c33f976281de56c66c07443687c0eab7ad12124afee8b969
7
- data.tar.gz: e1e90e25ed3fb81c8864bd3f0dafafc24dcb7e7d0f3836e5fcef700c0386ff82cf7d19dce4bc301005aa87a4c09762b4f87f3264cf2ad9601c4529a07f2ce2ca
6
+ metadata.gz: e75c8013e39024ca5f802b2e223177ac766021c334d8b5fbc9e13f4cd2e9f9634cb8b5320ebb88d1411a9ccde7097a6898aa5b4491eb42c2ebda8c4e0d82cd15
7
+ data.tar.gz: 1b9fa80070b4f91ba19374e3a8e23e9451fe2a343fbcabee25febc22094735299bfa97604d0a3c7d01b6b24cda2f81a87b60f7d329fd3483fab08666c4c1ceba
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 2.0.0
2
+ - Updates from logstash-output-statsd v2.0.5.
3
+ - Upgraded logstash-core dependency to 2.0.
4
+ - Upgraded dogstatsd-ruby dependency to 1.6.
5
+
1
6
  # 0.9.0
2
7
  - First version of logstash-output-dogstatsd, forked from v1.1.0 of
3
8
  logstash-output-statsd.
data/README.md CHANGED
@@ -1,15 +1,15 @@
1
1
  # Logstash Plugin
2
2
 
3
- This is a plugin for [Logstash](https://github.com/elasticsearch/logstash).
3
+ This is a plugin for [Logstash](https://github.com/elastic/logstash).
4
4
 
5
5
  It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
6
6
 
7
7
  ## Documentation
8
8
 
9
- Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elasticsearch.org/guide/en/logstash/current/).
9
+ Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elastic.co/guide/en/logstash/current/).
10
10
 
11
11
  - For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
12
- - For more asciidoc formatting tips, see the excellent reference here https://github.com/elasticsearch/docs#asciidoc-guide
12
+ - For more asciidoc formatting tips, see the excellent reference here https://github.com/elastic/docs#asciidoc-guide
13
13
 
14
14
  ## Need Help?
15
15
 
@@ -83,4 +83,4 @@ Programming is not a required skill. Whatever you've seen about open source and
83
83
 
84
84
  It is more important to the community that you are able to contribute.
85
85
 
86
- For more information about contributing, see the [CONTRIBUTING](https://github.com/elasticsearch/logstash/blob/master/CONTRIBUTING.md) file.
86
+ For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
@@ -19,50 +19,57 @@ end
19
19
  #
20
20
  # You can learn about statsd here:
21
21
  #
22
- # * http://codeascraft.etsy.com/2011/02/15/measure-anything-measure-everything/[Etsy blog post announcing statsd]
22
+ # * https://codeascraft.com/2011/02/15/measure-anything-measure-everything/[Etsy blog post announcing statsd]
23
23
  # * https://github.com/etsy/statsd[statsd on github]
24
24
  #
25
- # A simple example usage of this is to count HTTP hits by response code; to learn
26
- # more about that, check out the ../tutorials/metrics-from-logs[log metrics tutorial]
25
+ # Typical examples of how this can be used with Logstash include counting HTTP hits
26
+ # by response code, summing the total number of bytes of traffic served, and tracking
27
+ # the 50th and 95th percentile of the processing time of requests.
27
28
  #
28
29
  # Example:
29
30
  # [source,ruby]
30
31
  # output {
31
- # dogstatsd {
32
- # metric_tags => ["host:%{host}","role:foo"]
33
- # count => {
34
- # "http.bytes" => "%{bytes}"
32
+ # dogstatsd {
33
+ # metric_tags => ["host:%{host}","role:foo"]
34
+ # count => {
35
+ # "http.bytes" => "%{bytes}"
36
+ # }
35
37
  # }
36
- # }
37
38
  # }
38
39
  class LogStash::Outputs::Dogstatsd < LogStash::Outputs::Base
39
40
  ## Regex stolen from statsd code
40
41
  RESERVED_CHARACTERS_REGEX = /[\:\|\@]/
41
42
  config_name "dogstatsd"
42
43
 
43
- # The address of the dogstatsd server.
44
+ # The hostname or IP address of the dogstatsd server.
44
45
  config :host, :validate => :string, :default => "localhost"
45
46
 
46
47
  # The port to connect to on your dogstatsd server.
47
48
  config :port, :validate => :number, :default => 8125
48
49
 
49
- # An increment metric. Metric names as array.
50
+ # An increment metric. Metric names as array. `%{fieldname}` substitutions are
51
+ # allowed in the metric names.
50
52
  config :increment, :validate => :array, :default => []
51
53
 
52
- # A decrement metric. Metric names as array.
54
+ # A decrement metric. Metric names as array. `%{fieldname}` substitutions are
55
+ # allowed in the metric names.
53
56
  config :decrement, :validate => :array, :default => []
54
57
 
55
58
  # A histogram metric, which a statsd timing but conceptually maps to any
56
- # numeric value, not just durations. `metric_name => value` as hash
59
+ # numeric value, not just durations. `metric_name => value` as hash. `%{fieldname}`
60
+ # substitutions are allowed in the metric names.
57
61
  config :histogram, :validate => :hash, :default => {}
58
62
 
59
- # A count metric. `metric_name => count` as hash
63
+ # A count metric. `metric_name => count` as hash. `%{fieldname}` substitutions are
64
+ # allowed in the metric names.
60
65
  config :count, :validate => :hash, :default => {}
61
66
 
62
- # A set metric. `metric_name => "string"` to append as hash
67
+ # A set metric. `metric_name => "string"` to append as hash. `%{fieldname}`
68
+ # substitutions are allowed in the metric names.
63
69
  config :set, :validate => :hash, :default => {}
64
70
 
65
- # A gauge metric. `metric_name => gauge` as hash.
71
+ # A gauge metric. `metric_name => gauge` as hash. `%{fieldname}` substitutions are
72
+ # allowed in the metric names.
66
73
  config :gauge, :validate => :hash, :default => {}
67
74
 
68
75
  # The sample rate for the metric.
@@ -78,7 +85,6 @@ class LogStash::Outputs::Dogstatsd < LogStash::Outputs::Base
78
85
 
79
86
  public
80
87
  def receive(event)
81
- return unless output?(event)
82
88
  @logger.debug? and @logger.debug("Event: #{event}")
83
89
 
84
90
  metric_opts = {
@@ -110,4 +116,9 @@ class LogStash::Outputs::Dogstatsd < LogStash::Outputs::Base
110
116
  @client.gauge(event.sprintf(metric), event.sprintf(val), metric_opts)
111
117
  end
112
118
  end # def receive
119
+
120
+ public
121
+ def close
122
+ @client.close
123
+ end # def close
113
124
  end # class LogStash::Outputs::Statsd
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-output-dogstatsd'
4
- s.version = '1.3.0'
4
+ s.version = '2.0.0'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Send metrics to StatsD"
7
7
  s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.require_paths = ["lib"]
12
12
 
13
13
  # Files
14
- s.files = `git ls-files`.split($\)+::Dir.glob('vendor/*')
14
+ s.files = Dir['lib/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
15
15
 
16
16
  # Tests
17
17
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
@@ -20,14 +20,13 @@ Gem::Specification.new do |s|
20
20
  s.metadata = { "logstash_plugin" => "true", "logstash_group" => "output" }
21
21
 
22
22
  # Gem dependencies
23
- s.add_runtime_dependency "logstash-core", '>= 1.4.0', '< 2.0.0'
23
+ s.add_runtime_dependency "logstash-core", ">= 2.0.0.beta2", "< 3.0.0"
24
24
  s.add_runtime_dependency 'logstash-input-generator'
25
25
 
26
26
  # This version is pinned exactly to ensure that upgrades don't break the
27
27
  # gnarly `module_eval` hack in lib/logstash/outputs/dogstatsd.rb.
28
- s.add_runtime_dependency 'dogstatsd-ruby', '= 1.5'
28
+ s.add_runtime_dependency 'dogstatsd-ruby', '= 1.6'
29
29
 
30
30
  s.add_development_dependency 'logstash-devutils'
31
31
  s.add_development_dependency 'overcommit'
32
32
  end
33
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-dogstatsd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Dooner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-28 00:00:00.000000000 Z
11
+ date: 2016-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-core
@@ -16,18 +16,18 @@ dependencies:
16
16
  requirements:
17
17
  - - '>='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.4.0
19
+ version: 2.0.0.beta2
20
20
  - - <
21
21
  - !ruby/object:Gem::Version
22
- version: 2.0.0
22
+ version: 3.0.0
23
23
  requirement: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - '>='
26
26
  - !ruby/object:Gem::Version
27
- version: 1.4.0
27
+ version: 2.0.0.beta2
28
28
  - - <
29
29
  - !ruby/object:Gem::Version
30
- version: 2.0.0
30
+ version: 3.0.0
31
31
  prerelease: false
32
32
  type: :runtime
33
33
  - !ruby/object:Gem::Dependency
@@ -50,12 +50,12 @@ dependencies:
50
50
  requirements:
51
51
  - - '='
52
52
  - !ruby/object:Gem::Version
53
- version: '1.5'
53
+ version: '1.6'
54
54
  requirement: !ruby/object:Gem::Requirement
55
55
  requirements:
56
56
  - - '='
57
57
  - !ruby/object:Gem::Version
58
- version: '1.5'
58
+ version: '1.6'
59
59
  prerelease: false
60
60
  type: :runtime
61
61
  - !ruby/object:Gem::Dependency
@@ -92,20 +92,14 @@ executables: []
92
92
  extensions: []
93
93
  extra_rdoc_files: []
94
94
  files:
95
- - .gitignore
96
- - .overcommit.yml
97
- - .ruby-version
98
95
  - CHANGELOG.md
99
96
  - CONTRIBUTORS
100
97
  - Gemfile
101
98
  - LICENSE
102
99
  - NOTICE.TXT
103
100
  - README.md
104
- - Rakefile
105
101
  - lib/logstash/outputs/dogstatsd.rb
106
102
  - logstash-output-dogstatsd.gemspec
107
- - spec/outputs/dogstatsd_spec.rb
108
- - spec/spec_helper.rb
109
103
  homepage: http://www.elastic.co/guide/en/logstash/current/index.html
110
104
  licenses:
111
105
  - Apache License (2.0)
@@ -132,6 +126,4 @@ rubygems_version: 2.4.6
132
126
  signing_key:
133
127
  specification_version: 4
134
128
  summary: Send metrics to StatsD
135
- test_files:
136
- - spec/outputs/dogstatsd_spec.rb
137
- - spec/spec_helper.rb
129
+ test_files: []
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- *.gem
2
- Gemfile.lock
3
- .bundle
4
- vendor
data/.overcommit.yml DELETED
@@ -1,13 +0,0 @@
1
- PreCommit:
2
- HardTabs:
3
- enabled: true
4
-
5
- RuboCop:
6
- enabled: true
7
- command: ['bundle', 'exec', 'rubocop']
8
-
9
- TrailingWhitespace:
10
- enabled: true
11
-
12
- # Overcommit will use the repo's Gemfile when loading the Bundler context
13
- gemfile: Gemfile
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- jruby-1.7.20
data/Rakefile DELETED
@@ -1,7 +0,0 @@
1
- @files=[]
2
-
3
- task :default do
4
- system("rake -T")
5
- end
6
-
7
- require "logstash/devutils/rake"
@@ -1,67 +0,0 @@
1
- # encoding: utf-8
2
- require 'logstash/outputs/dogstatsd'
3
- require_relative '../spec_helper'
4
-
5
- describe LogStash::Outputs::Dogstatsd do
6
- let(:output) { described_class.new(config) }
7
-
8
- let(:config) do
9
- {
10
- 'host' => '127.0.0.1',
11
- 'port' => 8125
12
- }.merge(metric_config)
13
- end
14
- let(:metric_config) { {} }
15
-
16
- describe 'registration and teardown' do
17
- it 'registers without errors' do
18
- output = LogStash::Plugin.lookup('output', 'dogstatsd').new
19
- expect { output.register }.to_not raise_error
20
- end
21
- end
22
-
23
- describe '#send' do
24
- before { output.register }
25
- subject { output.receive(LogStash::Event.new(event)) }
26
-
27
- let(:event) { { 'something_count' => 10 } }
28
-
29
- context 'increment metrics' do
30
- let(:metric_config) { { 'increment' => [metric_to_track] } }
31
- let(:metric_to_track) { 'metric.name.here' }
32
-
33
- context 'with a plain ol metric name' do
34
- it 'tracks' do
35
- expect_any_instance_of(Datadog::Statsd).to receive(:send_to_socket)
36
- .with("#{metric_to_track}:1|c")
37
- subject
38
- end
39
- end
40
-
41
- context 'with tags' do
42
- let(:metric_config) { super().merge('metric_tags' => ['foo:%{value}']) }
43
- let(:event) { { 'value' => 'helloworld' } }
44
-
45
- it 'sprintf tags' do
46
- expect_any_instance_of(Datadog::Statsd).to receive(:send_to_socket)
47
- .with("#{metric_to_track}:1|c|#foo:helloworld")
48
- subject
49
- end
50
- end
51
- end
52
-
53
- context 'histogram metrics' do
54
- let(:metric_to_track) { 'metric.name.here' }
55
- let(:metric_config) { { 'histogram' => { '%{metric_name}' => '%{track_value}' } } }
56
- let(:event) { super().merge('metric_name' => metric_to_track, 'track_value' => 123) }
57
-
58
- context 'with event fields in the metric name and value' do
59
- it 'tracks' do
60
- expect_any_instance_of(Datadog::Statsd).to receive(:send_to_socket)
61
- .with("#{metric_to_track}:123|h")
62
- subject
63
- end
64
- end
65
- end
66
- end
67
- end
data/spec/spec_helper.rb DELETED
@@ -1,8 +0,0 @@
1
- require 'logstash/devutils/rspec/spec_helper'
2
- require 'logstash/outputs/dogstatsd'
3
-
4
- RSpec.configure do |c|
5
- c.before do
6
- allow_any_instance_of(Datadog::Statsd).to receive(:send_to_socket)
7
- end
8
- end