Skip to content

Commit

Permalink
doc: add function doc for config_overrides_from_env
Browse files Browse the repository at this point in the history
  • Loading branch information
xuan-cao-swi committed Jun 17, 2024
1 parent d80a9f3 commit 416a5f0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions instrumentation/base/lib/opentelemetry/instrumentation/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,18 @@ def enabled_by_env_var?
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!
Expand Down

0 comments on commit 416a5f0

Please sign in to comment.