packrat-rails 0.4.0 → 0.4.1
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 +4 -4
- data/lib/packrat/otel/scrubber.rb +18 -5
- data/lib/packrat/otel.rb +4 -6
- data/lib/packrat/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eff67491572004ed16bdf75327dfdd9e7bcb449f8ab9e0ea62739b4c8bcb1cb8
|
|
4
|
+
data.tar.gz: 5a22cd57c3948731f30764e372b7b2abbc5dcbe730581f15127e1d8e43b676e3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b86a54aa7f48bfc4bef55707bbd2e3d8767bc25be922bf4f64073bc4945514b924f4ed833f75b63e3a1490b2540b4d2550051e94c4acdb2243e83fbe7a15aff8
|
|
7
|
+
data.tar.gz: 8cff66439b796c89f4760eba7dd1d77c2f515f0f8306ab6db0ffa6b747a0856ff537da800b79d3beb591e04cedaa8fcd1043a646145d9c0a21d1a1228daa1e66
|
|
@@ -229,28 +229,41 @@ module Packrat
|
|
|
229
229
|
class ScrubbingSpanExporter
|
|
230
230
|
PREFIX = "Packrat export: ".freeze
|
|
231
231
|
|
|
232
|
-
|
|
232
|
+
# With a block, a forked process builds its own exporter with it: the parent's holds a TLS connection
|
|
233
|
+
# that is open in both, and a write from the child corrupts the session ("bad record mac"). That
|
|
234
|
+
# includes the shutdown at exit, which closes the connection by writing to it.
|
|
235
|
+
def initialize(exporter, scrubber = Scrubber.new, io: nil, &rebuild)
|
|
233
236
|
@exporter = exporter
|
|
234
237
|
@scrubber = scrubber
|
|
235
238
|
@io = io
|
|
239
|
+
@rebuild = rebuild
|
|
240
|
+
@pid = Process.pid
|
|
236
241
|
end
|
|
237
242
|
|
|
238
243
|
def export(spans, timeout: nil)
|
|
239
244
|
spans = @scrubber.scrub_spans(spans)
|
|
240
245
|
write_lines(spans) { |span| span_line(span) }
|
|
241
|
-
|
|
246
|
+
exporter.export(spans, timeout:)
|
|
242
247
|
end
|
|
243
248
|
|
|
244
249
|
def force_flush(timeout: nil)
|
|
245
|
-
|
|
250
|
+
exporter.force_flush(timeout:)
|
|
246
251
|
end
|
|
247
252
|
|
|
248
253
|
def shutdown(timeout: nil)
|
|
249
|
-
|
|
254
|
+
exporter.shutdown(timeout:)
|
|
250
255
|
end
|
|
251
256
|
|
|
252
257
|
private
|
|
253
258
|
|
|
259
|
+
def exporter
|
|
260
|
+
if @rebuild && @pid != Process.pid
|
|
261
|
+
@pid = Process.pid
|
|
262
|
+
@exporter = @rebuild.call
|
|
263
|
+
end
|
|
264
|
+
@exporter
|
|
265
|
+
end
|
|
266
|
+
|
|
254
267
|
def write_lines(items)
|
|
255
268
|
return unless @io
|
|
256
269
|
|
|
@@ -272,7 +285,7 @@ module Packrat
|
|
|
272
285
|
def export(records, timeout: nil)
|
|
273
286
|
records = @scrubber.scrub_log_records(records)
|
|
274
287
|
write_lines(records) { |record| log_line(record) }
|
|
275
|
-
|
|
288
|
+
exporter.export(records, timeout:)
|
|
276
289
|
end
|
|
277
290
|
|
|
278
291
|
private
|
data/lib/packrat/otel.rb
CHANGED
|
@@ -143,15 +143,13 @@ module Packrat
|
|
|
143
143
|
end
|
|
144
144
|
|
|
145
145
|
def span_processor
|
|
146
|
-
OpenTelemetry::
|
|
147
|
-
|
|
148
|
-
)
|
|
146
|
+
build = -> { OpenTelemetry::Exporter::OTLP::Exporter.new(endpoint: @config.traces_endpoint, headers: @config.headers) }
|
|
147
|
+
OpenTelemetry::SDK::Trace::Export::BatchSpanProcessor.new(ScrubbingSpanExporter.new(build.call, scrubber, io: debug_io, &build))
|
|
149
148
|
end
|
|
150
149
|
|
|
151
150
|
def log_record_processor
|
|
152
|
-
OpenTelemetry::
|
|
153
|
-
|
|
154
|
-
)
|
|
151
|
+
build = -> { OpenTelemetry::Exporter::OTLP::Logs::LogsExporter.new(endpoint: @config.logs_endpoint, headers: @config.headers) }
|
|
152
|
+
OpenTelemetry::SDK::Logs::Export::BatchLogRecordProcessor.new(ScrubbingLogExporter.new(build.call, scrubber, io: debug_io, &build))
|
|
155
153
|
rescue NameError => error
|
|
156
154
|
raise unless error.name == :Utilities
|
|
157
155
|
|
data/lib/packrat/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: packrat-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Packrat Labs
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: railties
|