Documentation
¶
Overview ¶
Package integration defines types representing an integration configuration, which can be used by several components of the agent to configure checks or log collectors, for example.
Package integration defines types representing an integration configuration, which can be used by several components of the agent to configure checks or log collectors, for example.
Index ¶
- Constants
- func ConfigSourceToMetadataMap(source string, instance map[string]interface{})
- type AdvancedADIdentifier
- type CommonGlobalConfig
- type CommonInstanceConfig
- type Config
- func (c *Config) AddMetrics(metrics Data) error
- func (c *Config) Digest() string
- func (c *Config) Dump(multiline bool) string
- func (c *Config) Equal(cfg *Config) bool
- func (c *Config) FastDigest() uint64
- func (c *Config) HasFilter(fs workloadfilter.Scope) bool
- func (c *Config) IntDigest() uint64
- func (c *Config) IsCheckConfig() bool
- func (c *Config) IsLogConfig() bool
- func (c *Config) IsMatched(obj workloadfilter.Filterable) bool
- func (c *Config) IsTemplate() bool
- func (c *Config) SetMatchingProgram(p MatchingProgram)
- func (c *Config) String() string
- type ConfigChanges
- type ConfigCheckResponse
- type ConfigResponse
- type Data
- type JSONMap
- type KubeEndpointsIdentifier
- type KubeNamespacedName
- type MatchingProgram
- type RawMap
- type ServiceResponse
Constants ¶
const (
// FakeConfigHash is used in unit tests
FakeConfigHash = 1
)
Variables ¶
This section is empty.
Functions ¶
func ConfigSourceToMetadataMap ¶
ConfigSourceToMetadataMap converts a config source string to a metadata map.
Types ¶
type AdvancedADIdentifier ¶
type AdvancedADIdentifier struct {
KubeService KubeNamespacedName `yaml:"kube_service,omitempty"`
KubeEndpoints KubeEndpointsIdentifier `yaml:"kube_endpoints,omitempty"`
}
AdvancedADIdentifier contains user-defined autodiscovery information It replaces ADIdentifiers for advanced use-cases. Typically, file-based k8s service and endpoint checks.
type CommonGlobalConfig ¶
type CommonGlobalConfig struct {
Service string `yaml:"service"`
}
CommonGlobalConfig holds the reserved fields for the yaml init_config data
type CommonInstanceConfig ¶
type CommonInstanceConfig struct {
MinCollectionInterval int `yaml:"min_collection_interval"`
EmptyDefaultHostname bool `yaml:"empty_default_hostname"`
Tags []string `yaml:"tags"`
Service string `yaml:"service"`
Name string `yaml:"name"`
Namespace string `yaml:"namespace"`
NoIndex bool `yaml:"no_index"`
}
CommonInstanceConfig holds the reserved fields for the yaml instance data
type Config ¶
type Config struct {
// Name of the integration
Name string `json:"check_name"` // (include in digest: true)
// Instances is the list of instances in YAML or JSON.
Instances []Data `json:"instances"` // (include in digest: true)
// InitConfig is the init_config in YAML or JSON
InitConfig Data `json:"init_config"` // (include in digest: true)
// MetricConfig is the metric config in YAML or JSON (jmx check only)
MetricConfig Data `json:"metric_config"` // (include in digest: false)
// LogsConfig is the logs config in YAML or JSON (logs-agent only)
LogsConfig Data `json:"logs"` // (include in digest: true)
// ADIdentifiers is the list of AutoDiscovery identifiers for this
// integration. If either ADIdentifiers or AdvancedADIdentifiers are
// present, then this config is a template and will be resolved when a
// matching service is discovered. Otherwise, the config will be scheduled
// immediately. (optional)
ADIdentifiers []string `json:"ad_identifiers"` // (include in digest: true)
// AdvancedADIdentifiers is the list of advanced AutoDiscovery identifiers;
// see ADIdentifiers. (optional)
AdvancedADIdentifiers []AdvancedADIdentifier `json:"advanced_ad_identifiers"` // (include in digest: false)
// CELSelector is the list of CEL-based selectors for this integration. (optional)
CELSelector workloadfilter.Rules `json:"cel_selector"` // (include in digest: false)
// Provider is the name of the config provider that issued the config. If
// this is "", then the config is a service config, representing a service
// discovered by a listener.
Provider string `json:"provider"` // (include in digest: false)
// ServiceID is the ID of the service (set only for resolved templates and
// for service configs)
ServiceID string `json:"service_id"` // (include in digest: true)
// TaggerEntity is the tagger entity ID
TaggerEntity string `json:"-"` // (include in digest: false)
// ClusterCheck is cluster-check configuration flag
ClusterCheck bool `json:"cluster_check"` // (include in digest: false)
// NodeName is node name in case of an endpoint check backed by a pod
NodeName string `json:"node_name"` // (include in digest: true)
// Source is the source of the configuration
Source string `json:"source"` // (include in digest: false)
// IgnoreAutodiscoveryTags is used to ignore tags coming from autodiscovery
IgnoreAutodiscoveryTags bool `json:"ignore_autodiscovery_tags"` // (include in digest: true)
// CheckTagCardinality is used to override the default tag cardinality in the agent configuration
CheckTagCardinality string `json:"check_tag_cardinality"` // (include in digest: false)
// MetricsExcluded is whether metrics collection is disabled (set by
// container listeners only)
MetricsExcluded bool `json:"metrics_excluded"` // (include in digest: false)
// LogsExcluded is whether logs collection is disabled (set by container
// listeners only)
LogsExcluded bool `json:"logs_excluded"` // (include in digest: false)
// PodNamespace is the k8s namespace for the container being monitored if any
PodNamespace string `json:"pod_namespace"` // (include in digest: false)
// ImageName is the container image name if any
ImageName string `json:"image_name"` // (include in digest: false)
// contains filtered or unexported fields
}
Config is a generic container for configuration data specific to an integration. It contains snippets of configuration for various agent components, in fields of type Data.
The Data fields contain YAML data except when config.Provider is names.Container or names.Kubernetes, in which case the configuration is in JSON.
func ScrubCheckConfig ¶
ScrubCheckConfig scrubs all secrets in the config.
func (*Config) AddMetrics ¶
AddMetrics adds metrics to a check configuration
func (*Config) Digest ¶
Digest returns an hash value representing the data stored in this configuration. The ClusterCheck field is intentionally left out to keep a stable digest between the cluster-agent and the node-agents
func (*Config) Dump ¶
Dump returns a string representing this Config value, for debugging purposes. If multiline is true, then it contains newlines; otherwise, it is comma-separated.
func (*Config) FastDigest ¶
FastDigest returns an hash value representing the data stored in this configuration. Difference with Digest is that FastDigest does not consider that difference may appear inside Instances allowing to remove costly YAML Marshal/UnMarshal operations The ClusterCheck field is intentionally left out to keep a stable digest between the cluster-agent and the node-agents
func (*Config) HasFilter ¶
func (c *Config) HasFilter(fs workloadfilter.Scope) bool
HasFilter returns true if metrics or logs collection must be disabled for this config.
func (*Config) IntDigest ¶
IntDigest returns a hash value representing the data stored in the configuration.
func (*Config) IsCheckConfig ¶
IsCheckConfig returns true if the config is a node-agent check configuration,
func (*Config) IsLogConfig ¶
IsLogConfig returns true if config contains a logs config.
func (*Config) IsMatched ¶
func (c *Config) IsMatched(obj workloadfilter.Filterable) bool
IsMatched returns true if the given object matches the filtering program of the config. Note: this method should only be used within the autodiscovery component.
func (*Config) IsTemplate ¶
IsTemplate returns if the config has AD identifiers
func (*Config) SetMatchingProgram ¶
func (c *Config) SetMatchingProgram(p MatchingProgram)
SetMatchingProgram sets the matching program for the config.
type ConfigChanges ¶
type ConfigChanges struct {
// Schedule contains configs that should be scheduled as a result of
// this event.
Schedule []Config
// Unschedule contains configs that should be unscheduled as a result of
// this event.
Unschedule []Config
}
ConfigChanges contains the changes that occurred due to an event in AutoDiscovery.
func (*ConfigChanges) IsEmpty ¶
func (c *ConfigChanges) IsEmpty() bool
IsEmpty determines whether this set of changes is empty
func (*ConfigChanges) Merge ¶
func (c *ConfigChanges) Merge(other ConfigChanges)
Merge merges the given ConfigChanges into this one.
func (*ConfigChanges) ScheduleConfig ¶
func (c *ConfigChanges) ScheduleConfig(config Config)
ScheduleConfig adds a config to `Schedule`
func (*ConfigChanges) UnscheduleConfig ¶
func (c *ConfigChanges) UnscheduleConfig(config Config)
UnscheduleConfig adds a config to `Unschedule`
type ConfigCheckResponse ¶
type ConfigCheckResponse struct {
Configs []ConfigResponse `json:"configs"`
ResolveWarnings map[string][]string `json:"resolve_warnings"`
ConfigErrors map[string]string `json:"config_errors"`
Unresolved map[string]Config `json:"unresolved"`
Services []ServiceResponse `json:"services,omitempty"`
}
ConfigCheckResponse holds the config check response
type ConfigResponse ¶
type ConfigResponse struct {
InstanceIDs []string `json:"instance_ids"`
Config Config `json:"config"`
}
ConfigResponse holds information about the config the instance IDs are precomputed to avoid discrepancies between the server and the client The InstanceIDs must have the same order as the instances in the Config struct
type Data ¶
type Data []byte
Data contains YAML code
func (*Data) GetNameForInstance ¶
GetNameForInstance returns the name from an instance if specified, fallback on namespace
func (*Data) MergeAdditionalTags ¶
MergeAdditionalTags merges additional tags to possible existing config tags
func (*Data) SetField ¶
SetField allows to set an arbitrary field to a given value, overriding the existing value if present
func (*Data) SetNameForInstance ¶
SetNameForInstance set name for instance
type JSONMap ¶
type JSONMap map[string]interface{}
JSONMap is the generic type to hold JSON configurations
type KubeEndpointsIdentifier ¶
type KubeEndpointsIdentifier struct {
KubeNamespacedName `yaml:",inline"`
Resolve string `yaml:"resolve,omitempty"` // Endpoint resolve mode: "auto" (default) or "ip"
}
KubeEndpointsIdentifier identifies a kubernetes endpoints object alongside the method to resolve the endpoints.
type KubeNamespacedName ¶
KubeNamespacedName identifies a kubernetes object.
func (KubeNamespacedName) IsEmpty ¶
func (k KubeNamespacedName) IsEmpty() bool
IsEmpty returns true if the KubeNamespacedName is empty
type MatchingProgram ¶
type MatchingProgram interface {
// IsMatched returns true if the object matches the filter rules
IsMatched(obj workloadfilter.Filterable) bool
// GetTargetType returns the target resource type of the program
GetTargetType() workloadfilter.ResourceType
}
MatchingProgram is an interface for matching objects against filter rules.
type RawMap ¶
type RawMap map[interface{}]interface{}
RawMap is the generic type to hold YAML configurations
type ServiceResponse ¶
type ServiceResponse struct {
ServiceID string `json:"service_id"`
ADIdentifiers []string `json:"ad_identifiers"`
Hosts map[string]string `json:"hosts,omitempty"`
Ports []string `json:"ports,omitempty"`
PID int `json:"pid,omitempty"`
Hostname string `json:"hostname,omitempty"`
IsReady bool `json:"is_ready"`
FiltersMetrics bool `json:"filters_metrics"`
FiltersLogs bool `json:"filters_logs"`
}
ServiceResponse holds information about a tracked service