class NewRelic::TelemetrySdk::Configurator

The {Configurator} provides the mechanism through which the SDK is configured.

@example

NewRelic::TelemetrySdk.configure do |config|
  config.api_insert_key = ENV["API_KEY"]
end

See {Config} for details on what properties can be configured.

@api public

Public Class Methods

config() click to toggle source
# File lib/newrelic/telemetry_sdk/configurator.rb, line 19
def self.config
  @config ||= Config.new
end
reset() click to toggle source

Removes any configurations that were previously customized, effectively resetting the {Config} state to defaults

@api private

# File lib/newrelic/telemetry_sdk/configurator.rb, line 27
def self.reset
  @config = nil
end

Public Instance Methods

config() click to toggle source

Allows direct access to the config state. The primary purpose of this method is to access config properties throughout the SDK.

@note Unlike configuring with # {#self.configure}, setting config properties here

may, or may not become immediately active.  Use with care.

@api public

# File lib/newrelic/telemetry_sdk/configurator.rb, line 38
def config
  Configurator.config
end
configure() click to toggle source

Set Telemetry SDK configuration with a block. See {Config} for options.

@example Setting the API Key

NewRelic::TelemetrySdk.configure do |config|
  config.api_insert_key = ENV["API_KEY"]
end

@api public

# File lib/newrelic/telemetry_sdk/configurator.rb, line 51
def configure
  Logger.logger = config.logger
end

Private Instance Methods

method_missing(method, *args, &block) click to toggle source

Delegates any setter methods to the Config object if it responds to such. All other missing methods are propagated up the chain.

Calls superclass method
# File lib/newrelic/telemetry_sdk/configurator.rb, line 59
def method_missing method, *args, &block
  if method.to_s =~ /\=$/ && config.respond_to?(method)
    config.send method, *args, &block
  else
    super
  end
end