Skip to content

Commit

Permalink
Rename OpenTelemetry.correlation_context_manager -> OpenTelemetry.cor…
Browse files Browse the repository at this point in the history
…relations
  • Loading branch information
mwear committed Feb 6, 2020
1 parent 5104720 commit 805dfc7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions api/lib/opentelemetry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
module OpenTelemetry
extend self

attr_writer :tracer_factory, :meter_factory, :correlation_context_manager
attr_writer :tracer_factory, :meter_factory, :correlations

attr_accessor :logger

Expand All @@ -48,8 +48,8 @@ def instrumentation_registry
# @return [Object, CorrelationContext::Manager] registered
# correlation context manager or a default no-op implementation of the
# manager.
def correlation_context_manager
@correlation_context_manager ||= CorrelationContext::Manager.new
def correlations
@correlations ||= CorrelationContext::Manager.new
end

# @return [Context::Propagation::Propagation] an instance of the propagation API
Expand Down
20 changes: 10 additions & 10 deletions api/test/opentelemetry_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,27 +66,27 @@
end
end

describe '.correlation_context_manager' do
describe '.correlations' do
after do
# Ensure we don't leak custom correlation_context_manager to other tests
OpenTelemetry.correlation_context_manager = nil
# Ensure we don't leak custom correlations to other tests
OpenTelemetry.correlations = nil
end

it 'returns CorrelationContext::Manager by default' do
manager = OpenTelemetry.correlation_context_manager
manager = OpenTelemetry.correlations
_(manager).must_be_instance_of(OpenTelemetry::CorrelationContext::Manager)
end

it 'returns the same instance when accessed multiple times' do
_(OpenTelemetry.correlation_context_manager).must_equal(
OpenTelemetry.correlation_context_manager
_(OpenTelemetry.correlations).must_equal(
OpenTelemetry.correlations
)
end

it 'returns user specified correlation_context_manager' do
custom_manager = 'a custom correlation_context_manager'
OpenTelemetry.correlation_context_manager = custom_manager
_(OpenTelemetry.correlation_context_manager).must_equal(custom_manager)
it 'returns user specified correlations' do
custom_manager = 'a custom correlations'
OpenTelemetry.correlations = custom_manager
_(OpenTelemetry.correlations).must_equal(custom_manager)
end
end

Expand Down

0 comments on commit 805dfc7

Please sign in to comment.