Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions lib/couchbase/cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -401,20 +401,22 @@ def initialize(connection_string, *args)
end

@observability = Observability::Wrapper.new do |w|
if !(open_options[:enable_tracing].nil? && !open_options[:enable_tracing])
w.tracer = Tracing::NoopTracer.new
elsif tracer.nil?
w.tracer = Tracing::ThresholdLoggingTracer.new(
emit_interval: open_options[:threshold_emit_interval],
kv_threshold: open_options[:key_value_threshold],
query_threshold: open_options[:query_threshold],
views_threshold: open_options[:view_threshold],
search_threshold: open_options[:search_threshold],
analytics_threshold: open_options[:analytics_threshold],
management_threshold: open_options[:management_threshold],
sample_size: open_options[:threshold_sample_size],
)
end
w.tracer = if !(open_options[:enable_tracing].nil? && !open_options[:enable_tracing])
Tracing::NoopTracer.new
elsif tracer.nil?
Tracing::ThresholdLoggingTracer.new(
emit_interval: open_options[:threshold_emit_interval],
kv_threshold: open_options[:key_value_threshold],
query_threshold: open_options[:query_threshold],
views_threshold: open_options[:view_threshold],
search_threshold: open_options[:search_threshold],
analytics_threshold: open_options[:analytics_threshold],
management_threshold: open_options[:management_threshold],
sample_size: open_options[:threshold_sample_size],
)
else
tracer
end
end

@backend = Backend.new
Expand Down
4 changes: 2 additions & 2 deletions test/utils/tracing/test_span.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@

module Couchbase
module TestUtilities
class TestSpan < RequestSpan
class TestSpan < Couchbase::Tracing::RequestSpan
attr_accessor :name
attr_accessor :start_time, :end_time
attr_accessor :attributes
attr_accessor :parent
attr_accessor :children

def initialize(name, parent: nil, start_timestamp: nil)
super
super()
@name = name
@start_time = start_timestamp.nil? ? Time.now : start_timestamp
@parent = parent
Expand Down
2 changes: 1 addition & 1 deletion test/utils/tracing/test_tracer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

module Couchbase
module TestUtilities
class TestTracer < RequestTracer
class TestTracer < Couchbase::Tracing::RequestTracer
def initialize
super
@spans = []
Expand Down
Loading