bitfab 0.23.3 → 0.23.5

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: b16e8767e1610a6e1a1ec7ab0f03a17b4eb365b991d26fa60f4aa6b9f3d39ac4
4
- data.tar.gz: f511a486af389b33aafbdcab66518f8b4381cceb137faec4e483fe81484379c6
3
+ metadata.gz: 4d7bb60df26fb6e5eb959504e04348c75da42fdf843db0ab16a90f65ecbc21ac
4
+ data.tar.gz: 338e1b2a5cd0793677f2a5103314e3fec50de4625539301805c6067df91c68e6
5
5
  SHA512:
6
- metadata.gz: e4e09e2cba8fe57b31adbedceabaff1720a80a20e4216821bbd0389bc5b45c05203a4aca205e49623ff934670a21d181bff8a27a0777ea905682f149d97360d4
7
- data.tar.gz: d2b56368cd69b9555e95431679e98acec87fb54d6c4da9ec2db2f72f0c86074b24e43abe67f5ae0a02355de7244280b31730a3feef6574a68ee0437e672ffd02
6
+ metadata.gz: 6582bfb080c33a0b1bb5558a60dbf2afbf59272b1e67ed4879c44b80e83f5b9fd03115b3a954d9a374c4663ddea3e3ad132be94287ce3f2a9ebfab69662bfe55
7
+ data.tar.gz: 84e482df4eef11e61d945f1b741564442fb097b8980ef9a9ad71994af7ab7ef7529312c39defa94a3e6682467a4e4fbbfaad0c2e6bb33050a5bdb29a9de78244
data/lib/bitfab/client.rb CHANGED
@@ -469,6 +469,10 @@ module Bitfab
469
469
  "completed" => true
470
470
  }
471
471
 
472
+ if trace_state&.dig(:dropped)
473
+ payload["dropped"] = true
474
+ end
475
+
472
476
  if trace_state&.dig(:session_id)
473
477
  payload["sessionId"] = trace_state[:session_id]
474
478
  end
data/lib/bitfab/replay.rb CHANGED
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "fileutils"
4
+ require "json"
5
+
3
6
  require_relative "constants"
4
7
  require_relative "serialize"
5
8
  require_relative "traceable"
@@ -239,11 +242,26 @@ module Bitfab
239
242
  end
240
243
  end
241
244
 
242
- {
245
+ replay_result = {
243
246
  items: result_items,
244
247
  test_run_id:,
245
248
  test_run_url: "#{client.service_url}#{test_run_url}"
246
249
  }
250
+ write_replay_result_file(replay_result)
251
+ replay_result
252
+ end
253
+
254
+ def write_replay_result_file(result)
255
+ result_path = ENV["BITFAB_REPLAY_RESULT_PATH"]
256
+ return if result_path.nil? || result_path.empty?
257
+
258
+ begin
259
+ dir = File.dirname(result_path)
260
+ FileUtils.mkdir_p(dir) unless dir.nil? || dir.empty? || dir == "."
261
+ File.write(result_path, "#{JSON.pretty_generate(result)}\n")
262
+ rescue => e
263
+ warn "Bitfab: failed to write replay result to BITFAB_REPLAY_RESULT_PATH (#{result_path}): #{e.message}"
264
+ end
247
265
  end
248
266
 
249
267
  # Process all replay items, optionally in parallel using threads.
@@ -87,6 +87,16 @@ module Bitfab
87
87
  # Silently ignore - never crash the host app
88
88
  end
89
89
 
90
+ # Flag this trace to be dropped on completion.
91
+ # When set, the completion POST carries a top-level dropped: true and the
92
+ # server scrubs and marks the trace dropped. Never raises into caller code.
93
+ def drop
94
+ trace_state = get_or_create_trace_state
95
+ trace_state[:dropped] = true
96
+ rescue
97
+ # Silently ignore - never crash the host app
98
+ end
99
+
90
100
  private
91
101
 
92
102
  def get_or_create_trace_state
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bitfab
4
- VERSION = "0.23.3"
4
+ VERSION = "0.23.5"
5
5
  end
data/lib/bitfab.rb CHANGED
@@ -45,6 +45,10 @@ module Bitfab
45
45
  def add_context(_context)
46
46
  # No-op
47
47
  end
48
+
49
+ def drop
50
+ # No-op
51
+ end
48
52
  end
49
53
 
50
54
  NO_OP_SPAN = NoOpCurrentSpan.new.freeze
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitfab
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.3
4
+ version: 0.23.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harvest Team