logstash-output-statsd 3.1.1 → 3.1.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9da4d83403181dcddc46697b046a29321ff02474
4
- data.tar.gz: 66dbca4688675a6180443f409fa54a9f8fbff105
3
+ metadata.gz: af0d69bd56f803ab82b441ae66150c60f78cdb05
4
+ data.tar.gz: 04e0eac19b5b6b427f8361916e8f5a94b3b7244a
5
5
  SHA512:
6
- metadata.gz: 2863dd3fea7baa518f443b2df42dd83a879df343fdcca92ce410b0d4cf9c76a0e277a3159fee005fc1ec179da778b6fe5c2700bac8e20a9b60a15b59b5046fd2
7
- data.tar.gz: 31b1a728959fdd715d8488ddd6cfd6a8eec7826c1069bffbaa26b133883acd6c56b5c7d27ba2b90f07884826643704f3d5792ad6ce4a1a205d3260da158101b7
6
+ metadata.gz: 26d6fa69f8e8c5b8ba78b185823d1846789687aa8eff9cc66657fd8b9ab5268933a9756a705aba2d718bfb5eba8f7a969d0b05e9b7d2826e94f70ab938c39557
7
+ data.tar.gz: e065a04790b47c23f0007cfa850bd9b05bfc163391fe26c4698700412f9b007b8c9d525cfc484546341b10f257540fc6beaa2c00db3b09b9cca2b50160f9a932
data/Gemfile CHANGED
@@ -1,4 +1,11 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in logstash-mass_effect.gemspec
4
3
  gemspec
4
+
5
+ logstash_path = ENV["LOGSTASH_PATH"] || "../../logstash"
6
+ use_logstash_source = ENV["LOGSTASH_SOURCE"] && ENV["LOGSTASH_SOURCE"].to_s == "1"
7
+
8
+ if Dir.exist?(logstash_path) && use_logstash_source
9
+ gem 'logstash-core', :path => "#{logstash_path}/logstash-core"
10
+ gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api"
11
+ end
@@ -0,0 +1,193 @@
1
+ :plugin: statsd
2
+ :type: output
3
+
4
+ ///////////////////////////////////////////
5
+ START - GENERATED VARIABLES, DO NOT EDIT!
6
+ ///////////////////////////////////////////
7
+ :version: %VERSION%
8
+ :release_date: %RELEASE_DATE%
9
+ :changelog_url: %CHANGELOG_URL%
10
+ :include_path: ../../../../logstash/docs/include
11
+ ///////////////////////////////////////////
12
+ END - GENERATED VARIABLES, DO NOT EDIT!
13
+ ///////////////////////////////////////////
14
+
15
+ [id="plugins-{type}-{plugin}"]
16
+
17
+ === Statsd output plugin
18
+
19
+ include::{include_path}/plugin_header.asciidoc[]
20
+
21
+ ==== Description
22
+
23
+ statsd is a network daemon for aggregating statistics, such as counters and timers,
24
+ and shipping over UDP to backend services, such as Graphite or Datadog. The general
25
+ idea is that you send metrics to statsd and every few seconds it will emit the
26
+ aggregated values to the backend. Example aggregates are sums, average and maximum
27
+ values, their standard deviation, etc. This plugin makes it easy to send such
28
+ metrics based on data in Logstash events.
29
+
30
+ You can learn about statsd here:
31
+
32
+ * https://codeascraft.com/2011/02/15/measure-anything-measure-everything/[Etsy blog post announcing statsd]
33
+ * https://github.com/etsy/statsd[statsd on github]
34
+
35
+ Typical examples of how this can be used with Logstash include counting HTTP hits
36
+ by response code, summing the total number of bytes of traffic served, and tracking
37
+ the 50th and 95th percentile of the processing time of requests.
38
+
39
+ Each metric emitted to statsd has a dot-separated path, a type, and a value. The
40
+ metric path is built from the `namespace` and `sender` options together with the
41
+ metric name that's picked up depending on the type of metric. All in all, the
42
+ metric path will follow this pattern:
43
+
44
+ namespace.sender.metric
45
+
46
+ With regards to this plugin, the default namespace is "logstash", the default
47
+ sender is the `host` field, and the metric name depends on what is set as the
48
+ metric name in the `increment`, `decrement`, `timing`, `count`, `set` or `gauge`
49
+ options. In metric paths, colons (":"), pipes ("|") and at signs ("@") are reserved
50
+ and will be replaced by underscores ("_").
51
+
52
+ Example:
53
+ [source,ruby]
54
+ output {
55
+ statsd {
56
+ host => "statsd.example.org"
57
+ count => {
58
+ "http.bytes" => "%{bytes}"
59
+ }
60
+ }
61
+ }
62
+
63
+ If run on a host named hal9000 the configuration above will send the following
64
+ metric to statsd if the current event has 123 in its `bytes` field:
65
+
66
+ logstash.hal9000.http.bytes:123|c
67
+
68
+ [id="plugins-{type}s-{plugin}-options"]
69
+ ==== Statsd Output Configuration Options
70
+
71
+ This plugin supports the following configuration options plus the <<plugins-{type}s-{plugin}-common-options>> described later.
72
+
73
+ [cols="<,<,<",options="header",]
74
+ |=======================================================================
75
+ |Setting |Input type|Required
76
+ | <<plugins-{type}s-{plugin}-count>> |<<hash,hash>>|No
77
+ | <<plugins-{type}s-{plugin}-decrement>> |<<array,array>>|No
78
+ | <<plugins-{type}s-{plugin}-gauge>> |<<hash,hash>>|No
79
+ | <<plugins-{type}s-{plugin}-host>> |<<string,string>>|No
80
+ | <<plugins-{type}s-{plugin}-increment>> |<<array,array>>|No
81
+ | <<plugins-{type}s-{plugin}-namespace>> |<<string,string>>|No
82
+ | <<plugins-{type}s-{plugin}-port>> |<<number,number>>|No
83
+ | <<plugins-{type}s-{plugin}-sample_rate>> |<<number,number>>|No
84
+ | <<plugins-{type}s-{plugin}-sender>> |<<string,string>>|No
85
+ | <<plugins-{type}s-{plugin}-set>> |<<hash,hash>>|No
86
+ | <<plugins-{type}s-{plugin}-timing>> |<<hash,hash>>|No
87
+ |=======================================================================
88
+
89
+ Also see <<plugins-{type}s-{plugin}-common-options>> for a list of options supported by all
90
+ output plugins.
91
+
92
+ &nbsp;
93
+
94
+ [id="plugins-{type}s-{plugin}-count"]
95
+ ===== `count`
96
+
97
+ * Value type is <<hash,hash>>
98
+ * Default value is `{}`
99
+
100
+ A count metric. `metric_name => count` as hash. `%{fieldname}` substitutions are
101
+ allowed in the metric names.
102
+
103
+ [id="plugins-{type}s-{plugin}-decrement"]
104
+ ===== `decrement`
105
+
106
+ * Value type is <<array,array>>
107
+ * Default value is `[]`
108
+
109
+ A decrement metric. Metric names as array. `%{fieldname}` substitutions are
110
+ allowed in the metric names.
111
+
112
+ [id="plugins-{type}s-{plugin}-gauge"]
113
+ ===== `gauge`
114
+
115
+ * Value type is <<hash,hash>>
116
+ * Default value is `{}`
117
+
118
+ A gauge metric. `metric_name => gauge` as hash. `%{fieldname}` substitutions are
119
+ allowed in the metric names.
120
+
121
+ [id="plugins-{type}s-{plugin}-host"]
122
+ ===== `host`
123
+
124
+ * Value type is <<string,string>>
125
+ * Default value is `"localhost"`
126
+
127
+ The hostname or IP address of the statsd server.
128
+
129
+ [id="plugins-{type}s-{plugin}-increment"]
130
+ ===== `increment`
131
+
132
+ * Value type is <<array,array>>
133
+ * Default value is `[]`
134
+
135
+ An increment metric. Metric names as array. `%{fieldname}` substitutions are
136
+ allowed in the metric names.
137
+
138
+ [id="plugins-{type}s-{plugin}-namespace"]
139
+ ===== `namespace`
140
+
141
+ * Value type is <<string,string>>
142
+ * Default value is `"logstash"`
143
+
144
+ The statsd namespace to use for this metric. `%{fieldname}` substitutions are
145
+ allowed.
146
+
147
+ [id="plugins-{type}s-{plugin}-port"]
148
+ ===== `port`
149
+
150
+ * Value type is <<number,number>>
151
+ * Default value is `8125`
152
+
153
+ The port to connect to on your statsd server.
154
+
155
+ [id="plugins-{type}s-{plugin}-sample_rate"]
156
+ ===== `sample_rate`
157
+
158
+ * Value type is <<number,number>>
159
+ * Default value is `1`
160
+
161
+ The sample rate for the metric.
162
+
163
+ [id="plugins-{type}s-{plugin}-sender"]
164
+ ===== `sender`
165
+
166
+ * Value type is <<string,string>>
167
+ * Default value is `"%{host}"`
168
+
169
+ The name of the sender. Dots will be replaced with underscores. `%{fieldname}`
170
+ substitutions are allowed.
171
+
172
+ [id="plugins-{type}s-{plugin}-set"]
173
+ ===== `set`
174
+
175
+ * Value type is <<hash,hash>>
176
+ * Default value is `{}`
177
+
178
+ A set metric. `metric_name => "string"` to append as hash. `%{fieldname}`
179
+ substitutions are allowed in the metric names.
180
+
181
+ [id="plugins-{type}s-{plugin}-timing"]
182
+ ===== `timing`
183
+
184
+ * Value type is <<hash,hash>>
185
+ * Default value is `{}`
186
+
187
+ A timing metric. `metric_name => duration` as hash. `%{fieldname}` substitutions
188
+ are allowed in the metric names.
189
+
190
+
191
+
192
+ [id="plugins-{type}s-{plugin}-common-options"]
193
+ include::{include_path}/{type}.asciidoc[]
@@ -131,8 +131,11 @@ class LogStash::Outputs::Statsd < LogStash::Outputs::Base
131
131
  end # def receive
132
132
 
133
133
  def build_stat(metric, sender=@sender)
134
- sender = sender.gsub('::','.').gsub(RESERVED_CHARACTERS_REGEX, '_').gsub(".", "_")
135
- metric = metric.gsub('::','.').gsub(RESERVED_CHARACTERS_REGEX, '_')
134
+ sender = sender.to_s.gsub('::','.')
135
+ sender.gsub!(RESERVED_CHARACTERS_REGEX, '_')
136
+ sender.gsub!(".", "_")
137
+ metric = metric.to_s.gsub('::','.')
138
+ metric.gsub!(RESERVED_CHARACTERS_REGEX, '_')
136
139
  @logger.debug? and @logger.debug("Formatted value", :sender => sender, :metric => metric)
137
140
  return "#{sender}.#{metric}"
138
141
  end
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-output-statsd'
4
- s.version = '3.1.1'
4
+ s.version = '3.1.2'
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/logstash-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 = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
14
+ s.files = Dir["lib/**/*","spec/**/*","*.gemspec","*.md","CONTRIBUTORS","Gemfile","LICENSE","NOTICE.TXT", "vendor/jar-dependencies/**/*.jar", "vendor/jar-dependencies/**/*.rb", "VERSION", "docs/**/*"]
15
15
 
16
16
  # Tests
17
17
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
- require "logstash/outputs/statsd"
3
2
  require_relative "../spec_helper"
3
+ require "logstash/outputs/statsd"
4
4
 
5
5
  describe LogStash::Outputs::Statsd do
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-statsd
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-14 00:00:00.000000000 Z
11
+ date: 2017-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -84,6 +84,7 @@ files:
84
84
  - LICENSE
85
85
  - NOTICE.TXT
86
86
  - README.md
87
+ - docs/index.asciidoc
87
88
  - lib/logstash/outputs/statsd.rb
88
89
  - logstash-output-statsd.gemspec
89
90
  - spec/outputs/statsd_spec.rb
@@ -110,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
111
  version: '0'
111
112
  requirements: []
112
113
  rubyforge_project:
113
- rubygems_version: 2.6.3
114
+ rubygems_version: 2.4.8
114
115
  signing_key:
115
116
  specification_version: 4
116
117
  summary: Send metrics to StatsD