Skip to content

Commit

Permalink
Log error when statsd server fails to start and fix airflow docs (#36477
Browse files Browse the repository at this point in the history
)

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 <[email protected]>
  • Loading branch information
belimawr and shmsr authored Sep 13, 2023
1 parent 6f9303c commit 9dcd8be
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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*

Expand Down
10 changes: 7 additions & 3 deletions metricbeat/docs/modules/airflow.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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 <<metricbeat-module-statsd,Statsd>> to receive Statsd metrics. Refer to the link for instructions about how to use Statsd.
The Airflow module requires <<metricbeat-module-statsd,Statsd>> 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]
Expand Down
10 changes: 7 additions & 3 deletions x-pack/metricbeat/module/airflow/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
@@ -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]
Expand All @@ -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 <<metricbeat-module-statsd,Statsd>> to receive Statsd metrics. Refer to the link for instructions about how to use Statsd.
The Airflow module requires <<metricbeat-module-statsd,Statsd>> 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]
Expand Down
4 changes: 3 additions & 1 deletion x-pack/metricbeat/module/statsd/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 9dcd8be

Please sign in to comment.