Module: OrangeTap
- Defined in:
- lib/orange_tap.rb,
lib/orange_tap/event.rb,
lib/orange_tap/config.rb,
lib/orange_tap/worker.rb,
lib/orange_tap/session.rb,
lib/orange_tap/version.rb,
lib/orange_tap/pending_span.rb,
lib/orange_tap/otel_converter.rb,
lib/orange_tap/method_registry.rb,
sig/orange_tap.rbs
Defined Under Namespace
Modules: OtelConverter
Classes: AlreadyOpenError, Config, Error, Event, MethodRegistry, NotOpenError, PendingSpan, Session, UntraceableMethodError, Worker
Constant Summary
collapse
- VERSION =
"0.1.0"
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
30
31
32
|
# File 'lib/orange_tap.rb', line 30
def config
@config ||= Config.new
end
|
.default_registry ⇒ Object
26
27
28
|
# File 'lib/orange_tap.rb', line 26
def default_registry
@default_registry ||= MethodRegistry.new
end
|
.new(**opts) ⇒ Object
OrangeTap.new -> Session, so tape = OrangeTap.new; tape.open; ...; tape.stop
reads like constructing a recorder, while OrangeTap itself stays a module.
22
23
24
|
# File 'lib/orange_tap.rb', line 22
def new(**opts)
Session.new(**opts)
end
|
.open(&block) ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/orange_tap.rb', line 49
def open(&block)
tape = new
tape.open
return tape unless block
begin
block.call
tape.stop
rescue Exception begin
tape.stop
rescue StandardError
nil
end
raise
end
end
|
.trace_all_instance_methods(klass) ⇒ Object
45
46
47
|
# File 'lib/orange_tap.rb', line 45
def trace_all_instance_methods(klass)
default_registry.register_all_instance_methods(klass)
end
|
.trace_method(*method_objs) ⇒ Object
Accepts one or more Method/UnboundMethod objects, or notation strings
("Foo.bar" for a class/singleton method, "Foo#bar" for an instance
method), and registers them all in a single call.
37
38
39
|
# File 'lib/orange_tap.rb', line 37
def trace_method(*method_objs)
default_registry.register(*method_objs)
end
|
.untrace_method(*method_objs) ⇒ Object
41
42
43
|
# File 'lib/orange_tap.rb', line 41
def untrace_method(*method_objs)
default_registry.unregister(*method_objs)
end
|