From 9dcd8bee9e804262b6f5b9dab6ec8e896e968b2a Mon Sep 17 00:00:00 2001 From: Tiago Queiroz Date: Wed, 13 Sep 2023 18:28:55 +0200 Subject: [PATCH] Log error when statsd server fails to start and fix airflow docs (#36477) This commit adds a log error when the statsd server fails to start, it also improves the Airflow module documentation to make extra clear that the module will start a statsd server. Co-authored-by: subham sarkar --- CHANGELOG.next.asciidoc | 1 + metricbeat/docs/modules/airflow.asciidoc | 10 +++++++--- x-pack/metricbeat/module/airflow/_meta/docs.asciidoc | 10 +++++++--- x-pack/metricbeat/module/statsd/server/server.go | 4 +++- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index bb6d0259242..002e0d2243c 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -131,6 +131,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff] - Add support for api_key authentication in elasticsearch module {pull}36274[36274] - Add remaining dimensions for azure storage account to make them available for tsdb enablement. {pull}36331[36331] - Add missing 'TransactionType' dimension for Azure Storage Account. {pull}36413[36413] +- Add log error when statsd server fails to start {pull}36477[36477] *Osquerybeat* diff --git a/metricbeat/docs/modules/airflow.asciidoc b/metricbeat/docs/modules/airflow.asciidoc index 49bd52cfc46..7c0b562e8ee 100644 --- a/metricbeat/docs/modules/airflow.asciidoc +++ b/metricbeat/docs/modules/airflow.asciidoc @@ -13,7 +13,7 @@ This file is generated! See scripts/mage/docs_collector.go beta[] This module collects metrics from -https://airflow.apache.org/docs/apache-airflow/stable/logging-monitoring/metrics.html[Airflow metrics] running a +https://airflow.apache.org/docs/apache-airflow/stable/logging-monitoring/metrics.html[Airflow metrics]. It runs a statsd server where airflow will send metrics to. The default metricset is `statsd`. [float] @@ -24,9 +24,13 @@ The Airflow module is tested with Airflow 2.1.0. It should work with version [float] === Usage -The Airflow module requires <> to receive Statsd metrics. Refer to the link for instructions about how to use Statsd. +The Airflow module requires <> to +receive statsd metrics. Refer to the link for instructions about how +to use statsd. -Add the following lines to your Airflow configuration file e.g. `airflow.cfg` ensuring `statsd_prefix` is left empty and replace `%METRICBEAT_HOST%` with the address metricbeat is running: +Add the following lines to your Airflow configuration file +e.g. `airflow.cfg` ensuring `statsd_prefix` is left empty and replace +`%METRICBEAT_HOST%` with the address where metricbeat is running: ``` [metrics] diff --git a/x-pack/metricbeat/module/airflow/_meta/docs.asciidoc b/x-pack/metricbeat/module/airflow/_meta/docs.asciidoc index 16f45db7454..fb5f989a1a4 100644 --- a/x-pack/metricbeat/module/airflow/_meta/docs.asciidoc +++ b/x-pack/metricbeat/module/airflow/_meta/docs.asciidoc @@ -1,5 +1,5 @@ This module collects metrics from -https://airflow.apache.org/docs/apache-airflow/stable/logging-monitoring/metrics.html[Airflow metrics] running a +https://airflow.apache.org/docs/apache-airflow/stable/logging-monitoring/metrics.html[Airflow metrics]. It runs a statsd server where airflow will send metrics to. The default metricset is `statsd`. [float] @@ -10,9 +10,13 @@ The Airflow module is tested with Airflow 2.1.0. It should work with version [float] === Usage -The Airflow module requires <> to receive Statsd metrics. Refer to the link for instructions about how to use Statsd. +The Airflow module requires <> to +receive statsd metrics. Refer to the link for instructions about how +to use statsd. -Add the following lines to your Airflow configuration file e.g. `airflow.cfg` ensuring `statsd_prefix` is left empty and replace `%METRICBEAT_HOST%` with the address metricbeat is running: +Add the following lines to your Airflow configuration file +e.g. `airflow.cfg` ensuring `statsd_prefix` is left empty and replace +`%METRICBEAT_HOST%` with the address where metricbeat is running: ``` [metrics] diff --git a/x-pack/metricbeat/module/statsd/server/server.go b/x-pack/metricbeat/module/statsd/server/server.go index d3dcb8e6123..48aee89e460 100644 --- a/x-pack/metricbeat/module/statsd/server/server.go +++ b/x-pack/metricbeat/module/statsd/server/server.go @@ -197,7 +197,9 @@ func (m *MetricSet) ServerStart() { if m.serverStarted { return } - m.server.Start() + if err := m.server.Start(); err != nil { + m.Logger().Errorw("could not start statsd server for module: "+m.Module().Name(), "error", err) + } m.serverStarted = true }