Skip to content

Commit 40f4b9a

Browse files
committed
chore: Rename skip_instrumenting to skip_otel_emit
1 parent 8f9038c commit 40f4b9a

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

instrumentation/logger/lib/opentelemetry/instrumentation/logger/patches/active_support_broadcast_logger.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ def unknown(*args)
4141
private
4242

4343
# Emit logs from only one of the loggers in the broadcast.
44-
# Set @skip_instrumenting to `true` to the rest of the loggers before emitting the logs.
45-
# Set @skip_instrumenting to `false` after the log is emitted.
44+
# Set @skip_otel_emit to `true` to the rest of the loggers before emitting the logs.
45+
# Set @skip_otel_emit to `false` after the log is emitted.
4646
def emit_one_broadcast(*args)
47-
broadcasts[1..-1].each { |broadcasted_logger| broadcasted_logger.instance_variable_set(:@skip_instrumenting, true) }
47+
broadcasts[1..-1].each { |broadcasted_logger| broadcasted_logger.instance_variable_set(:@skip_otel_emit, true) }
4848
yield
49-
broadcasts.each { |broadcasted_logger| broadcasted_logger.instance_variable_set(:@skip_instrumenting, false) }
49+
broadcasts.each { |broadcasted_logger| broadcasted_logger.instance_variable_set(:@skip_otel_emit, false) }
5050
end
5151
end
5252
end

instrumentation/logger/lib/opentelemetry/instrumentation/logger/patches/active_support_logger.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module ActiveSupportLogger
1515
# destinations from generating OpenTelemetry log record objects.
1616
# Available in Rails 7.0 and below
1717
def broadcast(logger)
18-
logger.instance_variable_set(:@skip_instrumenting, true)
18+
logger.instance_variable_set(:@skip_otel_emit, true)
1919
super
2020
end
2121
end

instrumentation/logger/lib/opentelemetry/instrumentation/logger/patches/logger.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ module Logger
1010
module Patches
1111
# Instrumention for methods from Ruby's Logger class
1212
module Logger
13-
attr_writer :skip_instrumenting
13+
attr_writer :skip_otel_emit
1414

1515
def format_message(severity, datetime, progname, msg)
1616
formatted_message = super
17-
return formatted_message if skip_instrumenting?
17+
return formatted_message if skip_otel_emit?
1818

1919
OpenTelemetry.logger_provider.logger(
2020
name: OpenTelemetry::Instrumentation::Logger::NAME,
@@ -31,8 +31,8 @@ def format_message(severity, datetime, progname, msg)
3131

3232
private
3333

34-
def skip_instrumenting?
35-
@skip_instrumenting || false
34+
def skip_otel_emit?
35+
@skip_otel_emit || false
3636
end
3737

3838
def severity_number(severity)

instrumentation/logger/test/opentelemetry/instrumentation/logger/patches/active_support_logger_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@
4545
assert_match(/#{msg}/, log_record.body)
4646
end
4747

48-
it 'does not add @skip_instrumenting to the initial logger' do
49-
refute Rails.logger.instance_variable_defined?(:@skip_instrumenting)
48+
it 'does not add @skip_otel_emit to the initial logger' do
49+
refute Rails.logger.instance_variable_defined?(:@skip_otel_emit)
5050
end
5151

52-
it 'adds @skip_instrumenting to broadcasted loggers' do
53-
assert broadcasted_logger.instance_variable_defined?(:@skip_instrumenting)
52+
it 'adds @skip_otel_emit to broadcasted loggers' do
53+
assert broadcasted_logger.instance_variable_defined?(:@skip_otel_emit)
5454
end
5555
end
5656
end

instrumentation/logger/test/opentelemetry/instrumentation/logger/patches/logger_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
end
5050
end
5151

52-
it 'does not emit when @skip_instrumenting is true' do
53-
ruby_logger.instance_variable_set(:@skip_instrumenting, true)
52+
it 'does not emit when @skip_otel_emit is true' do
53+
ruby_logger.instance_variable_set(:@skip_otel_emit, true)
5454
ruby_logger.debug(msg)
5555
assert_nil(log_record)
5656
end

0 commit comments

Comments
 (0)