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.
467 468 469 470 |
# File 'lib/bitfab/client.rb', line 467 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.
465 466 467 |
# File 'lib/bitfab/client.rb', line 465 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`.
490 491 492 493 494 495 496 497 |
# File 'lib/bitfab/client.rb', line 490 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 |