logstash-output-newrelic 1.1.3 → 1.1.4
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f099ad9c408ec722141c72268c3bdc038adbe98c0760da028f5149f87077a0eb
|
4
|
+
data.tar.gz: 45817bcb9ada5fa8ca81a57f102878fc752111f7a0b7e3d3a7fc9c681a6df480
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de3784b9f1ca8300c99a7adea011e95b5ac5140ffd01d7a18dfc6cf5c5c5bbd2767cc4ac519e763bea7e0e7d12a509b9dcde98cc890b52d41ae901d750086511
|
7
|
+
data.tar.gz: acfc744ccc74de945848c3b76ade20b6e858fce52d1951e1533b302a2c55b4ae2f6156f507a8b0f949967981a5a304f293973f632f8c3863ab04fc1f1463a82b
|
data/DEVELOPER.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# Developing the plugin
|
2
|
+
|
3
|
+
# Getting started
|
4
|
+
|
5
|
+
* Install JRuby: `rbenv install jruby-9.2.5.0`
|
6
|
+
* Use that JRuby: `rbenv local jruby-9.2.5.0`
|
7
|
+
* Install Bundler gem: `jruby -S gem install bundler`
|
8
|
+
|
9
|
+
# Developing
|
10
|
+
|
11
|
+
* Install dependencies: `jruby -S bundle install`
|
12
|
+
* Write tests and production code!
|
13
|
+
* Bump version: edit version file `version.rb`
|
14
|
+
* Run tests: `jruby -S bundle exec rspec`
|
15
|
+
* Build the gem: `jruby -S gem build logstash-output-newrelic.gemspec`
|
16
|
+
|
17
|
+
# Testing it with a local Logstash install
|
18
|
+
|
19
|
+
Note: you may need to run the following commands outside of your checkout, since these should not
|
20
|
+
be run with the JRuby version that you've configured your checkout to use (by using rbenv).
|
21
|
+
|
22
|
+
* Remove previous version: `logstash-plugin remove logstash-output-newrelic`
|
23
|
+
* Add new version: `logstash-plugin install logstash-output-newrelic-<version>.gem`
|
24
|
+
* Restart logstash: For Homebrew: `brew services restart logstash`
|
25
|
+
* Cause a change that you've configured Logstash to pick up (for instance, append to a file you're having it monitor)
|
26
|
+
* Look in `https://one.newrelic.com/launcher/logger.log-launcher` for your log message
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'bigdecimal'
|
2
|
+
|
3
|
+
class BigDecimal
|
4
|
+
# Floating-point numbers that go through the 'json' Logstash filter get automatically converted into BigDecimals.
|
5
|
+
# Example of such a filter:
|
6
|
+
#
|
7
|
+
# filter {
|
8
|
+
# json {
|
9
|
+
# source => "message"
|
10
|
+
# }
|
11
|
+
# }
|
12
|
+
#
|
13
|
+
# The problem is that { "value" => BigDecimal('0.12345') } gets serialized into { "value": "0.12345e0"}. We do
|
14
|
+
# want to keep floating point numbers serialized as floating point numbers, even at the expense of loosing a little
|
15
|
+
# bit of precision during the conversion. So, in the above example, the correct serialization would be:
|
16
|
+
# { "value": 0.12345}
|
17
|
+
def to_json(options = nil) #:nodoc:
|
18
|
+
if finite?
|
19
|
+
self.to_f.to_s
|
20
|
+
else
|
21
|
+
'null'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -21,7 +21,6 @@ describe LogStash::Outputs::NewRelic do
|
|
21
21
|
}
|
22
22
|
}
|
23
23
|
|
24
|
-
|
25
24
|
before(:each) do
|
26
25
|
@newrelic_output = LogStash::Plugin.lookup("output", "newrelic").new(simple_config)
|
27
26
|
@newrelic_output.register
|
@@ -32,6 +31,7 @@ describe LogStash::Outputs::NewRelic do
|
|
32
31
|
@newrelic_output.shutdown
|
33
32
|
end
|
34
33
|
end
|
34
|
+
|
35
35
|
context "license key tests" do
|
36
36
|
it "sets license key when given in the header" do
|
37
37
|
stub_request(:any, base_uri).to_return(status: 200)
|
@@ -280,4 +280,48 @@ describe LogStash::Outputs::NewRelic do
|
|
280
280
|
.to have_been_made
|
281
281
|
end
|
282
282
|
end
|
283
|
+
|
284
|
+
context "JSON serialization" do
|
285
|
+
it "serializes floating point numbers as floating point numbers" do
|
286
|
+
stub_request(:any, base_uri).to_return(status: 200)
|
287
|
+
|
288
|
+
event = LogStash::Event.new({ "floatingpoint" => 0.12345 })
|
289
|
+
@newrelic_output.multi_receive([event])
|
290
|
+
|
291
|
+
wait_for(a_request(:post, base_uri)
|
292
|
+
.with { |request|
|
293
|
+
message = single_gzipped_message(request.body)
|
294
|
+
message['attributes']['floatingpoint'] == 0.12345
|
295
|
+
}
|
296
|
+
).to have_been_made
|
297
|
+
end
|
298
|
+
|
299
|
+
it "serializes BigDecimals as floating point numbers" do
|
300
|
+
stub_request(:any, base_uri).to_return(status: 200)
|
301
|
+
|
302
|
+
event = LogStash::Event.new({ "bigdecimal" => BigDecimal('0.12345') })
|
303
|
+
@newrelic_output.multi_receive([event])
|
304
|
+
|
305
|
+
wait_for(a_request(:post, base_uri)
|
306
|
+
.with { |request|
|
307
|
+
message = single_gzipped_message(request.body)
|
308
|
+
message['attributes']['bigdecimal'] == 0.12345
|
309
|
+
}
|
310
|
+
).to have_been_made
|
311
|
+
end
|
312
|
+
|
313
|
+
it "serializes NaN as null" do
|
314
|
+
stub_request(:any, base_uri).to_return(status: 200)
|
315
|
+
|
316
|
+
event = LogStash::Event.new({ "nan" => BigDecimal('NaN') })
|
317
|
+
@newrelic_output.multi_receive([event])
|
318
|
+
|
319
|
+
wait_for(a_request(:post, base_uri)
|
320
|
+
.with { |request|
|
321
|
+
message = single_gzipped_message(request.body)
|
322
|
+
message['attributes']['nan'] == nil
|
323
|
+
}
|
324
|
+
).to have_been_made
|
325
|
+
end
|
326
|
+
end
|
283
327
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-newrelic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- New Relic Logging Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,9 +116,11 @@ extra_rdoc_files: []
|
|
116
116
|
files:
|
117
117
|
- CHANGELOG.md
|
118
118
|
- CONTRIBUTORS
|
119
|
+
- DEVELOPER.md
|
119
120
|
- Gemfile
|
120
121
|
- LICENSE
|
121
122
|
- README.md
|
123
|
+
- lib/logstash/outputs/config/bigdecimal_patch.rb
|
122
124
|
- lib/logstash/outputs/newrelic.rb
|
123
125
|
- lib/logstash/outputs/newrelic_version/version.rb
|
124
126
|
- logstash-output-newrelic.gemspec
|