integration

package
v0.0.2-0...-4ce78c8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

README

package integration

This package is responsible of defining the types representing an integration which can be used by several components of the agent to configure checks or logs collectors for example.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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:"minCollectionInterval" json:"minCollectionInterval"` // This changes the collection interval of the check - default: 15
	EmptyDefaultHostname  bool     `yaml:"emptyDefaultHostname" json:"emptyDefaultHostname"`   // This forces the check to send metrics with no hostname. This is useful for cluster-level checks.
	Tags                  []string `yaml:"tags" json:"tags"`                                   // A list of tags to attach to every metric and service check emitted by this instance, <key_1>:<value_1>
	Service               string   `yaml:"service" json:"service"`                             // Attach the tag `service:<SERVICE>` to every metric, event, and service check emitted by this integration.
	Name                  string   `yaml:"name" json:"name"`                                   //
	Namespace             string   `yaml:"namespace" json:"namespace"`                         //
}

CommonInstanceConfig holds the reserved fields for the yaml instance data

type Config

type Config struct {
	Name                    string       `yaml:"checkName" json:"checkName"`                             // the name of the check (include in digest: true)
	Instances               []Data       `yaml:"instances" json:"instances"`                             // the list of instances in Yaml (include in digest: true)
	InitConfig              Data         `yaml:"initConfig" json:"initConfig"`                           // the initConfig in Yaml (include in digest: true)
	MetricConfig            Data         `yaml:"metricConfig" json:"metricConfig"`                       // the metric config in Yaml (jmx check only) (include in digest: false)
	LogsConfig              Data         `yaml:"logs" json:"logs"`                                       // the logs config in Yaml (logs-agent only) (include in digest: true)
	ADIdentifiers           []string     `yaml:"adIdentifiers" json:"adIdentifiers"`                     // the list of AutoDiscovery identifiers (optional) (include in digest: true)
	Provider                string       `yaml:"provider" json:"provider"`                               // the provider that issued the config (include in digest: false)
	Entity                  string       `yaml:"-" json:"-"`                                             // the entity ID (optional) (include in digest: true)
	TaggerEntity            string       `yaml:"-" json:"-"`                                             // the tagger entity ID (optional) (include in digest: false)
	ClusterCheck            bool         `yaml:"clusterCheck" json:"clusterCheck"`                       // cluster-check configuration flag (include in digest: false)
	NodeName                string       `yaml:"nodeName" json:"nodeName"`                               // node name in case of an endpoint check backed by a pod (include in digest: true)
	CreationTime            CreationTime `yaml:"-" json:"-"`                                             // creation time of service (include in digest: false)
	Source                  string       `yaml:"source" json:"source"`                                   // the source of the configuration (include in digest: false)
	IgnoreAutodiscoveryTags bool         `yaml:"ignoreAutodiscoveryTags" json:"ignoreAutodiscoveryTags"` // used to ignore tags coming from autodiscovery (include in digest: true)
	MetricsExcluded         bool         `yaml:"-" json:"-"`                                             // whether metrics collection is disabled (set by container listeners only) (include in digest: false)
	LogsExcluded            bool         `yaml:"-" json:"-"`                                             // whether logs collection is disabled (set by container listeners only) (include in digest: false)
}

Config is a generic container for configuration files When a new field is added to this struct, please evaluate whether it should be computed in the config Digest and update the field's documentation and the Digest method accordingly

func (*Config) AddMetrics

func (c *Config) AddMetrics(metrics Data) error

AddMetrics adds metrics to a check configuration

func (*Config) Digest

func (c *Config) Digest() string

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) Equal

func (c *Config) Equal(cfg *Config) bool

Equal determines whether the passed config is the same

func (*Config) GetTemplateVariablesForInstance

func (c *Config) GetTemplateVariablesForInstance(i int) []tmplvar.TemplateVar

GetTemplateVariablesForInstance returns a slice of raw template variables it found in a config instance template.

func (*Config) HasFilter

func (c *Config) HasFilter(filter containers.FilterType) bool

HasFilter returns true if metrics or logs collection must be disabled for this config. no containers.GlobalFilter case here because we don't create services that are globally excluded in AD

func (*Config) IsCheckConfig

func (c *Config) IsCheckConfig() bool

IsCheckConfig returns true if the config is a node-agent check configuration,

func (*Config) IsLogConfig

func (c *Config) IsLogConfig() bool

IsLogConfig returns true if config contains a logs config.

func (*Config) IsTemplate

func (c *Config) IsTemplate() bool

IsTemplate returns if the config has AD identifiers

func (*Config) String

func (c *Config) String() string

String YAML representation of the config

type CreationTime

type CreationTime int

CreationTime represents the moment when the service was launched compare to the agent start.

const (
	// Before indicates the service was launched before the agent start
	Before CreationTime = iota
	// After indicates the service was launched after the agent start
	After
)

type Data

type Data []byte

Data contains YAML code

func (*Data) GetNameForInstance

func (c *Data) GetNameForInstance() string

GetNameForInstance returns the name from an instance if specified, fallback on namespace

func (*Data) MergeAdditionalTags

func (c *Data) MergeAdditionalTags(tags []string) error

MergeAdditionalTags merges additional tags to possible existing config tags

func (*Data) SetField

func (c *Data) SetField(key string, value interface{}) error

SetField allows to set an arbitrary field to a given value, overriding the existing value if present

type JSONMap

type JSONMap map[string]interface{}

JSONMap is the generic type to hold JSON configurations

type RawMap

type RawMap map[interface{}]interface{}

RawMap is the generic type to hold YAML configurations

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL