logstash-output-dynatrace 0.7.2 → 0.9.0

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: 6dc320145268685ae7585b0ffc68beb54ae932b3e9c5261e1ca6106803c487df
4
- data.tar.gz: 223b65b82ffc6ed512d270eb879126a9f9fbe046f9dfc9e66ae9a37be2e60fcf
3
+ metadata.gz: 1bb71f202f531a1a121532e45f818febc0f88199d57255b59b5cb939d519710a
4
+ data.tar.gz: 43a00991c9e55c6758486add2a6d34ab1f46a9cac9416796d9f0ab52b41feecb
5
5
  SHA512:
6
- metadata.gz: 55a4b11c59aae913134c5972dff31b13c3e3eaa8761db6703a88e081df6d369b39d6be5f924219e30312b819a54c30d7aced19d98b24f6bcf4e988561929ce50
7
- data.tar.gz: 401c4c51154584cee22c94f557a5869b8782759b5287498571e2f1ae345150f48625417126140bb54676560a3d75f7659b30ca392b2db2470dae7815b49904d2
6
+ metadata.gz: 98192fdeff3b6f84bc3f3b677fee77cf1d8bc8367bf2955feabca1a702cfd024ff08c8f4f2a8a37262574df5ec5077156d1f9bd3f229c8a72a1e0d43b6a2a16c
7
+ data.tar.gz: 8b671730fa910fe072a14ab08c76eb8f9ff249c6e3444a8375bb499a37bd165b5a9cd97966cffbd08ec84c2df50f6105b884974880df414b65fd367d6bc801fc
data/README.md CHANGED
@@ -109,6 +109,15 @@ This option may be required if you are using a self-signed certificate, an expir
109
109
  > NOTE: Starting in plugin version `0.5.0`, this option has no effect in versions of Logstash older than `8.1.0`.
110
110
  > If this functionality is required, it is recommended to update Logstash or stay at plugin version `0.4.x` or older.
111
111
 
112
+ ### `max_payload_size`
113
+
114
+ * Value type is [number](https://www.elastic.co/docs/reference/logstash/configuration-file-structure#number)
115
+ * Optional
116
+ * Default value is `9_500_000`
117
+
118
+ It is recommended **not** to set this optional configuration unless you have a specific reason to do so.
119
+ If you, for example, are using a proxy with a payload size limit, this configuration can be used to reduce the maximum size batch that is sent to the server.
120
+
112
121
  ### `proxy`
113
122
 
114
123
  * Value type is [string](https://www.elastic.co/guide/en/logstash/current/configuration-file-structure.html#string) or [hash](https://www.elastic.co/guide/en/logstash/current/configuration-file-structure.html#hash)
@@ -168,6 +177,9 @@ in order to isolate problems caused by only the Dynatrace output plugin.
168
177
 
169
178
  See <https://www.elastic.co/guide/en/logstash/current/logging.html#logging>.
170
179
 
180
+ The plugin will output some debug log messages, including the number of log lines received, which should help
181
+ with debugging.
182
+
171
183
  You can enable debug logging in one of several ways:
172
184
 
173
185
  - Use the `--log.level debug` command line flag
@@ -76,7 +76,7 @@ module LogStash
76
76
  config :debug_include_body, validate: :boolean, default: false
77
77
 
78
78
  # Maximum size payload to send to the Dynatrace API in Bytes. Batches of events which would be larger than max_payload_size when serialized will be split into smaller batches of events.
79
- config :max_payload_size, validate: :number, default: 4_500_000
79
+ config :max_payload_size, validate: :number, default: 9_500_000
80
80
 
81
81
  # Disable cookie support. Overridden default value from LogStash::PluginMixins::HttpClient
82
82
  config :cookies, :validate => :boolean, :default => false
@@ -95,6 +95,8 @@ module LogStash
95
95
  end
96
96
 
97
97
  def multi_receive(events)
98
+ log_debug('Trying to send logs to Dynatrace', event_count: events.length)
99
+
98
100
  return if events.empty?
99
101
 
100
102
  send_events(events)
@@ -352,6 +354,11 @@ module LogStash
352
354
  @logger.warn(message, opts)
353
355
  end
354
356
 
357
+ # This is split into a separate method mostly to help testing
358
+ def log_debug(message, opts)
359
+ @logger.debug? && @logger.debug(message, opts)
360
+ end
361
+
355
362
  # gzip data
356
363
  def gzip(data)
357
364
  gz = StringIO.new
@@ -66,6 +66,10 @@ describe LogStash::Outputs::Dynatrace do
66
66
  expect(subject).to have_received(:log_failure).with(anything, hash_including(:backtrace))
67
67
  end
68
68
 
69
+ it 'logs a debug message' do
70
+ expect(subject).to have_received(:log_debug).with(any_args)
71
+ end
72
+
69
73
  context 'with debug_include_headers false (default)' do
70
74
  it 'does not log headers' do
71
75
  expect(subject).to have_received(:log_failure).with(anything, hash_not_including(:headers))
@@ -124,6 +128,7 @@ describe LogStash::Outputs::Dynatrace do
124
128
  .and_call_original
125
129
  allow(subject).to receive(:log_failure).with(any_args)
126
130
  allow(subject).to receive(:log_warning).with(any_args)
131
+ allow(subject).to receive(:log_debug).with(any_args)
127
132
  allow(subject).to receive(:log_retryable_response).with(any_args)
128
133
  end
129
134
 
@@ -201,17 +206,6 @@ describe LogStash::Outputs::Dynatrace do
201
206
  end
202
207
  end
203
208
 
204
- context 'with more than 4.5MB of events' do
205
- before do
206
- allow(subject).to receive(:send_event) { |e, att| [:success, e, att] }
207
- subject.multi_receive([1, 2].map { |n| LogStash::Event.new({ 'n' => n.to_s * 2_500_001 }) })
208
- end
209
-
210
- it 'should split the chunk into multiple requests' do
211
- expect(subject).to have_received(:send_event).exactly(2).times
212
- end
213
- end
214
-
215
209
  shared_examples('send small and drop large') do
216
210
  it 'should only send the small event' do
217
211
  expect(subject).to have_received(:send_event).exactly(1).times
@@ -223,26 +217,6 @@ describe LogStash::Outputs::Dynatrace do
223
217
  .exactly(:once)
224
218
  end
225
219
  end
226
-
227
- context 'with one small event and one too large event' do
228
- before do
229
- allow(subject).to receive(:send_event) { |e, att| [:success, e, att] }
230
- subject.multi_receive([LogStash::Event.new({ 'event' => 'small' }),
231
- LogStash::Event.new({ 'event' => 'n' * 4_500_001 })])
232
- end
233
-
234
- include_examples('send small and drop large')
235
- end
236
-
237
- context 'with one too large event and one small event' do
238
- before do
239
- allow(subject).to receive(:send_event) { |e, att| [:success, e, att] }
240
- subject.multi_receive([LogStash::Event.new({ 'event' => 'n' * 4_500_001 }),
241
- LogStash::Event.new({ 'event' => 'small' })])
242
- end
243
-
244
- include_examples('send small and drop large')
245
- end
246
220
  end
247
221
 
248
222
  context 'max_payload_size 500' do
data/version.yaml CHANGED
@@ -1 +1 @@
1
- logstash-output-dynatrace: '0.7.2'
1
+ logstash-output-dynatrace: '0.9.0'
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.7.2
4
+ version: 0.9.0
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: 2025-05-06 00:00:00.000000000 Z
11
+ date: 2025-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-codec-json