Documentation ¶
Overview ¶
Package listeners is a wrapper that registers the available autodiscovery listerners.
Index ¶
- Variables
- func Register(name string, factory ServiceListenerFactory, ...)
- func RegisterListeners(serviceListenerFactories map[string]ServiceListenerFactory, ...)
- type Config
- type ContainerListener
- type ContainerPort
- type EnvironmentListener
- type EnvironmentService
- func (s *EnvironmentService) FilterTemplates(configs map[string]integration.Config)
- func (s *EnvironmentService) GetADIdentifiers(context.Context) ([]string, error)
- func (s *EnvironmentService) GetCheckNames(context.Context) []string
- func (s *EnvironmentService) GetExtraConfig(key string) (string, error)
- func (s *EnvironmentService) GetHostname(context.Context) (string, error)
- func (s *EnvironmentService) GetHosts(context.Context) (map[string]string, error)
- func (s *EnvironmentService) GetPid(context.Context) (int, error)
- func (s *EnvironmentService) GetPorts(context.Context) ([]ContainerPort, error)
- func (s *EnvironmentService) GetServiceID() string
- func (s *EnvironmentService) GetTaggerEntity() string
- func (s *EnvironmentService) GetTags() ([]string, error)
- func (s *EnvironmentService) HasFilter(filter containers.FilterType) bool
- func (s *EnvironmentService) IsReady(context.Context) bool
- type KubeletListener
- type SNMPListener
- type SNMPService
- func (s *SNMPService) FilterTemplates(configs map[string]integration.Config)
- func (s *SNMPService) GetADIdentifiers(context.Context) ([]string, error)
- func (s *SNMPService) GetCheckNames(context.Context) []string
- func (s *SNMPService) GetExtraConfig(key string) (string, error)
- func (s *SNMPService) GetHostname(context.Context) (string, error)
- func (s *SNMPService) GetHosts(context.Context) (map[string]string, error)
- func (s *SNMPService) GetPid(context.Context) (int, error)
- func (s *SNMPService) GetPorts(context.Context) ([]ContainerPort, error)
- func (s *SNMPService) GetServiceID() string
- func (s *SNMPService) GetTaggerEntity() string
- func (s *SNMPService) GetTags() ([]string, error)
- func (s *SNMPService) HasFilter(filter containers.FilterType) bool
- func (s *SNMPService) IsReady(context.Context) bool
- type Service
- type ServiceListener
- func NewContainerListener(_ Config, wmeta optional.Option[workloadmeta.Component]) (ServiceListener, error)
- func NewEnvironmentListener(Config) (ServiceListener, error)
- func NewKubeletListener(_ Config, wmeta optional.Option[workloadmeta.Component]) (ServiceListener, error)
- func NewSNMPListener(Config) (ServiceListener, error)
- func NewStaticConfigListener(Config) (ServiceListener, error)
- type ServiceListenerFactory
- type StaticConfigListener
- type StaticConfigService
- func (s *StaticConfigService) FilterTemplates(configs map[string]integration.Config)
- func (s *StaticConfigService) GetADIdentifiers(context.Context) ([]string, error)
- func (s *StaticConfigService) GetCheckNames(context.Context) []string
- func (s *StaticConfigService) GetExtraConfig(key string) (string, error)
- func (s *StaticConfigService) GetHostname(context.Context) (string, error)
- func (s *StaticConfigService) GetHosts(context.Context) (map[string]string, error)
- func (s *StaticConfigService) GetPid(context.Context) (int, error)
- func (s *StaticConfigService) GetPorts(context.Context) ([]ContainerPort, error)
- func (s *StaticConfigService) GetServiceID() string
- func (s *StaticConfigService) GetTaggerEntity() string
- func (s *StaticConfigService) GetTags() ([]string, error)
- func (s *StaticConfigService) HasFilter(filter containers.FilterType) bool
- func (s *StaticConfigService) IsReady(context.Context) bool
Constants ¶
This section is empty.
Variables ¶
var ErrNotSupported = errors.New("AD: variable not supported by listener")
ErrNotSupported is thrown if listener doesn't support the asked variable
Functions ¶
func Register ¶
func Register(name string, factory ServiceListenerFactory, serviceListenerFactories map[string]ServiceListenerFactory)
Register registers a service listener factory
func RegisterListeners ¶
func RegisterListeners(serviceListenerFactories map[string]ServiceListenerFactory, wmeta optional.Option[workloadmeta.Component])
RegisterListeners registers the available autodiscovery listerners.
Types ¶
type ContainerListener ¶
type ContainerListener struct {
// contains filtered or unexported fields
}
ContainerListener listens to container creation through a subscription to the workloadmeta store.
type ContainerPort ¶
ContainerPort represents a network port in a Service.
type EnvironmentListener ¶
type EnvironmentListener struct {
// contains filtered or unexported fields
}
EnvironmentListener implements a ServiceListener based on current environment
func (*EnvironmentListener) Listen ¶
func (l *EnvironmentListener) Listen(newSvc chan<- Service, delSvc chan<- Service)
Listen starts the goroutine to detect checks based on environment
func (*EnvironmentListener) Stop ¶
func (l *EnvironmentListener) Stop()
Stop has nothing to do in this case
type EnvironmentService ¶
type EnvironmentService struct {
// contains filtered or unexported fields
}
EnvironmentService represents services generated from EnvironmentListener
func (*EnvironmentService) FilterTemplates ¶
func (s *EnvironmentService) FilterTemplates(configs map[string]integration.Config)
FilterTemplates does nothing.
func (*EnvironmentService) GetADIdentifiers ¶
func (s *EnvironmentService) GetADIdentifiers(context.Context) ([]string, error)
GetADIdentifiers return the single AD identifier for an environment service
func (*EnvironmentService) GetCheckNames ¶
func (s *EnvironmentService) GetCheckNames(context.Context) []string
GetCheckNames is not supported
func (*EnvironmentService) GetExtraConfig ¶
func (s *EnvironmentService) GetExtraConfig(key string) (string, error)
GetExtraConfig is not supported
func (*EnvironmentService) GetHostname ¶
func (s *EnvironmentService) GetHostname(context.Context) (string, error)
GetHostname returns nil and an error because port is not supported in this listener
func (*EnvironmentService) GetPid ¶
func (s *EnvironmentService) GetPid(context.Context) (int, error)
GetPid inspect the container and return its pid Not relevant in this listener
func (*EnvironmentService) GetPorts ¶
func (s *EnvironmentService) GetPorts(context.Context) ([]ContainerPort, error)
GetPorts returns nil and an error because port is not supported in this listener
func (*EnvironmentService) GetServiceID ¶
func (s *EnvironmentService) GetServiceID() string
GetServiceID returns the unique entity name linked to that service
func (*EnvironmentService) GetTaggerEntity ¶
func (s *EnvironmentService) GetTaggerEntity() string
GetTaggerEntity returns the tagger entity
func (*EnvironmentService) GetTags ¶
func (s *EnvironmentService) GetTags() ([]string, error)
GetTags retrieves a container's tags
func (*EnvironmentService) HasFilter ¶
func (s *EnvironmentService) HasFilter(filter containers.FilterType) bool
HasFilter is not supported
type KubeletListener ¶
type KubeletListener struct {
// contains filtered or unexported fields
}
KubeletListener listens to pod creation through a subscription to the workloadmeta store.
type SNMPListener ¶
SNMPListener implements SNMP discovery
func (*SNMPListener) Listen ¶
func (l *SNMPListener) Listen(newSvc chan<- Service, delSvc chan<- Service)
Listen periodically refreshes devices
type SNMPService ¶
type SNMPService struct {
// contains filtered or unexported fields
}
SNMPService implements and store results from the Service interface for the SNMP listener
func (*SNMPService) FilterTemplates ¶
func (s *SNMPService) FilterTemplates(configs map[string]integration.Config)
FilterTemplates does nothing.
func (*SNMPService) GetADIdentifiers ¶
func (s *SNMPService) GetADIdentifiers(context.Context) ([]string, error)
GetADIdentifiers returns a set of AD identifiers
func (*SNMPService) GetCheckNames ¶
func (s *SNMPService) GetCheckNames(context.Context) []string
GetCheckNames returns nil
func (*SNMPService) GetExtraConfig ¶
func (s *SNMPService) GetExtraConfig(key string) (string, error)
GetExtraConfig returns data from configuration
func (*SNMPService) GetHostname ¶
func (s *SNMPService) GetHostname(context.Context) (string, error)
GetHostname returns nothing - not supported
func (*SNMPService) GetPid ¶
func (s *SNMPService) GetPid(context.Context) (int, error)
GetPid returns nil and an error because pids are currently not supported
func (*SNMPService) GetPorts ¶
func (s *SNMPService) GetPorts(context.Context) ([]ContainerPort, error)
GetPorts returns the device port
func (*SNMPService) GetServiceID ¶
func (s *SNMPService) GetServiceID() string
GetServiceID returns the unique entity ID linked to that service
func (*SNMPService) GetTaggerEntity ¶
func (s *SNMPService) GetTaggerEntity() string
GetTaggerEntity returns the unique entity ID linked to that service
func (*SNMPService) GetTags ¶
func (s *SNMPService) GetTags() ([]string, error)
GetTags returns the list of container tags - currently always empty
func (*SNMPService) HasFilter ¶
func (s *SNMPService) HasFilter(filter containers.FilterType) bool
HasFilter returns false on SNMP
type Service ¶
type Service interface { GetServiceID() string // unique service name GetTaggerEntity() string // tagger entity name GetADIdentifiers(context.Context) ([]string, error) // identifiers on which templates will be matched GetHosts(context.Context) (map[string]string, error) // network --> IP address GetPorts(context.Context) ([]ContainerPort, error) // network ports GetTags() ([]string, error) // tags GetPid(context.Context) (int, error) // process identifier GetHostname(context.Context) (string, error) // hostname.domainname for the entity IsReady(context.Context) bool // is the service ready GetCheckNames(context.Context) []string // slice of check names defined in kubernetes annotations or container labels HasFilter(containers.FilterType) bool // whether the service is excluded by metrics or logs exclusion config GetExtraConfig(string) (string, error) // Extra configuration values // FilterTemplates filters the templates which will be resolved against // this service, in a map keyed by template digest. // // This method is called every time the configs for the service change, // with the full set of templates matching this service. It must not rely // on any non-static information except the given configs, and it must not // modify the configs in the map. FilterTemplates(map[string]integration.Config) }
Service represents an application we can run a check against. It should be matched with a check template by the ConfigResolver using the ADIdentifiers field.
type ServiceListener ¶
type ServiceListener interface { Listen(newSvc, delSvc chan<- Service) Stop() }
ServiceListener monitors running services and triggers check (un)scheduling
It holds a cache of running services, listens to new/killed services and updates its cache, and the autoconfig with these events.
func NewContainerListener ¶
func NewContainerListener(_ Config, wmeta optional.Option[workloadmeta.Component]) (ServiceListener, error)
NewContainerListener returns a new ContainerListener.
func NewEnvironmentListener ¶
func NewEnvironmentListener(Config) (ServiceListener, error)
NewEnvironmentListener creates an EnvironmentListener
func NewKubeletListener ¶
func NewKubeletListener(_ Config, wmeta optional.Option[workloadmeta.Component]) (ServiceListener, error)
NewKubeletListener returns a new KubeletListener.
func NewSNMPListener ¶
func NewSNMPListener(Config) (ServiceListener, error)
NewSNMPListener creates a SNMPListener
func NewStaticConfigListener ¶
func NewStaticConfigListener(Config) (ServiceListener, error)
NewStaticConfigListener creates a StaticConfigListener
type ServiceListenerFactory ¶
type ServiceListenerFactory func(Config) (ServiceListener, error)
ServiceListenerFactory builds a service listener
var NewCloudFoundryListener ServiceListenerFactory
NewCloudFoundryListener creates a CloudFoundryListener
var NewDBMAuroraListener ServiceListenerFactory
NewDBMAuroraListener returns a ServiceListener interface
var NewKubeEndpointsListener ServiceListenerFactory
NewKubeEndpointsListener returns the kube endpoints implementation of the ServiceListener interface
var NewKubeServiceListener ServiceListenerFactory
NewKubeServiceListener returns the kube service implementation of the ServiceListener interface
type StaticConfigListener ¶
type StaticConfigListener struct {
// contains filtered or unexported fields
}
StaticConfigListener implements a ServiceListener based on static configuration parameters
func (*StaticConfigListener) Listen ¶
func (l *StaticConfigListener) Listen(newSvc chan<- Service, delSvc chan<- Service)
Listen starts the goroutine to detect checks based on the config
func (*StaticConfigListener) Stop ¶
func (l *StaticConfigListener) Stop()
Stop has nothing to do in this case
type StaticConfigService ¶
type StaticConfigService struct {
// contains filtered or unexported fields
}
StaticConfigService represents services generated from StaticConfigListener
func (*StaticConfigService) FilterTemplates ¶
func (s *StaticConfigService) FilterTemplates(configs map[string]integration.Config)
FilterTemplates does nothing.
func (*StaticConfigService) GetADIdentifiers ¶
func (s *StaticConfigService) GetADIdentifiers(context.Context) ([]string, error)
GetADIdentifiers return the single AD identifier for a static config service
func (*StaticConfigService) GetCheckNames ¶
func (s *StaticConfigService) GetCheckNames(context.Context) []string
GetCheckNames is not supported
func (*StaticConfigService) GetExtraConfig ¶
func (s *StaticConfigService) GetExtraConfig(key string) (string, error)
GetExtraConfig is not supported
func (*StaticConfigService) GetHostname ¶
func (s *StaticConfigService) GetHostname(context.Context) (string, error)
GetHostname returns nil and an error because port is not supported in this listener
func (*StaticConfigService) GetPid ¶
func (s *StaticConfigService) GetPid(context.Context) (int, error)
GetPid inspect the container and return its pid Not relevant in this listener
func (*StaticConfigService) GetPorts ¶
func (s *StaticConfigService) GetPorts(context.Context) ([]ContainerPort, error)
GetPorts returns nil and an error because port is not supported in this listener
func (*StaticConfigService) GetServiceID ¶
func (s *StaticConfigService) GetServiceID() string
GetServiceID returns the unique entity name linked to that service
func (*StaticConfigService) GetTaggerEntity ¶
func (s *StaticConfigService) GetTaggerEntity() string
GetTaggerEntity returns the tagger entity
func (*StaticConfigService) GetTags ¶
func (s *StaticConfigService) GetTags() ([]string, error)
GetTags retrieves a container's tags
func (*StaticConfigService) HasFilter ¶
func (s *StaticConfigService) HasFilter(filter containers.FilterType) bool
HasFilter is not supported