Plugin Helper: Service Discovery
require 'fluent/plugin/output'
module Fluent::Plugin
class ExampleOutput < Output
Fluent::Plugin.register_output('example', self)
# 1. Load service_discovery helper
helpers :service_discovery
def configure(conf)
super
# 2. Create and start service discovery manager
service_discovery_configure(
:out_example_service_discovery_watcher,
static_default_service_directive: 'server'
)
end
def write(chunk)
# 3. Select service to send data
service_discovery_select_service do |node|
send_data(node, chunk)
end
end
def send_data(node, chunk)
# Send data
end
end
endMethods
service_discovery_configure(title, static_default_service_directive: nil, load_balancer: nil, custom_build_method: nil, interval: 3)
service_discovery_configure(title, static_default_service_directive: nil, load_balancer: nil, custom_build_method: nil, interval: 3)Parameters
service_discovery_create_manager(title, configurations:, load_balancer: nil, custom_build_method: nil, interval: 3)
service_discovery_create_manager(title, configurations:, load_balancer: nil, custom_build_method: nil, interval: 3)Parameters
discovery_manager
discovery_managerPlugins using service_discovery
service_discoveryMigration guide from service_discovery_create_manager to more simpler helper method
service_discovery_create_manager to more simpler helper methodLast updated
Was this helpful?