logstash-output-dynatrace 0.3.0 → 0.3.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
  SHA256:
3
- metadata.gz: aefa283dfb7437921963fafa7f068d82363dd421506ebab8b146026f5ca7e30c
4
- data.tar.gz: d8843b75b161044bbc20cd6ee4b6f28777ff98bd2cab487e669240d662ce3e4a
3
+ metadata.gz: 60e4c5d23c89b5a19d03a7af2545a407256fbdde27bd08ea95d63dc47749d8c5
4
+ data.tar.gz: 3bd9657eb9dfeadbbb3aa4b057c18ff0bc37c57f8e9b78258b499acd2f806ccf
5
5
  SHA512:
6
- metadata.gz: 4ef069a726a4765d9d4395156ab4bfa13ddaf5aa83fe6934ffd8e610af6330f6ecca44a16de538d85551b7c416b8fd97340907a5b6ad6cdf1c8a0abf0b5fb2a2
7
- data.tar.gz: 244956ca7a924de908e05987eb5d13392c007c864f4462b51914ff766db8784aefc7e1b24eb52ff68a747e530f22f5233bb1af155a4ca461f8adce61dee605e9
6
+ metadata.gz: 1d7efaac8bd9920d794187ec71a8d8294ff8ed76c50344cad4a231157cdda6cea6ef97b86664793fb97c024e81aad7dcfb03cd396cd206c675177d343f7baba0
7
+ data.tar.gz: 57573b36604af385d257edbe5a9af18a07eb68c6d31605003896787ba28e8afb72d7519202c92dd82f2d7854f60d43168dea86476dee1e0da1f4be4b30580e6c
data/CHANGELOG.md CHANGED
@@ -1,8 +1,20 @@
1
+ ## 0.3.2
2
+
3
+ - Add Net::OpenTimeout to the list of retried exceptions
4
+
5
+ ## 0.3.1
6
+
7
+ - Log and re-raise unknown errors
8
+ - Use [password](https://www.elastic.co/guide/en/logstash/current/configuration-file-structure.html#password) type for `api_key` configuration
9
+
1
10
  ## 0.3.0
2
- - Log response bodies on client errors
11
+
12
+ - Log response bodies on client errors
3
13
 
4
14
  ## 0.2.0
5
- - Add retries with exponential backoff (#8)
15
+
16
+ - Add retries with exponential backoff (#8)
6
17
 
7
18
  ## 0.1.0
8
- - Initial release
19
+
20
+ - Initial release
@@ -19,7 +19,7 @@ require 'logstash/outputs/base'
19
19
  require 'logstash/json'
20
20
 
21
21
  MAX_RETRIES = 5
22
- PLUGIN_VERSION = '0.3.0'
22
+ PLUGIN_VERSION = '0.3.2'
23
23
 
24
24
  module LogStash
25
25
  module Outputs
@@ -36,7 +36,7 @@ module LogStash
36
36
  config :ingest_endpoint_url, validate: :uri, required: true
37
37
 
38
38
  # The API token to use to authenticate requests to the log ingestion endpoint. Must have `logs.ingest` (Ingest Logs) scope.
39
- config :api_key, validate: :string, required: true
39
+ config :api_key, validate: :password, required: true
40
40
 
41
41
  # Disable SSL validation by setting :verify_mode OpenSSL::SSL::VERIFY_NONE
42
42
  config :ssl_verify_none, validate: :boolean, default: false
@@ -63,7 +63,7 @@ module LogStash
63
63
  {
64
64
  'User-Agent' => "logstash-output-dynatrace/#{PLUGIN_VERSION}",
65
65
  'Content-Type' => 'application/json; charset=utf-8',
66
- 'Authorization' => "Api-Token #{@api_key}"
66
+ 'Authorization' => "Api-Token #{@api_key.value}"
67
67
  }
68
68
  end
69
69
 
@@ -93,8 +93,9 @@ module LogStash
93
93
 
94
94
  raise RetryableError.new "code #{response.code}" if retryable(response)
95
95
 
96
- rescue Net::HTTPBadResponse, RetryableError => e
97
- # indicates a protocol error
96
+ rescue Net::OpenTimeout, Net::HTTPBadResponse, RetryableError => e
97
+ # Net::OpenTimeout indicates a connection could not be established within the timeout period
98
+ # Net::HTTPBadResponse indicates a protocol error
98
99
  if retries < MAX_RETRIES
99
100
  sleep_seconds = 2 ** retries
100
101
  @logger.warn("Failed to contact dynatrace: #{e.message}. Trying again after #{sleep_seconds} seconds.")
@@ -105,6 +106,9 @@ module LogStash
105
106
  @logger.error("Failed to export logs to Dynatrace.")
106
107
  return
107
108
  end
109
+ rescue StandardError => e
110
+ @logger.error("Unknown error raised", :error => e.inspect)
111
+ raise e
108
112
  end
109
113
  end
110
114
 
@@ -135,4 +135,17 @@ describe LogStash::Outputs::Dynatrace do
135
135
  subject.multi_receive(events)
136
136
  end
137
137
  end
138
+
139
+ context 'when an unknown error occurs' do
140
+ it 'logs and re-raises the error' do
141
+ class BadEvents
142
+ def length
143
+ 1
144
+ end
145
+ end
146
+
147
+ expect(subject.logger).to receive(:error)
148
+ expect { subject.multi_receive(BadEvents.new) }.to raise_error(StandardError)
149
+ end
150
+ end
138
151
  end
data/version.rb CHANGED
@@ -16,5 +16,5 @@
16
16
 
17
17
  module DynatraceConstants
18
18
  # Also required to change the version in lib/logstash/outputs/dynatrace.rb
19
- VERSION = '0.3.0'
19
+ VERSION = '0.3.2'
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-dynatrace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dynatrace Open Source Engineering
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-06 00:00:00.000000000 Z
11
+ date: 2022-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-codec-json