bitfab 0.78.10 → 0.78.11

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: f185f00d0b6cb48f6bf55a0625c0ed583e639c091cba9010ba6a28d4c287c1f4
4
- data.tar.gz: 11a46eb11c933ef9b477e191dbcb5127c67467b2f152374e61de5860cdc03b29
3
+ metadata.gz: 61f325bf163155e9ff6ddb649a5ad1cb3f8687ab3bff887a725a7f6eecc72e6a
4
+ data.tar.gz: e2b85c43fc71385d12dca8228e323412a011eaa28c9369288c752e36f4e61889
5
5
  SHA512:
6
- metadata.gz: 30be2ce168d093f42a384a2e51cec42407ddc4c3e26363ea2e4404d106c0aee07bd141c3d2b1d466b4052ec48b1b9fa4f0ad808d818a1ea733ab96141a015ed6
7
- data.tar.gz: 18e1df4d05fc848e9449bbb3d3d661a4b890d391e6e2bfbf58ad98359dd5f92d3a106b6a9436ae527fa9bc7a39c791f95570dfd38183efbf8878532ea16e759e
6
+ metadata.gz: 4c51c4cbd52cc57f2da4101d82d480e750dd1390c300720826606d6b7110932ccd3cedb4e0a4a493c638f4c36ca5296f1d97e5a943ddd1e82e78620eb30d22d4
7
+ data.tar.gz: b180018b46bc7c4da55216af1fbfb893cc1b08d8dca57577af2b68bef48f4ef9092e201f977530c6911dab64525e213d43fd9a68a63871842a848d87f4c95ec2
@@ -63,7 +63,8 @@ module Bitfab
63
63
  :prompt,
64
64
  :metadata,
65
65
  :jev_started_at,
66
- :jev_recorded_below
66
+ :jev_recorded_below,
67
+ :nearest_captured_ancestor_span_id
67
68
  )
68
69
 
69
70
  module_function
@@ -607,6 +608,7 @@ module Bitfab
607
608
  entry = OpenSpan.new(
608
609
  span_id: SecureRandom.uuid,
609
610
  parent_span_id: current_parent_span_id,
611
+ nearest_captured_ancestor_span_id: nearest_captured_ancestor_span_id(@stacks[Fiber.current.object_id] || [], Fiber.current.object_id),
610
612
  name:, span_type: type, args:, kwargs:, experiment_id:, started_at: now,
611
613
  span_data: {}, declared_node: true
612
614
  )
@@ -638,6 +640,7 @@ module Bitfab
638
640
  parent = @fiber_parents[parent_fiber_id]
639
641
  @fiber_parents[fiber_id] = {
640
642
  span_id: stack.reverse_each.find { |entry| entry.span_id }&.span_id || parent&.dig(:span_id) || @root_span_id,
643
+ nearest_captured_ancestor_span_id: nearest_captured_ancestor_span_id(stack, parent_fiber_id),
641
644
  depth: local_depth(stack) + parent&.dig(:depth).to_i
642
645
  }
643
646
  end
@@ -750,6 +753,7 @@ module Bitfab
750
753
  identity: metadata.identity,
751
754
  span_id:,
752
755
  parent_span_id:,
756
+ nearest_captured_ancestor_span_id: nearest_captured_ancestor_span_id(stack, fiber_id, active_parent_span_id),
753
757
  name: metadata.name,
754
758
  args:,
755
759
  kwargs:,
@@ -836,6 +840,7 @@ module Bitfab
836
840
  trace_id: @trace_id,
837
841
  span_id: entry.span_id,
838
842
  parent_span_id: entry.parent_span_id,
843
+ nearest_captured_ancestor_span_id: entry.nearest_captured_ancestor_span_id,
839
844
  span_name: entry.name,
840
845
  span_type: entry.span_type || "function",
841
846
  instrumentation: "trace",
@@ -859,6 +864,15 @@ module Bitfab
859
864
  nil
860
865
  end
861
866
 
867
+ def nearest_captured_ancestor_span_id(stack, fiber_id, active_parent_span_id = nil)
868
+ stack.reverse_each.find { |entry| entry.span_id && sent_on_completion?(entry) }&.span_id ||
869
+ @fiber_parents.dig(fiber_id, :nearest_captured_ancestor_span_id) || active_parent_span_id || @root_span_id
870
+ end
871
+
872
+ def sent_on_completion?(entry)
873
+ entry.is_a?(Boundary) || entry.declared_node == true || !content_off?(entry.name)
874
+ end
875
+
862
876
  def inputs(event)
863
877
  args = []
864
878
  kwargs = {}
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bitfab
4
- VERSION = "0.78.10"
4
+ VERSION = "0.78.11"
5
5
  end
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.78.10
4
+ version: 0.78.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harvest Team