Skip to content

Commit d3e3c54

Browse files
feat: Set logs exporter default to OTLP (#1857)
The OTLP logs exporter is available on RubyGems. This changes the default to match the other signals.
1 parent 82ef32e commit d3e3c54

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

logs_sdk/lib/opentelemetry/sdk/logs/configurator_patch.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ def configure_log_record_processors
3636
end
3737

3838
def wrapped_log_exporters_from_env
39-
# TODO: set default to OTLP to match traces, default is console until other exporters merged
40-
exporters = ENV.fetch('OTEL_LOGS_EXPORTER', 'console')
39+
exporters = ENV.fetch('OTEL_LOGS_EXPORTER', 'otlp')
4140

4241
exporters.split(',').map do |exporter|
4342
case exporter.strip

logs_sdk/test/opentelemetry/sdk/logs/configurator_patch_test.rb

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,21 @@
3535
end
3636

3737
describe 'processors' do
38-
it 'defaults to a simple processor with a console exporter' do
38+
it 'defaults to a batch processor with an otlp exporter' do
39+
skip 'OTLP exporter not compatible with JRuby' if RUBY_ENGINE == 'jruby'
3940
configurator.configure
4041

4142
processors = OpenTelemetry.logger_provider.instance_variable_get(:@log_record_processors)
4243

4344
assert_equal 1, processors.size
4445
processor = processors[0]
4546

46-
assert_instance_of OpenTelemetry::SDK::Logs::Export::SimpleLogRecordProcessor, processor
47-
assert_instance_of OpenTelemetry::SDK::Logs::Export::ConsoleLogRecordExporter, processor.instance_variable_get(:@log_record_exporter)
47+
assert_instance_of OpenTelemetry::SDK::Logs::Export::BatchLogRecordProcessor, processor
48+
assert_instance_of OpenTelemetry::Exporter::OTLP::Logs::LogsExporter, processor.instance_variable_get(:@exporter)
4849
end
4950

5051
it 'can be set by environment variable' do
51-
skip 'OTLP exporter not compatible with JRuby' if RUBY_ENGINE == 'jruby'
52-
53-
OpenTelemetry::TestHelpers.with_env('OTEL_LOGS_EXPORTER' => 'otlp') do
52+
OpenTelemetry::TestHelpers.with_env('OTEL_LOGS_EXPORTER' => 'console') do
5453
configurator.configure
5554
end
5655

@@ -59,8 +58,8 @@
5958
assert_equal 1, processors.size
6059
processor = processors[0]
6160

62-
assert_instance_of OpenTelemetry::SDK::Logs::Export::BatchLogRecordProcessor, processor
63-
assert_instance_of OpenTelemetry::Exporter::OTLP::Logs::LogsExporter, processor.instance_variable_get(:@exporter)
61+
assert_instance_of OpenTelemetry::SDK::Logs::Export::SimpleLogRecordProcessor, processor
62+
assert_instance_of OpenTelemetry::SDK::Logs::Export::ConsoleLogRecordExporter, processor.instance_variable_get(:@log_record_exporter)
6463
end
6564

6665
it 'supports "none" as an environment variable' do

0 commit comments

Comments
 (0)