Skip to content

Commit e70ed65

Browse files
authored
docs: add function doc for config_overrides_from_env (#1021)
* doc: add function doc for config_overrides_from_env * docs: lint
1 parent d80a9f3 commit e70ed65

File tree

1 file changed

+12
-0
lines changed
  • instrumentation/base/lib/opentelemetry/instrumentation

1 file changed

+12
-0
lines changed

instrumentation/base/lib/opentelemetry/instrumentation/base.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,18 @@ def enabled_by_env_var?
326326
ENV[var_name] != 'false'
327327
end
328328

329+
# Checks to see if the user has passed any environment variables that set options
330+
# for instrumentation. By convention, the environment variable will be the name
331+
# of the instrumentation, uppercased, with '::' replaced by underscores,
332+
# OPENTELEMETRY shortened to OTEL_{LANG}, and _CONFIG_OPTS appended.
333+
# For example, the environment variable name for OpenTelemetry::Instrumentation::Faraday
334+
# will be OTEL_RUBY_INSTRUMENTATION_FARADAY_CONFIG_OPTS. A value of 'peer_service=new_service;'
335+
# will override the options set from ::OpenTelemetry::SDK.configure do |c| ... end for Faraday.
336+
#
337+
# For an array option, simply separate the values with commas (e.g., option=a,b,c,d).
338+
# For a boolean option, set the value to true or false (e.g., option=true).
339+
# For integer, string, enum, set the value as a string (e.g., option=string).
340+
# Callable options are not allowed to be set through environment variables.
329341
def config_overrides_from_env
330342
var_name = name.dup.tap do |n|
331343
n.upcase!

0 commit comments

Comments
 (0)