Class: Aspecto::OpenTelemetry::Config::RemoteConfig
- Inherits:
-
Object
- Object
- Aspecto::OpenTelemetry::Config::RemoteConfig
- Defined in:
- lib/aspecto/opentelemetry/config/remote_config.rb
Overview
Handle fetching of remote configuration from aspecto
Instance Method Summary collapse
-
#initialize(aspecto_auth, service_name, env, fallback_sampler) ⇒ RemoteConfig
constructor
A new instance of RemoteConfig.
- #shutdown ⇒ Object
Constructor Details
#initialize(aspecto_auth, service_name, env, fallback_sampler) ⇒ RemoteConfig
Returns a new instance of RemoteConfig.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/aspecto/opentelemetry/config/remote_config.rb', line 16 def initialize(aspecto_auth, service_name, env, fallback_sampler) @service_name = service_name @env = env @error_reported = false @got_remote_config = false @fallback_sampler = fallback_sampler aspecto_config_host = ENV.fetch("ASPECTO_CONFIG_HOST", "https://config.aspecto.io") @aspecto_config_url = URI("#{aspecto_config_host}/config/#{aspecto_auth}") init_http_client @scheduler = Rufus::Scheduler.new @remote_config_poll_frequency = ENV.fetch("ASPECTO_REMOTE_CONFIG_POLL_FREQUENCY", "30s") @scheduler.interval @remote_config_poll_frequency, first: :now do update_config end ::OpenTelemetry.logger.info "[Aspecto] initialized remote config polling" rescue StandardError => e ::OpenTelemetry.logger.error "[Aspecto] failed to initialize remote config polling" ::OpenTelemetry.logger.error e end |
Instance Method Details
#shutdown ⇒ Object
38 39 40 |
# File 'lib/aspecto/opentelemetry/config/remote_config.rb', line 38 def shutdown @scheduler.shutdown end |