lib/opentelemetry/instrumentation/base.rb in opentelemetry-instrumentation-base-0.22.3 vs lib/opentelemetry/instrumentation/base.rb in opentelemetry-instrumentation-base-0.22.4
- old
+ new
@@ -324,9 +324,21 @@
n << '_ENABLED'
end
ENV[var_name] != 'false'
end
+ # Checks to see if the user has passed any environment variables that set options
+ # for instrumentation. By convention, the environment variable will be the name
+ # of the instrumentation, uppercased, with '::' replaced by underscores,
+ # OPENTELEMETRY shortened to OTEL_{LANG}, and _CONFIG_OPTS appended.
+ # For example, the environment variable name for OpenTelemetry::Instrumentation::Faraday
+ # will be OTEL_RUBY_INSTRUMENTATION_FARADAY_CONFIG_OPTS. A value of 'peer_service=new_service;'
+ # will override the options set from ::OpenTelemetry::SDK.configure do |c| ... end for Faraday.
+ #
+ # For an array option, simply separate the values with commas (e.g., option=a,b,c,d).
+ # For a boolean option, set the value to true or false (e.g., option=true).
+ # For integer, string, enum, set the value as a string (e.g., option=string).
+ # Callable options are not allowed to be set through environment variables.
def config_overrides_from_env
var_name = name.dup.tap do |n|
n.upcase!
n.gsub!('::', '_')
n.gsub!('OPENTELEMETRY_', 'OTEL_RUBY_')