Documentation ¶
Overview ¶
Package discovery defines interfaces for service discovery.
Package discovery manages and runs service discovery and saves target configuration files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Factory ¶
type Factory interface { // Create creates a new Source ready for collection. Create() (Source, error) }
Factory defines the interface for creating new Source instances.
type Manager ¶
Manager executes service discovery then serializes and writes targets to disk.
func NewManager ¶
NewManager creates a new manager instance. When calling Run, each registered service should take no longer than Timeout.
type Service ¶
type Service interface { // Discover identifies and returns StaticConfig targets from a third-party // service. Discover(ctx context.Context) ([]StaticConfig, error) }
Service collects target configurations for the discovery Manager.
type Source ¶
type Source interface { // Collect retrieves all targets from a source. Collect() error // Save writes the targets to the named file. Save() error }
Source defines the interface for collecting targets from various services. New services should implement this interface.
type StaticConfig ¶
type StaticConfig struct { // Targets is a list of targets identified by a label set. Each target is // uniquely identifiable in the group by its address label. Targets []string `json:"targets"` // Labels is a set of keys/values that are common across all targets in the // StaticConfig. Labels map[string]string `json:"labels,omitempty"` }
StaticConfig represents a set of targets and associated labels. StaticConfig serializes to the "file_sd_config" format. https://prometheus.io/docs/prometheus/latest/configuration/configuration/#<file_sd_config>