brainzlab 0.1.35 → 0.1.37

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.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/lib/brainzlab/beacon/client.rb +6 -4
  4. data/lib/brainzlab/configuration.rb +272 -301
  5. data/lib/brainzlab/cortex/client.rb +6 -4
  6. data/lib/brainzlab/debug.rb +6 -6
  7. data/lib/brainzlab/dendrite/client.rb +6 -4
  8. data/lib/brainzlab/development/logger.rb +2 -2
  9. data/lib/brainzlab/development/store.rb +4 -2
  10. data/lib/brainzlab/devtools/middleware/error_page.rb +1 -1
  11. data/lib/brainzlab/errors.rb +12 -5
  12. data/lib/brainzlab/flux/client.rb +1 -1
  13. data/lib/brainzlab/instrumentation/action_cable.rb +4 -4
  14. data/lib/brainzlab/instrumentation/action_controller.rb +12 -12
  15. data/lib/brainzlab/instrumentation/action_dispatch.rb +1 -1
  16. data/lib/brainzlab/instrumentation/action_mailbox.rb +13 -7
  17. data/lib/brainzlab/instrumentation/action_view.rb +33 -29
  18. data/lib/brainzlab/instrumentation/active_job.rb +10 -6
  19. data/lib/brainzlab/instrumentation/active_record.rb +24 -21
  20. data/lib/brainzlab/instrumentation/active_storage.rb +4 -4
  21. data/lib/brainzlab/instrumentation/active_support_cache.rb +8 -6
  22. data/lib/brainzlab/instrumentation/grape.rb +1 -3
  23. data/lib/brainzlab/instrumentation/rails_deprecation.rb +1 -1
  24. data/lib/brainzlab/instrumentation/railties.rb +2 -2
  25. data/lib/brainzlab/nerve/client.rb +6 -4
  26. data/lib/brainzlab/pulse/client.rb +58 -2
  27. data/lib/brainzlab/pulse/metric_buffer.rb +128 -0
  28. data/lib/brainzlab/pulse.rb +5 -7
  29. data/lib/brainzlab/rails/railtie.rb +3 -1
  30. data/lib/brainzlab/reflex/client.rb +1 -1
  31. data/lib/brainzlab/sentinel/client.rb +6 -4
  32. data/lib/brainzlab/synapse/client.rb +6 -4
  33. data/lib/brainzlab/testing/event_store.rb +3 -3
  34. data/lib/brainzlab/testing/matchers.rb +4 -4
  35. data/lib/brainzlab/testing.rb +3 -5
  36. data/lib/brainzlab/vault/client.rb +6 -4
  37. data/lib/brainzlab/version.rb +1 -1
  38. data/lib/brainzlab/vision/client.rb +3 -3
  39. data/lib/fluyenta-ruby.rb +1 -1
  40. metadata +3 -2
@@ -109,7 +109,7 @@ module BrainzLab
109
109
  hit_count: hit_count,
110
110
  miss_count: key_count - hit_count,
111
111
  duration_ms: duration,
112
- hit_rate: key_count.positive? ? (hit_count.to_f / key_count * 100).round(1) : 0
112
+ hit_rate: key_count > 0 ? (hit_count.to_f / key_count * 100).round(1) : 0
113
113
  }
114
114
  )
115
115
  end
@@ -476,7 +476,7 @@ module BrainzLab
476
476
  # Log pattern deletes
477
477
  if BrainzLab.configuration.recall_effectively_enabled?
478
478
  BrainzLab::Recall.info(
479
- 'Cache pattern delete',
479
+ "Cache pattern delete",
480
480
  pattern: truncate_key(key),
481
481
  duration_ms: duration
482
482
  )
@@ -502,6 +502,7 @@ module BrainzLab
502
502
  duration = event.duration.round(2)
503
503
 
504
504
  size = payload[:size]
505
+ key = payload[:key]
505
506
 
506
507
  # Record breadcrumb
507
508
  if BrainzLab.configuration.reflex_effectively_enabled?
@@ -538,6 +539,7 @@ module BrainzLab
538
539
  payload = event.payload
539
540
  duration = event.duration.round(2)
540
541
 
542
+ key = payload[:key]
541
543
  from = payload[:from]
542
544
  to = payload[:to]
543
545
 
@@ -561,7 +563,7 @@ module BrainzLab
561
563
  # Log prune operations
562
564
  if BrainzLab.configuration.recall_effectively_enabled?
563
565
  BrainzLab::Recall.info(
564
- 'Cache pruned',
566
+ "Cache pruned",
565
567
  from: from,
566
568
  to: to,
567
569
  duration_ms: duration
@@ -591,8 +593,8 @@ module BrainzLab
591
593
 
592
594
  serializer = payload[:serializer]
593
595
  fallback = payload[:fallback]
594
- payload[:serialized]
595
- payload[:deserialized]
596
+ serialized = payload[:serialized]
597
+ deserialized = payload[:deserialized]
596
598
 
597
599
  # Record breadcrumb - this is a warning as it indicates a format mismatch
598
600
  if BrainzLab.configuration.reflex_effectively_enabled?
@@ -611,7 +613,7 @@ module BrainzLab
611
613
  # Log to Recall - this is significant for debugging serialization issues
612
614
  if BrainzLab.configuration.recall_effectively_enabled?
613
615
  BrainzLab::Recall.warn(
614
- 'Message serializer fallback used',
616
+ "Message serializer fallback used",
615
617
  serializer: serializer.to_s,
616
618
  fallback: fallback.to_s,
617
619
  duration_ms: duration
@@ -203,9 +203,7 @@ module BrainzLab
203
203
  end
204
204
 
205
205
  def safe_dig(routing_args, key)
206
- return nil unless routing_args.respond_to?(:dig)
207
-
208
- routing_args[key]
206
+ routing_args.respond_to?(:dig) ? routing_args.dig(key) : nil
209
207
  rescue StandardError
210
208
  nil
211
209
  end
@@ -60,7 +60,7 @@ module BrainzLab
60
60
  # Log to Recall for tracking
61
61
  if BrainzLab.configuration.recall_effectively_enabled?
62
62
  BrainzLab::Recall.warn(
63
- 'Rails deprecation warning',
63
+ "Rails deprecation warning",
64
64
  message: truncate_message(message, 500),
65
65
  gem_name: gem_name,
66
66
  deprecation_horizon: deprecation_horizon,
@@ -4,8 +4,8 @@ module BrainzLab
4
4
  module Instrumentation
5
5
  class Railties
6
6
  # Thresholds for slow initializers (in milliseconds)
7
- SLOW_INITIALIZER_THRESHOLD = 100 # 100ms
8
- VERY_SLOW_INITIALIZER_THRESHOLD = 500 # 500ms
7
+ SLOW_INITIALIZER_THRESHOLD = 100 # 100ms
8
+ VERY_SLOW_INITIALIZER_THRESHOLD = 500 # 500ms
9
9
 
10
10
  class << self
11
11
  def install!
@@ -212,9 +212,9 @@ module BrainzLab
212
212
  BrainzLab.debug_log("[Nerve::Client] #{operation} failed: #{structured_error.message}")
213
213
 
214
214
  # Call on_error callback if configured
215
- return unless @config.on_error
216
-
217
- @config.on_error.call(structured_error, { service: 'Nerve', operation: operation })
215
+ if @config.on_error
216
+ @config.on_error.call(structured_error, { service: 'Nerve', operation: operation })
217
+ end
218
218
  end
219
219
 
220
220
  def handle_response_error(response, operation)
@@ -224,7 +224,9 @@ module BrainzLab
224
224
  BrainzLab.debug_log("[Nerve::Client] #{operation} failed: #{structured_error.message}")
225
225
 
226
226
  # Call on_error callback if configured
227
- @config.on_error&.call(structured_error, { service: 'Nerve', operation: operation })
227
+ if @config.on_error
228
+ @config.on_error.call(structured_error, { service: 'Nerve', operation: operation })
229
+ end
228
230
 
229
231
  structured_error
230
232
  end
@@ -3,6 +3,7 @@
3
3
  require 'net/http'
4
4
  require 'uri'
5
5
  require 'json'
6
+ require_relative 'metric_buffer'
6
7
 
7
8
  module BrainzLab
8
9
  module Pulse
@@ -43,8 +44,32 @@ module BrainzLab
43
44
 
44
45
  def send_metric(payload)
45
46
  return unless @config.pulse_enabled && @config.pulse_valid?
47
+ return post('/api/v1/metrics', payload) unless batching_metrics?
46
48
 
47
- post('/api/v1/metrics', payload)
49
+ metric_buffer.add(payload)
50
+ end
51
+
52
+ def send_metrics(payloads)
53
+ return unless @config.pulse_enabled && @config.pulse_valid?
54
+
55
+ sendable = payloads.select { |payload| sendable_metric?(payload) }
56
+ return if sendable.empty?
57
+
58
+ post('/api/v1/metrics/batch', { metrics: sendable })
59
+ end
60
+
61
+ def batching_metrics?
62
+ @config.pulse_buffer_size > 1
63
+ end
64
+
65
+ # Entrega las métricas pendientes y termina el hilo de fondo.
66
+ def shutdown
67
+ @metric_buffer&.shutdown
68
+ end
69
+
70
+ # Descarta las métricas pendientes y termina el hilo de fondo, sin tocar la red.
71
+ def stop
72
+ @metric_buffer&.stop
48
73
  end
49
74
 
50
75
  def send_span(payload)
@@ -68,6 +93,35 @@ module BrainzLab
68
93
 
69
94
  private
70
95
 
96
+ # Fork-safety: el hilo de fondo no sobrevive a un fork (workers de Puma). Cada
97
+ # proceso necesita su propio buffer, si no sus métricas se quedarían sin enviar.
98
+ def metric_buffer
99
+ @mutex.synchronize do
100
+ if @metric_buffer.nil? || @metric_buffer_pid != Process.pid
101
+ @metric_buffer = MetricBuffer.new(
102
+ batch_size: @config.pulse_buffer_size,
103
+ flush_interval: @config.pulse_flush_interval
104
+ ) { |batch| send_metrics(batch) }
105
+ @metric_buffer_pid = Process.pid
106
+ end
107
+ @metric_buffer
108
+ end
109
+ end
110
+
111
+ # Pulse rechaza el lote entero con un 422 si un value no es número ni string, y
112
+ # JSON.generate falla con NaN, Infinity o tags con bytes inválidos. Un solo punto
113
+ # así no puede llevarse por delante a los demás.
114
+ def sendable_metric?(payload)
115
+ value = payload[:value]
116
+ return false unless value.nil? || value.is_a?(Numeric) || value.is_a?(String)
117
+
118
+ JSON.generate(payload)
119
+ true
120
+ rescue JSON::GeneratorError, EncodingError => e
121
+ log_error("Dropped metric #{payload[:name].inspect}: #{e.message}")
122
+ false
123
+ end
124
+
71
125
  # Keep error traces always; otherwise keep with probability = the
72
126
  # effective per-tier sample rate (internal=0.1, standard=0.5, client=1.0).
73
127
  def keep_trace?(payload)
@@ -182,6 +236,8 @@ module BrainzLab
182
236
 
183
237
  data = if body.is_a?(Hash) && body[:traces]
184
238
  { count: body[:traces].size }
239
+ elsif body.is_a?(Hash) && body[:metrics]
240
+ { count: body[:metrics].size }
185
241
  elsif body.is_a?(Hash) && body[:name]
186
242
  { name: body[:name] }
187
243
  else
@@ -207,7 +263,7 @@ module BrainzLab
207
263
  end
208
264
 
209
265
  def handle_error(error, context: {})
210
- log_error(error.message.to_s)
266
+ log_error("#{error.message}")
211
267
 
212
268
  # Call on_error callback if configured
213
269
  return unless @config.on_error
@@ -0,0 +1,128 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrainzLab
4
+ module Pulse
5
+ # Agrupa las métricas y las entrega desde un único hilo de fondo.
6
+ #
7
+ # La instrumentación emite desde el hilo de la petición: aquí nunca se hace
8
+ # HTTP en ese hilo, y un solo lote en vuelo por proceso acota la carga que un
9
+ # proceso puede poner sobre Pulse.
10
+ class MetricBuffer
11
+ # Con Pulse caído cada lote tarda hasta ~1 min en agotar reintentos. Sin este
12
+ # tope la cola crecería sin límite en la memoria de la app huésped.
13
+ MAX_PENDING_BATCHES = 20
14
+ DEFAULT_SHUTDOWN_TIMEOUT = 5 # segundos; debe caber en el grace period del pod
15
+
16
+ def initialize(batch_size:, flush_interval:, shutdown_timeout: DEFAULT_SHUTDOWN_TIMEOUT, &sender)
17
+ @batch_size = batch_size
18
+ @flush_interval = flush_interval
19
+ @shutdown_timeout = shutdown_timeout
20
+ @sender = sender
21
+ @max_pending = batch_size * MAX_PENDING_BATCHES
22
+ @pending = []
23
+ @dropped = 0
24
+ @closed = false
25
+ @mutex = Mutex.new
26
+ @wakeup = ConditionVariable.new
27
+ @owner_pid = Process.pid
28
+
29
+ at_exit { shutdown }
30
+ end
31
+
32
+ def add(metric)
33
+ @mutex.synchronize do
34
+ return if @closed
35
+
36
+ if @pending.size >= @max_pending
37
+ @pending.shift
38
+ @dropped += 1
39
+ end
40
+ @pending << metric
41
+ ensure_worker
42
+ @wakeup.signal if @pending.size >= @batch_size
43
+ end
44
+ nil
45
+ end
46
+
47
+ # Entrega lo pendiente y termina, sin pasar de shutdown_timeout.
48
+ def shutdown
49
+ # Un hijo forkeado hereda este at_exit y una copia de la cola: enviarla
50
+ # duplicaría los puntos que el padre sí va a entregar.
51
+ return unless Process.pid == @owner_pid
52
+
53
+ worker = @mutex.synchronize do
54
+ @closed = true
55
+ ensure_worker unless @pending.empty?
56
+ @wakeup.signal
57
+ @worker
58
+ end
59
+ worker&.join(@shutdown_timeout)
60
+ nil
61
+ end
62
+
63
+ # Descarta lo pendiente y termina, sin tocar la red.
64
+ def stop
65
+ @mutex.synchronize do
66
+ @closed = true
67
+ @pending.clear
68
+ @wakeup.signal
69
+ end
70
+ nil
71
+ end
72
+
73
+ def pending_size
74
+ @mutex.synchronize { @pending.size }
75
+ end
76
+
77
+ private
78
+
79
+ # Se llama con @mutex tomado. El hilo no sobrevive a un fork ni a una
80
+ # excepción que no sea StandardError, por eso se revisa en cada add.
81
+ def ensure_worker
82
+ return if @worker&.alive?
83
+
84
+ @worker = Thread.new { run }
85
+ @worker.report_on_exception = false
86
+ end
87
+
88
+ def run
89
+ loop do
90
+ batch, dropped, finished = next_batch
91
+ BrainzLab.debug_log("[Pulse] Dropped #{dropped} metrics: delivery is falling behind") if dropped.positive?
92
+ deliver(batch) unless batch.empty?
93
+ break if finished
94
+ end
95
+ end
96
+
97
+ def next_batch
98
+ @mutex.synchronize do
99
+ wait_for_batch
100
+ batch = @pending.shift(@batch_size)
101
+ dropped = @dropped
102
+ @dropped = 0
103
+ [batch, dropped, @closed && @pending.empty?]
104
+ end
105
+ end
106
+
107
+ def wait_for_batch
108
+ deadline = monotonic_now + @flush_interval
109
+ until @closed || @pending.size >= @batch_size
110
+ remaining = deadline - monotonic_now
111
+ break unless remaining.positive?
112
+
113
+ @wakeup.wait(@mutex, remaining)
114
+ end
115
+ end
116
+
117
+ def deliver(batch)
118
+ @sender.call(batch)
119
+ rescue StandardError => e
120
+ BrainzLab.debug_log("[Pulse] Metric batch send failed: #{e.message}")
121
+ end
122
+
123
+ def monotonic_now
124
+ Process.clock_gettime(Process::CLOCK_MONOTONIC)
125
+ end
126
+ end
127
+ end
128
+ end
@@ -83,9 +83,10 @@ module BrainzLab
83
83
  ensure_provisioned!
84
84
  return unless BrainzLab.configuration.pulse_valid?
85
85
 
86
- if BrainzLab.instrumenting?
86
+ if BrainzLab.instrumenting? && !client.batching_metrics?
87
87
  # During instrumentation, send in background thread to avoid
88
- # blocking the host app with synchronous HTTP
88
+ # blocking the host app with synchronous HTTP. The batching path
89
+ # never does HTTP on the calling thread.
89
90
  Thread.new { client.send_metric(payload) }
90
91
  else
91
92
  client.send_metric(payload)
@@ -119,11 +120,7 @@ module BrainzLab
119
120
 
120
121
  # Parse timestamp or use current time
121
122
  started_at = if timestamp
122
- begin
123
- Time.parse(timestamp)
124
- rescue StandardError
125
- Time.now.utc
126
- end
123
+ Time.parse(timestamp) rescue Time.now.utc
127
124
  else
128
125
  Time.now.utc
129
126
  end
@@ -180,6 +177,7 @@ module BrainzLab
180
177
  end
181
178
 
182
179
  def reset!
180
+ @client.stop if @client.respond_to?(:stop)
183
181
  @client = nil
184
182
  @tracer = nil
185
183
  @provisioner = nil
@@ -33,7 +33,9 @@ module BrainzLab
33
33
  # Add request context middleware. Gated on `enabled` so the kill switch
34
34
  # (BRAINZLAB_SDK_ENABLED=false) fully removes it — it previously loaded
35
35
  # unconditionally, so disabling didn't stop its session interference.
36
- app.middleware.insert_after ActionDispatch::RequestId, BrainzLab::Rails::Middleware if BrainzLab.configuration.enabled
36
+ if BrainzLab.configuration.enabled
37
+ app.middleware.insert_after ActionDispatch::RequestId, BrainzLab::Rails::Middleware
38
+ end
37
39
 
38
40
  # Add DevTools middlewares if enabled
39
41
  if BrainzLab.configuration.devtools_enabled
@@ -125,7 +125,7 @@ module BrainzLab
125
125
  end
126
126
 
127
127
  def handle_error(error, context: {})
128
- log_error(error.message.to_s)
128
+ log_error("#{error.message}")
129
129
 
130
130
  # Call on_error callback if configured
131
131
  return unless @config.on_error
@@ -213,9 +213,9 @@ module BrainzLab
213
213
  BrainzLab.debug_log("[Sentinel::Client] #{operation} failed: #{structured_error.message}")
214
214
 
215
215
  # Call on_error callback if configured
216
- return unless @config.on_error
217
-
218
- @config.on_error.call(structured_error, { service: 'Sentinel', operation: operation })
216
+ if @config.on_error
217
+ @config.on_error.call(structured_error, { service: 'Sentinel', operation: operation })
218
+ end
219
219
  end
220
220
 
221
221
  def handle_response_error(response, operation)
@@ -225,7 +225,9 @@ module BrainzLab
225
225
  BrainzLab.debug_log("[Sentinel::Client] #{operation} failed: #{structured_error.message}")
226
226
 
227
227
  # Call on_error callback if configured
228
- @config.on_error&.call(structured_error, { service: 'Sentinel', operation: operation })
228
+ if @config.on_error
229
+ @config.on_error.call(structured_error, { service: 'Sentinel', operation: operation })
230
+ end
229
231
 
230
232
  structured_error
231
233
  end
@@ -285,9 +285,9 @@ module BrainzLab
285
285
  BrainzLab.debug_log("[Synapse::Client] #{operation} failed: #{structured_error.message}")
286
286
 
287
287
  # Call on_error callback if configured
288
- return unless @config.on_error
289
-
290
- @config.on_error.call(structured_error, { service: 'Synapse', operation: operation })
288
+ if @config.on_error
289
+ @config.on_error.call(structured_error, { service: 'Synapse', operation: operation })
290
+ end
291
291
  end
292
292
 
293
293
  def handle_response_error(response, operation)
@@ -297,7 +297,9 @@ module BrainzLab
297
297
  BrainzLab.debug_log("[Synapse::Client] #{operation} failed: #{structured_error.message}")
298
298
 
299
299
  # Call on_error callback if configured
300
- @config.on_error&.call(structured_error, { service: 'Synapse', operation: operation })
300
+ if @config.on_error
301
+ @config.on_error.call(structured_error, { service: 'Synapse', operation: operation })
302
+ end
301
303
 
302
304
  structured_error
303
305
  end
@@ -187,9 +187,9 @@ module BrainzLab
187
187
  def error_captured?(error_class = nil, message: nil, context: nil)
188
188
  @mutex.synchronize do
189
189
  @errors.any? do |error|
190
- if error_class && !(error[:error_class] == error_class.to_s ||
191
- (error_class.is_a?(Class) && error[:exception].is_a?(error_class)))
192
- next false
190
+ if error_class
191
+ next false unless error[:error_class] == error_class.to_s ||
192
+ (error_class.is_a?(Class) && error[:exception].is_a?(error_class))
193
193
  end
194
194
 
195
195
  if message
@@ -112,10 +112,10 @@ module BrainzLab
112
112
  "expected event '#{@event_name}' to have been tracked, but no such event was found.\n" \
113
113
  "Tracked events: #{BrainzLab::Testing.event_store.events.map { |e| e[:name] }.inspect}"
114
114
  else
115
- "expected event '#{@event_name}' to have been tracked with properties:\n " \
116
- "#{@expected_properties.inspect}\n" \
117
- "but was tracked with:\n " \
118
- "#{actual_events.map { |e| e[:properties] }.inspect}"
115
+ "expected event '#{@event_name}' to have been tracked with properties:\n" \
116
+ " #{@expected_properties.inspect}\n" \
117
+ "but was tracked with:\n" \
118
+ " #{actual_events.map { |e| e[:properties] }.inspect}"
119
119
  end
120
120
  end
121
121
 
@@ -198,18 +198,16 @@ module BrainzLab
198
198
  end
199
199
 
200
200
  # Stub distributed tracing methods
201
- BrainzLab::Pulse.define_singleton_method(:inject) do |headers, **_opts|
201
+ BrainzLab::Pulse.define_singleton_method(:inject) do |headers, **opts|
202
202
  headers['traceparent'] = '00-test-trace-id-12345-test-span-id-67890-01'
203
203
  headers
204
204
  end
205
205
 
206
206
  BrainzLab::Pulse.define_singleton_method(:extract) do |headers|
207
- return unless headers['traceparent']
208
-
209
207
  BrainzLab::Pulse::Propagation::Context.new(
210
208
  trace_id: 'test-trace-id-12345',
211
209
  span_id: 'test-span-id-67890'
212
- )
210
+ ) if headers['traceparent']
213
211
  end
214
212
 
215
213
  BrainzLab::Pulse.define_singleton_method(:extract!) do |headers|
@@ -306,7 +304,7 @@ module BrainzLab
306
304
  BrainzLab::Cortex.define_singleton_method(:read) { |*| nil }
307
305
  BrainzLab::Cortex.define_singleton_method(:write) { |*| true }
308
306
  BrainzLab::Cortex.define_singleton_method(:delete) { |*| true }
309
- BrainzLab::Cortex.define_singleton_method(:fetch) { |_key, **_opts, &block| block&.call }
307
+ BrainzLab::Cortex.define_singleton_method(:fetch) { |key, **opts, &block| block&.call }
310
308
  end
311
309
 
312
310
  def stub_vault!
@@ -193,9 +193,9 @@ module BrainzLab
193
193
  BrainzLab.debug_log("[Vault::Client] #{operation} failed: #{structured_error.message}")
194
194
 
195
195
  # Call on_error callback if configured
196
- return unless @config.on_error
197
-
198
- @config.on_error.call(structured_error, { service: 'Vault', operation: operation })
196
+ if @config.on_error
197
+ @config.on_error.call(structured_error, { service: 'Vault', operation: operation })
198
+ end
199
199
  end
200
200
 
201
201
  def handle_response_error(response, operation)
@@ -205,7 +205,9 @@ module BrainzLab
205
205
  BrainzLab.debug_log("[Vault::Client] #{operation} failed: #{structured_error.message}")
206
206
 
207
207
  # Call on_error callback if configured
208
- @config.on_error&.call(structured_error, { service: 'Vault', operation: operation })
208
+ if @config.on_error
209
+ @config.on_error.call(structured_error, { service: 'Vault', operation: operation })
210
+ end
209
211
 
210
212
  structured_error
211
213
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BrainzLab
4
- VERSION = '0.1.35'
4
+ VERSION = '0.1.37'
5
5
  end
@@ -154,9 +154,9 @@ module BrainzLab
154
154
  BrainzLab.debug_log("[Vision::Client] #{operation} failed: #{error.message}")
155
155
 
156
156
  # Call on_error callback if configured
157
- return unless @config.on_error
158
-
159
- @config.on_error.call(error, { service: 'Vision', operation: operation })
157
+ if @config.on_error
158
+ @config.on_error.call(error, { service: 'Vision', operation: operation })
159
+ end
160
160
  end
161
161
 
162
162
  def auth_key
data/lib/fluyenta-ruby.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'brainzlab'
3
+ require_relative 'brainzlab'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brainzlab
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.35
4
+ version: 0.1.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - BrainzLab
@@ -179,6 +179,7 @@ files:
179
179
  - lib/brainzlab/pulse/client.rb
180
180
  - lib/brainzlab/pulse/explain_capture.rb
181
181
  - lib/brainzlab/pulse/instrumentation.rb
182
+ - lib/brainzlab/pulse/metric_buffer.rb
182
183
  - lib/brainzlab/pulse/propagation.rb
183
184
  - lib/brainzlab/pulse/provisioner.rb
184
185
  - lib/brainzlab/pulse/tracer.rb
@@ -248,7 +249,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
249
  - !ruby/object:Gem::Version
249
250
  version: '0'
250
251
  requirements: []
251
- rubygems_version: 3.6.9
252
+ rubygems_version: 4.0.10
252
253
  specification_version: 4
253
254
  summary: Ruby SDK for BrainzLab observability
254
255
  test_files: []