logstash-output-newrelic 1.0.5.pre.beta → 1.0.7
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e227255c0f05ab2bbd664c45fd3ed25e7edfc9e15481255052688c5dfd1ddd2e
|
4
|
+
data.tar.gz: f3add56ccb74bac8b9f6106f9862254250c6adab4d79723c9fb89940dd5f2c5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b1e8ffc8dacea562486112bdca20cff806da7b21336d3e03612cda334fbb0882c26b6f3ce6e230f1f53c5b8e56627bd675009b0c4bc2741d2628999a434375c
|
7
|
+
data.tar.gz: 6bd40c68709a7c1fc63bcb9002e538b49a340526c00e617cdfb3e7b988393b705b12179732cf4a93fcab05dad067789e8c1219b3466483d248d3d23878b1f39f
|
@@ -49,17 +49,18 @@ class LogStash::Outputs::NewRelic < LogStash::Outputs::Base
|
|
49
49
|
|
50
50
|
def encode(event_hash)
|
51
51
|
log_message_hash = {
|
52
|
-
|
52
|
+
# non-intrinsic attributes get put into 'attributes'
|
53
|
+
:attributes => event_hash
|
53
54
|
}
|
54
55
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
56
|
+
# intrinsic attributes go at the top level
|
57
|
+
if event_hash['message']
|
58
|
+
log_message_hash['message'] = event_hash['message']
|
59
|
+
log_message_hash[:attributes].delete('message')
|
60
|
+
end
|
61
|
+
if event_hash['timestamp']
|
62
|
+
log_message_hash['timestamp'] = event_hash['timestamp']
|
63
|
+
log_message_hash[:attributes].delete('timestamp')
|
63
64
|
end
|
64
65
|
|
65
66
|
log_message_hash
|
@@ -101,11 +102,22 @@ class LogStash::Outputs::NewRelic < LogStash::Outputs::Base
|
|
101
102
|
end
|
102
103
|
|
103
104
|
def sleep_duration(attempt)
|
104
|
-
|
105
|
+
if attempt == 0
|
106
|
+
return 0
|
107
|
+
end
|
108
|
+
|
109
|
+
[max_delay, (2 ** (attempt - 1)) * retry_seconds].min
|
110
|
+
end
|
111
|
+
|
112
|
+
def sleep_on_retry(attempt)
|
113
|
+
duration = sleep_duration(attempt)
|
114
|
+
if duration > 0
|
115
|
+
sleep duration
|
116
|
+
end
|
105
117
|
end
|
106
118
|
|
107
119
|
def attempt_send(payload, attempt)
|
108
|
-
|
120
|
+
sleep_on_retry(attempt)
|
109
121
|
attempt_send(payload, attempt + 1) unless was_successful?(nr_send(payload)) if should_retry?(attempt)
|
110
122
|
end
|
111
123
|
|
@@ -224,12 +224,13 @@ describe LogStash::Outputs::NewRelic do
|
|
224
224
|
@newrelic_output = LogStash::Plugin.lookup("output", "newrelic").new(specific_config)
|
225
225
|
@newrelic_output.register
|
226
226
|
|
227
|
-
expect(@newrelic_output.sleep_duration(0)).to equal(
|
228
|
-
expect(@newrelic_output.sleep_duration(1)).to equal(
|
229
|
-
expect(@newrelic_output.sleep_duration(2)).to equal(
|
230
|
-
expect(@newrelic_output.sleep_duration(3)).to equal(
|
231
|
-
expect(@newrelic_output.sleep_duration(4)).to equal(
|
232
|
-
expect(@newrelic_output.sleep_duration(5)).to equal(60)
|
227
|
+
expect(@newrelic_output.sleep_duration(0)).to equal(0)
|
228
|
+
expect(@newrelic_output.sleep_duration(1)).to equal(5)
|
229
|
+
expect(@newrelic_output.sleep_duration(2)).to equal(10)
|
230
|
+
expect(@newrelic_output.sleep_duration(3)).to equal(20)
|
231
|
+
expect(@newrelic_output.sleep_duration(4)).to equal(40)
|
232
|
+
expect(@newrelic_output.sleep_duration(5)).to equal(60)
|
233
|
+
expect(@newrelic_output.sleep_duration(6)).to equal(60) # Never gets bigger than this
|
233
234
|
end
|
234
235
|
|
235
236
|
it "first call fails, should retry" do
|
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.0.
|
4
|
+
version: 1.0.7
|
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: 2019-
|
11
|
+
date: 2019-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -113,9 +113,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
113
|
version: '0'
|
114
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- - "
|
116
|
+
- - ">="
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
118
|
+
version: '0'
|
119
119
|
requirements: []
|
120
120
|
rubyforge_project:
|
121
121
|
rubygems_version: 2.7.6
|