Skip to content

Commit

Permalink
Simplify SDK setup in adapter tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mwear committed Jan 25, 2020
1 parent 742db83 commit 95996da
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
13 changes: 6 additions & 7 deletions adapters/faraday/test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
require 'webmock/minitest'

# global opentelemetry-sdk setup:
sdk = OpenTelemetry::SDK
exporter = sdk::Trace::Export::InMemorySpanExporter.new
span_processor = sdk::Trace::Export::SimpleSpanProcessor.new(exporter)
OpenTelemetry.tracer_factory = sdk::Trace::TracerFactory.new.tap do |factory|
factory.add_span_processor(span_processor)
end
# global opentelemetry-sdk setup:
EXPORTER = OpenTelemetry::SDK::Trace::Export::InMemorySpanExporter.new
span_processor = OpenTelemetry::SDK::Trace::Export::SimpleSpanProcessor.new(EXPORTER)

EXPORTER = exporter
OpenTelemetry::SDK.configure do |c|
c.add_span_processor span_processor
end
12 changes: 5 additions & 7 deletions adapters/sinatra/test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@
require 'rack/test'

# global opentelemetry-sdk setup:
sdk = OpenTelemetry::SDK
exporter = sdk::Trace::Export::InMemorySpanExporter.new
span_processor = sdk::Trace::Export::SimpleSpanProcessor.new(exporter)
OpenTelemetry.tracer_factory = sdk::Trace::TracerFactory.new.tap do |factory|
factory.add_span_processor(span_processor)
end
EXPORTER = OpenTelemetry::SDK::Trace::Export::InMemorySpanExporter.new
span_processor = OpenTelemetry::SDK::Trace::Export::SimpleSpanProcessor.new(EXPORTER)

EXPORTER = exporter
OpenTelemetry::SDK.configure do |c|
c.add_span_processor span_processor
end

0 comments on commit 95996da

Please sign in to comment.