logstash-output-graphtastic 0.1.4 → 0.1.5

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: afc614c1959cf02d1baa3eb48821ac9f000ebb16
4
- data.tar.gz: 43afb7835bb9347b0fa36d577e4aded78a373f48
3
+ metadata.gz: f94772319557d56e697387c4f31a763a83d5fb0c
4
+ data.tar.gz: b917178284eaf1237fb9236c91335e11b1487969
5
5
  SHA512:
6
- metadata.gz: 7c48169e4b72f033b8f22d6726e4a011118ccf633889f3aad5dfac284ae20a6757585a7db99e730e18b82c5b38a8acef96f65f8d4bc973c4736e4e0f530efc6f
7
- data.tar.gz: 7ed7c116e542c875af0c44e72605b144411d93c125e9f1f00530edb3bc2334a9ccf727106f3521c98bdf01ff8e3877a31871795746b29231c72e15a65e086ce2
6
+ metadata.gz: 8fc2d694b8e0d162bde98d617335e09cab91c3e8129cad182087f81d645e79bbff9ca331384f78fdb78edc439e0309207d669c8155f9b0571c77c648c613a35b
7
+ data.tar.gz: db8800377eec4f6534ddeb82b1b97c0ae469d407cbc5fce363fcc22a34ebaf2df973807dc440bbdf026fd407c8ea9b9eb09f93b531d17738b1068125514fe086
File without changes
@@ -0,0 +1,5 @@
1
+ Elasticsearch
2
+ Copyright 2012-2015 Elasticsearch
3
+
4
+ This product includes software developed by The Apache Software
5
+ Foundation (http://www.apache.org/).
data/README.md CHANGED
@@ -13,7 +13,7 @@ Logstash provides infrastructure to automatically generate documentation for thi
13
13
 
14
14
  ## Need Help?
15
15
 
16
- Need help? Try #logstash on freenode IRC or the logstash-users@googlegroups.com mailing list.
16
+ Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
17
17
 
18
18
  ## Developing
19
19
 
@@ -8,32 +8,32 @@ require "logstash/namespace"
8
8
  # a respectable alternative that would also run on any Windows
9
9
  # machine - which is the problem and why I am not going with Graphite
10
10
  # and statsd. This application provides multiple integration options
11
- # so as to make its use under your network requirements possible.
11
+ # so as to make its use under your network requirements possible.
12
12
  # This includes a REST option that is always enabled for your use
13
- # in case you want to write a small script to send the occasional
14
- # metric data.
13
+ # in case you want to write a small script to send the occasional
14
+ # metric data.
15
15
  #
16
16
  # Find GraphTastic here : https://github.com/NickPadilla/GraphTastic
17
17
  class LogStash::Outputs::GraphTastic < LogStash::Outputs::Base
18
-
18
+
19
19
  config_name "graphtastic"
20
20
 
21
21
  # options are udp(fastest - default) - rmi(faster) - rest(fast) - tcp(don't use TCP yet - some problems - errors out on linux)
22
22
  config :integration, :validate => ["udp","tcp","rmi","rest"], :default => "udp"
23
-
23
+
24
24
  # if using rest as your end point you need to also provide the application url
25
25
  # it defaults to localhost/graphtastic. You can customize the application url
26
- # by changing the name of the .war file. There are other ways to change the
26
+ # by changing the name of the .war file. There are other ways to change the
27
27
  # application context, but they vary depending on the Application Server in use.
28
28
  # Please consult your application server documentation for more on application
29
29
  # contexts.
30
30
  config :context, :validate => :string, :default => "graphtastic"
31
-
32
- # metrics hash - you will provide a name for your metric and the metric
31
+
32
+ # metrics hash - you will provide a name for your metric and the metric
33
33
  # data as key value pairs. so for example:
34
34
  #
35
35
  # [source,ruby]
36
- # metrics => { "Response" => "%{response}" }
36
+ # metrics => { "Response" => "%{response}" }
37
37
  #
38
38
  # example for the logstash config
39
39
  #
@@ -42,30 +42,31 @@ class LogStash::Outputs::GraphTastic < LogStash::Outputs::Base
42
42
  #
43
43
  # NOTE: you can also use the dynamic fields for the key value as well as the actual value
44
44
  config :metrics, :validate => :hash, :default => {}
45
-
45
+
46
46
  # host for the graphtastic server - defaults to 127.0.0.1
47
47
  config :host, :validate => :string, :default => "127.0.0.1"
48
-
48
+
49
49
  # port for the graphtastic instance - defaults to 1199 for RMI, 1299 for TCP, 1399 for UDP, and 8080 for REST
50
50
  config :port, :validate => :number
51
-
51
+
52
52
  # number of attempted retry after send error - currently only way to integrate
53
53
  # errored transactions - should try and save to a file or later consumption
54
54
  # either by graphtastic utility or by this program after connectivity is
55
- # ensured to be established.
55
+ # ensured to be established.
56
56
  config :retries, :validate => :number, :default => 1
57
-
58
- # the number of metrics to send to GraphTastic at one time. 60 seems to be the perfect
59
- # amount for UDP, with default packet size.
57
+
58
+ # the number of metrics to send to GraphTastic at one time. 60 seems to be the perfect
59
+ # amount for UDP, with default packet size.
60
60
  config :batch_number, :validate => :number, :default => 60
61
-
61
+
62
62
  # setting allows you to specify where we save errored transactions
63
63
  # this makes the most sense at this point - will need to decide
64
64
  # on how we reintegrate these error metrics
65
65
  # NOT IMPLEMENTED!
66
66
  config :error_file, :validate => :string, :default => ""
67
-
67
+
68
68
  public
69
+
69
70
  def register
70
71
  @batch = []
71
72
  begin
@@ -80,7 +81,7 @@ class LogStash::Outputs::GraphTastic < LogStash::Outputs::Base
80
81
  registry = java.rmi.registry.LocateRegistry.getRegistry(@host, @port);
81
82
  @remote = registry.lookup("RmiMetricService")
82
83
  elsif @integration.downcase == "rest"
83
- require "net/http"
84
+ require "net/http"
84
85
  if @port.nil?
85
86
  @port = 8080
86
87
  gem "mail" #outputs/email, # License: MIT License
@@ -88,12 +89,11 @@ class LogStash::Outputs::GraphTastic < LogStash::Outputs::Base
88
89
  @http = Net::HTTP.new(@host, @port)
89
90
  end
90
91
  @logger.info("GraphTastic Output Successfully Registered! Using #{@integration} Integration!")
91
- rescue
92
+ rescue
92
93
  @logger.error("*******ERROR : #{$!}")
93
94
  end
94
95
  end
95
96
 
96
- public
97
97
  def receive(event)
98
98
  return unless output?(event)
99
99
  # Set Intersection - returns a new array with the items that are the same between the two
@@ -105,25 +105,25 @@ class LogStash::Outputs::GraphTastic < LogStash::Outputs::Base
105
105
  @retry = 1
106
106
  @logger.debug("Event found for GraphTastic!", :tags => @tags, :event => event)
107
107
  @metrics.each do |name, metric|
108
- postMetric(event.sprintf(name),event.sprintf(metric),(event["@timestamp"]*1000))# unix_timestamp is what I need in seconds - multiply by 1000 to make milliseconds.
108
+ postMetric(event.sprintf(name), event.sprintf(metric), (event.timestamp.to_i * 1000)) #unix_timestamp is what I need in seconds - multiply by 1000 to make milliseconds.
109
109
  end
110
110
  end
111
-
111
+
112
112
  def postMetric(name, metric, timestamp)
113
- message = name+","+metric+","+timestamp.to_s
113
+ message = name + "," + metric + "," + timestamp.to_s
114
114
  if @batch.length < @batch_number
115
115
  @batch.push(message)
116
116
  else
117
- flushMetrics()
118
- end
117
+ flushMetrics()
118
+ end
119
119
  end
120
-
120
+
121
121
  def flushMetrics()
122
122
  begin
123
123
  if @integration.downcase == "tcp"
124
124
  flushViaTCP()
125
125
  elsif @integration.downcase == "rmi"
126
- flushViaRMI()
126
+ flushViaRMI()
127
127
  elsif @integration.downcase == "udp"
128
128
  flushViaUDP()
129
129
  elsif @integration.downcase == "rest"
@@ -141,7 +141,7 @@ class LogStash::Outputs::GraphTastic < LogStash::Outputs::Base
141
141
  end
142
142
  end
143
143
  end
144
-
144
+
145
145
  # send metrics via udp
146
146
  def flushViaUDP()
147
147
  if @port.nil?
@@ -150,7 +150,7 @@ class LogStash::Outputs::GraphTastic < LogStash::Outputs::Base
150
150
  udpsocket.send(@batch.join(','), 0, @host, @port)
151
151
  @logger.debug("GraphTastic Sent Message Using UDP : #{@batch.join(',')}")
152
152
  end
153
-
153
+
154
154
  # send metrics via REST
155
155
  def flushViaREST()
156
156
  request = Net::HTTP::Put.new("/#{@context}/addMetric/#{@batch.join(',')}")
@@ -158,9 +158,9 @@ class LogStash::Outputs::GraphTastic < LogStash::Outputs::Base
158
158
  if response == 'ERROR'
159
159
  raise 'Error happend when sending metric to GraphTastic using REST!'
160
160
  end
161
- @logger.debug("GraphTastic Sent Message Using REST : #{@batch.join(',')}", :response => response.inspect)
161
+ @logger.debug("GraphTastic Sent Message Using REST : #{@batch.join(',')}", :response => response.inspect)
162
162
  end
163
-
163
+
164
164
  # send metrics via RMI
165
165
  def flushViaRMI()
166
166
  if RUBY_ENGINE != "jruby"
@@ -169,7 +169,7 @@ class LogStash::Outputs::GraphTastic < LogStash::Outputs::Base
169
169
  @remote.insertMetrics(@batch.join(','))
170
170
  @logger.debug("GraphTastic Sent Message Using RMI : #{@batch.join(',')}")
171
171
  end
172
-
172
+
173
173
  # send metrics via tcp
174
174
  def flushViaTCP()
175
175
  # to correctly read the line we need to ensure we send \r\n at the end of every message.
@@ -183,5 +183,5 @@ class LogStash::Outputs::GraphTastic < LogStash::Outputs::Base
183
183
  end
184
184
 
185
185
  def udpsocket; @socket ||= UDPSocket.new end
186
-
186
+
187
187
  end
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-output-graphtastic'
4
- s.version = '0.1.4'
4
+ s.version = '0.1.5'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Send metrics to GraphTastic"
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"
metadata CHANGED
@@ -1,17 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-graphtastic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-20 00:00:00.000000000 Z
11
+ date: 2015-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- requirement: !ruby/object:Gem::Requirement
14
+ name: logstash-core
15
+ version_requirements: !ruby/object:Gem::Requirement
15
16
  requirements:
16
17
  - - '>='
17
18
  - !ruby/object:Gem::Version
@@ -19,10 +20,7 @@ dependencies:
19
20
  - - <
20
21
  - !ruby/object:Gem::Version
21
22
  version: 2.0.0
22
- name: logstash-core
23
- prerelease: false
24
- type: :runtime
25
- version_requirements: !ruby/object:Gem::Requirement
23
+ requirement: !ruby/object:Gem::Requirement
26
24
  requirements:
27
25
  - - '>='
28
26
  - !ruby/object:Gem::Version
@@ -30,20 +28,22 @@ dependencies:
30
28
  - - <
31
29
  - !ruby/object:Gem::Version
32
30
  version: 2.0.0
31
+ prerelease: false
32
+ type: :runtime
33
33
  - !ruby/object:Gem::Dependency
34
- requirement: !ruby/object:Gem::Requirement
34
+ name: logstash-devutils
35
+ version_requirements: !ruby/object:Gem::Requirement
35
36
  requirements:
36
37
  - - '>='
37
38
  - !ruby/object:Gem::Version
38
39
  version: '0'
39
- name: logstash-devutils
40
- prerelease: false
41
- type: :development
42
- version_requirements: !ruby/object:Gem::Requirement
40
+ requirement: !ruby/object:Gem::Requirement
43
41
  requirements:
44
42
  - - '>='
45
43
  - !ruby/object:Gem::Version
46
44
  version: '0'
45
+ prerelease: false
46
+ type: :development
47
47
  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
48
48
  email: info@elastic.co
49
49
  executables: []
@@ -51,9 +51,11 @@ extensions: []
51
51
  extra_rdoc_files: []
52
52
  files:
53
53
  - .gitignore
54
+ - CHANGELOG.md
54
55
  - CONTRIBUTORS
55
56
  - Gemfile
56
57
  - LICENSE
58
+ - NOTICE.TXT
57
59
  - README.md
58
60
  - Rakefile
59
61
  - lib/logstash/outputs/graphtastic.rb