Plugin Helper: Service Discovery
The service_discovery
plugin helper provides users with the service discovery functionality.
Example:
NOTE: The launched plugin itself is managed by its plugin helper which stops it automatically. No need to stop it in the stop
method.
Methods
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)
Since v1.13.0, discovery_manager
is almost automatically configured only by calling this method.
Parameters
title
: Thread name. Must be unique. (required)static_default_service_directive
: The directive name of each service when "static" service discovery is enabled in default.load_balancer
: object which has two methods #rebalance and #select_service.custom_build_method
: The custom method to build the service.interval
: Time interval for updating target service.
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)
This method creates service_discovery_manager
.
Parameters
title
: Thread name. Must be unique. (required)configurations
: Configuration of target service. (required)load_balancer
: Balancing load to target servers. (default: Round-Robin)custom_build_method
: The custom method to build the service.interval
: Time interval for updating target service.
discovery_manager
discovery_manager
It manages service discovery functionalities such as updating target services and selecting target services. It provides the select_service
method that returns a target service to send data.
Plugins using service_discovery
service_discovery
Migration guide from service_discovery_create_manager
to more simpler helper method
service_discovery_create_manager
to more simpler helper methodHere is the guide to migrate to newer API which is available since v1.13.0.
Example:
You can also use helper methods such as service_discovery_services
or service_discovery_rebalance
instead of @discovery_manager.services
or @discovery_manager.rebalance
.
If this article is incorrect or outdated, or omits critical information, please let us know. Fluentd is an open-source project under Cloud Native Computing Foundation (CNCF). All components are available under the Apache 2 License.
Last updated