lib/ldclient-rb/config.rb in launchdarkly-server-sdk-8.3.1 vs lib/ldclient-rb/config.rb in launchdarkly-server-sdk-8.4.0
- old
+ new
@@ -41,10 +41,11 @@
# @option opts [String] :wrapper_version See {#wrapper_version}.
# @option opts [#open] :socket_factory See {#socket_factory}.
# @option opts [BigSegmentsConfig] :big_segments See {#big_segments}.
# @option opts [Hash] :application See {#application}
# @option opts [String] :payload_filter_key See {#payload_filter_key}
+ # @option hooks [Array<Interfaces::Hooks::Hook]
#
def initialize(opts = {})
@base_uri = (opts[:base_uri] || Config.default_base_uri).chomp("/")
@stream_uri = (opts[:stream_uri] || Config.default_stream_uri).chomp("/")
@events_uri = (opts[:events_uri] || Config.default_events_uri).chomp("/")
@@ -73,10 +74,11 @@
@wrapper_version = opts[:wrapper_version]
@socket_factory = opts[:socket_factory]
@big_segments = opts[:big_segments] || BigSegmentsConfig.new(store: nil)
@application = LaunchDarkly::Impl::Util.validate_application_info(opts[:application] || {}, @logger)
@payload_filter_key = opts[:payload_filter_key]
+ @hooks = (opts[:hooks] || []).keep_if { |hook| hook.is_a? Interfaces::Hooks::Hook }
@data_source_update_sink = nil
end
#
# Returns the component that allows a data source to push data into the SDK.
@@ -369,9 +371,20 @@
#
# Defaults to nil.
# @return [#open]
#
attr_reader :socket_factory
+
+ #
+ # Initial set of hooks for the client.
+ #
+ # Hooks provide entrypoints which allow for observation of SDK functions.
+ #
+ # LaunchDarkly provides integration packages, and most applications will not
+ # need to implement their own hooks. Refer to the `launchdarkly-server-sdk-otel` gem
+ # for instrumentation.
+ #
+ attr_reader :hooks
#
# The default LaunchDarkly client configuration. This configuration sets
# reasonable defaults for most users.
# @return [Config] The default LaunchDarkly configuration.