bitfab 0.23.4 → 0.23.6

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: 4c6103564370cdb20d6ed221a57c1cd29f8e410cd23ad3218b4eb0bda3ff3bd1
4
- data.tar.gz: aded540c60d09f0838e529fc7616659fc6d64ad5dbcaf12baf396b164d741f7d
3
+ metadata.gz: fc6488982aa89cb2226e627f80da9bd85a1575bac14728aa81d2d5974c920aae
4
+ data.tar.gz: 519b07afa8c9a7220d730b7bc72b5e8a3cddb037b3e2b70bd36b476c4d400d29
5
5
  SHA512:
6
- metadata.gz: 4ee3df19ee7101db92bea5305f61c67cc92d1bb5cdf4999cde05f31ee15b7e5090d5f474a35abb5814ca799a8849cea1cc3eda55064ec72bd2ac601c251622a0
7
- data.tar.gz: 6729607659c50822d1799e86dfc3219cf7cfa5d47a8d9e82d5e8904918f3378a4d98b8f6a0bf9435ed8f34b147d96b061730424cbd2ce0a132d82e3a10c3f415
6
+ metadata.gz: 362409a4955d1eec6ac5b4c0309a87d65ce9722f517f4cc364931f89fb66adf1a5fe0b4ac1d5a847a7e9d7fc9559c4d2449de03b2c2d9900ded22e317db28518
7
+ data.tar.gz: 735836a1730cf48e2fb5370f755e667bf3912b96a21ca9b97375b7e4e1bfd43e34531e557c5d49f28482dbbe32c091ec5bb08cc86fc9656b4f44a6edd7880b0f
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
@@ -489,6 +493,14 @@ module Bitfab
489
493
  def send_span(trace_function_key:, trace_id:, span_id:, parent_span_id:,
490
494
  span_name:, span_type:, function_name:, contexts:, prompt:, args:, kwargs:, result:, error:,
491
495
  started_at:, ended_at:, test_run_id: nil, input_source_span_id: nil)
496
+ # If drop() was called on this trace, suppress the span PAYLOAD upload for
497
+ # every span that completes after the flag was set. The trace completion
498
+ # still rides out with dropped: true, so the server scrubs any sibling
499
+ # spans that already raced out before the flag was set. Returning nil
500
+ # signals "no span thread" to the caller, which already handles nil.
501
+ trace_dropped = TraceState.get(trace_id)&.dig(:dropped) == true
502
+ return nil if trace_dropped
503
+
492
504
  # Human-readable JSON (input/output fields). The *_with_report variants
493
505
  # also report what could not be faithfully captured so a lossy span is
494
506
  # marked non-replayable below instead of shipping as if it round-trips.
@@ -87,6 +87,17 @@ module Bitfab
87
87
  # Silently ignore - never crash the host app
88
88
  end
89
89
 
90
+ # Flag this trace to be dropped. Once flagged, spans that complete afterward
91
+ # are not uploaded at all, and the completion POST carries a top-level
92
+ # dropped: true so the server scrubs any payloads that already raced out and
93
+ # marks the trace dropped. Never raises into caller code.
94
+ def drop
95
+ trace_state = get_or_create_trace_state
96
+ trace_state[:dropped] = true
97
+ rescue
98
+ # Silently ignore - never crash the host app
99
+ end
100
+
90
101
  private
91
102
 
92
103
  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.4"
4
+ VERSION = "0.23.6"
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.4
4
+ version: 0.23.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harvest Team