diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 6a9fb08c17c..7cc8166d700 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -345,6 +345,8 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Add `metricset.period` field with the configured fetching period. {pull}13242[13242] {issue}12616[12616] - Add rate metrics for ec2 metricset. {pull}13203[13203] - Add Performance metricset to Oracle module {pull}12547[12547] +- Add proc/vmstat data to the system/memory metricset on linux {pull}13322[13322] +- Use DefaultMetaGeneratorConfig in MetadataEnrichers to initialize configurations {pull}13414 [13414] *Packetbeat* diff --git a/libbeat/common/kubernetes/metadata.go b/libbeat/common/kubernetes/metadata.go index b12a00ae1ff..4e1281534d4 100644 --- a/libbeat/common/kubernetes/metadata.go +++ b/libbeat/common/kubernetes/metadata.go @@ -44,22 +44,27 @@ type MetaGeneratorConfig struct { ExcludeLabels []string `config:"exclude_labels"` IncludeAnnotations []string `config:"include_annotations"` + LabelsDedot bool `config:"labels.dedot"` + AnnotationsDedot bool `config:"annotations.dedot"` + // Undocumented settings, to be deprecated in favor of `drop_fields` processor: IncludeCreatorMetadata bool `config:"include_creator_metadata"` - LabelsDedot bool `config:"labels.dedot"` - AnnotationsDedot bool `config:"annotations.dedot"` } type metaGenerator = MetaGeneratorConfig -// NewMetaGenerator initializes and returns a new kubernetes metadata generator -func NewMetaGenerator(cfg *common.Config) (MetaGenerator, error) { - // default settings: - generator := metaGenerator{ +// DefaultMetaGeneratorConfig initializes and returns a new MetaGeneratorConfig with default values +func DefaultMetaGeneratorConfig() MetaGeneratorConfig { + return MetaGeneratorConfig{ IncludeCreatorMetadata: true, LabelsDedot: true, AnnotationsDedot: true, } +} + +// NewMetaGenerator initializes and returns a new kubernetes metadata generator +func NewMetaGenerator(cfg *common.Config) (MetaGenerator, error) { + generator := DefaultMetaGeneratorConfig() err := cfg.Unpack(&generator) return &generator, err diff --git a/metricbeat/module/kubernetes/util/kubernetes.go b/metricbeat/module/kubernetes/util/kubernetes.go index 972dba972a3..74377872c4c 100644 --- a/metricbeat/module/kubernetes/util/kubernetes.go +++ b/metricbeat/module/kubernetes/util/kubernetes.go @@ -112,7 +112,7 @@ func NewResourceMetadataEnricher( return &nilEnricher{} } - metaConfig := kubernetes.MetaGeneratorConfig{} + metaConfig := kubernetes.DefaultMetaGeneratorConfig() if err := base.Module().UnpackConfig(&metaConfig); err != nil { logp.Err("Error initializing Kubernetes metadata enricher: %s", err) return &nilEnricher{} @@ -186,7 +186,7 @@ func NewContainerMetadataEnricher( return &nilEnricher{} } - metaConfig := kubernetes.MetaGeneratorConfig{} + metaConfig := kubernetes.DefaultMetaGeneratorConfig() if err := base.Module().UnpackConfig(&metaConfig); err != nil { logp.Err("Error initializing Kubernetes metadata enricher: %s", err) return &nilEnricher{}