From e90b12a45ce09027b631bbaa001711f882630cca Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 15 Sep 2021 19:13:29 +0200 Subject: [PATCH] Metricbeat, fix metricsets log level behavior (#27804) (#27902) (cherry picked from commit 6af8ffb084df24df63da164e3d2e1a2fffa519ee) Co-authored-by: Philipp Kahr --- CHANGELOG-developer.next.asciidoc | 1 + CHANGELOG.next.asciidoc | 1 + metricbeat/mb/module/wrapper.go | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG-developer.next.asciidoc b/CHANGELOG-developer.next.asciidoc index e6f620a86f5..d6a94d46f2f 100644 --- a/CHANGELOG-developer.next.asciidoc +++ b/CHANGELOG-developer.next.asciidoc @@ -59,6 +59,7 @@ The list below covers the major changes between 7.0.0-rc2 and master only. - Metricbeat module builders call host parser only once when instantiating light modules. {pull}20149[20149] - Fix export dashboard command when running against Elastic Cloud hosted Kibana. {pull}22746[22746] - Remove `event.dataset` (ECS) annotion from `libbeat.logp`. {issue}27404[27404] +- Errors should be thrown as errors. Metricsets inside Metricbeat will now throw errors as the `error` log level. {pull}27804[27804] ==== Added diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index ce3f7b31ffe..308639426a4 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -76,6 +76,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Add Linux pressure metricset {pull}27355[27355] - Add support for kube-state-metrics v2.0.0 {pull}27552[27552] - Add User-Agent header to HTTP requests. {issue}18160[18160] {pull}27509[27509] +- Errors should be thrown as errors. Metricsets inside Metricbeat will now throw errors as the `error` log level. {pull}27804[27804] *Packetbeat* diff --git a/metricbeat/mb/module/wrapper.go b/metricbeat/mb/module/wrapper.go index f0d1552c815..808b99167cf 100644 --- a/metricbeat/mb/module/wrapper.go +++ b/metricbeat/mb/module/wrapper.go @@ -256,14 +256,14 @@ func (msw *metricSetWrapper) fetch(ctx context.Context, reporter reporter) { err := fetcher.Fetch(reporter.V2()) if err != nil { reporter.V2().Error(err) - logp.Info("Error fetching data for metricset %s.%s: %s", msw.module.Name(), msw.Name(), err) + logp.Err("Error fetching data for metricset %s.%s: %s", msw.module.Name(), msw.Name(), err) } case mb.ReportingMetricSetV2WithContext: reporter.StartFetchTimer() err := fetcher.Fetch(ctx, reporter.V2()) if err != nil { reporter.V2().Error(err) - logp.Info("Error fetching data for metricset %s.%s: %s", msw.module.Name(), msw.Name(), err) + logp.Err("Error fetching data for metricset %s.%s: %s", msw.module.Name(), msw.Name(), err) } default: panic(fmt.Sprintf("unexpected fetcher type for %v", msw))