Class: Bitfab::BitfabFunction
- Inherits:
-
Object
- Object
- Bitfab::BitfabFunction
- Defined in:
- lib/bitfab/client.rb
Overview
Fluent wrapper bound to a single trace_function_key. Mirrors
BitfabFunction in the Python SDK and BitfabFunction in the TypeScript
SDK: lets callers wrap multiple methods without repeating the key.
Instance Attribute Summary collapse
-
#trace_function_key ⇒ Object
readonly
Returns the value of attribute trace_function_key.
Instance Method Summary collapse
-
#initialize(client, trace_function_key) ⇒ BitfabFunction
constructor
A new instance of BitfabFunction.
-
#wrap(klass, method_name, name: nil, type: "custom", mock_on_replay: false) ⇒ Object
Wrap an existing method on a class with span tracing, binding this function's trace_function_key.
Constructor Details
#initialize(client, trace_function_key) ⇒ BitfabFunction
Returns a new instance of BitfabFunction.
654 655 656 657 |
# File 'lib/bitfab/client.rb', line 654 def initialize(client, trace_function_key) @client = client @trace_function_key = trace_function_key end |
Instance Attribute Details
#trace_function_key ⇒ Object (readonly)
Returns the value of attribute trace_function_key.
652 653 654 |
# File 'lib/bitfab/client.rb', line 652 def trace_function_key @trace_function_key end |
Instance Method Details
#wrap(klass, method_name, name: nil, type: "custom", mock_on_replay: false) ⇒ Object
Wrap an existing method on a class with span tracing, binding this function's trace_function_key.
Routes spans through the client this function was created from (matches
Python's BitfabFunction.span() using self._client.span(...) and
TypeScript's BitfabFunction.withSpan() using this.client.withSpan(...)),
so non-global Bitfab::Client instances don't silently fall back to
Bitfab.client.
677 678 679 680 681 682 683 684 |
# File 'lib/bitfab/client.rb', line 677 def wrap(klass, method_name, name: nil, type: "custom", mock_on_replay: false) Bitfab::Traceable.wrap( klass, method_name, trace_function_key: @trace_function_key, name:, type:, mock_on_replay:, client: @client ) end |