class NewRelic::TelemetrySdk::Config

This class allows setting configuration options for the Telemetry SDK via NewRelic::TelemetrySdk.configure.

@example Setting the API Key

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

@api public

Constants

DEFAULT_BACKOFF_FACTOR

Default backoff strategy factorial

DEFAULT_BACKOFF_MAX

Default maximum backoff wait time in seconds

DEFAULT_HARVEST_INTERVAL

Default harvest interval in seconds

DEFAULT_MAX_RETRIES

Default number of retries to send same data

DEFAULT_TRACE_API_HOST

Default host for the Trace Client

Attributes

api_insert_key[RW]

@!attribute api_insert_key [optional, String] A New Relic Insert API key. Necessary for sending data to New Relic via the Telemetry SDK. Defaults to API_INSERT_KEY environment variable. @see docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#event-insert-key Types of New Relic API keys: Insert API key

audit_logging_enabled[RW]

@!attribute audit_logging_enabled [optional, Boolean] If audit logging is enabled, the contents of every payload sent to New Relic will be recorded in logs. This is a very verbose log level for debugging purposes.

backoff_factor[RW]

@!attribute backoff_factor [optional, Integer] The amount of time (in seconds) to wait after sending data to New Relic fails before attempting to send again. Defaults to {DEFAULT_HARVEST_INTERVAL} seconds.

backoff_max[RW]

@!attribute backoff_max [optional, Integer] If data cannot be sent to New Relic intermittently, the SDK will retry the request at increasing intervals, but will stop increasing the retry intervals when they have reached backoff_max seconds. Defaults to {DEFAULT_BACKOFF_MAX} seconds. @see github.com/newrelic/newrelic-telemetry-sdk-specs/blob/master/communication.md#graceful-degradation Graceful Degradation

harvest_interval[RW]

@!attribute harvest_interval [optional, Integer] The frequency of automatic harvest (in seconds) if sending data with a harvester. Defaults to {DEFAULT_HARVEST_INTERVAL} seconds.

logger[RW]

@!attribute logger [optional, Logger] A Logger object customized with your preferred log output destination (if any) and log level.

max_retries[RW]

@!attribute max_retries [optional, Integer] The maximum number of times to retry sending data to New Relic. Defaults to {DEFAULT_MAX_RETRIES}.

trace_api_host[RW]

@!attribute trace_api_host [optional, String] An alternative New Relic host URL where spans can be sent. Defaults to {DEFAULT_TRACE_API_HOST}

Public Class Methods

new() click to toggle source

@api private

# File lib/newrelic/telemetry_sdk/config.rb, line 84
def initialize
  @api_insert_key = ENV[API_INSERT_KEY]
  @logger = Logger.logger
  @audit_logging_enabled = false

  @harvest_interval = DEFAULT_HARVEST_INTERVAL
  @backoff_factor = DEFAULT_BACKOFF_FACTOR
  @backoff_max = DEFAULT_BACKOFF_MAX
  @max_retries = DEFAULT_MAX_RETRIES
  @trace_api_host = DEFAULT_TRACE_API_HOST
end