Skip to content

Commit

Permalink
Fix no-op implementation for ContextManager
Browse files Browse the repository at this point in the history
  • Loading branch information
jterapin committed Aug 22, 2024
1 parent 680b8c9 commit 4e70e58
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hearth/lib/hearth/telemetry/no_op.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ def record_exception(exception, attributes: nil); end
class NoOpContextManager < ContextManagerBase
def current; end

def current_span; end
def current_span
NoOpSpan.new
end

def attach(context); end

Expand Down
9 changes: 9 additions & 0 deletions hearth/spec/hearth/telemetry/no_op_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,14 @@ module Telemetry
end
end
end

describe NoOpContextManager do
describe '#current_span' do
it 'returns an instance of no-op span' do
expect(subject.current_span)
.to be_an_instance_of(Hearth::Telemetry::NoOpSpan)
end
end
end
end
end

0 comments on commit 4e70e58

Please sign in to comment.