Skip to content

Commit

Permalink
[Metricbeat] Add Airflow module in xpack (#26220)
Browse files Browse the repository at this point in the history
* [Metricbeat] Add Airflow module

Airflow module is a lightweight module based on Statsd module.
It filters, renames and adds metrics according to mappings defined
in the manifest.yml

(cherry picked from commit 3d01b5b)
  • Loading branch information
Andrea Spacca authored and mergify-bot committed Jul 1, 2021
1 parent f23335c commit 814a048
Show file tree
Hide file tree
Showing 26 changed files with 2,047 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Remove `index_stats.created` field from Elasticsearch/index Metricset {pull}25113[25113]
- Adjust host fields to adopt new names from 1.9.0 ECS. {pull}24312[24312]
- Add replicas.ready field to state_statefulset in Kubernetes module{pull}26088[26088]
- Added `statsd.mappings` configuration for Statsd module {pull}26220[26220]
- Added Airflow lightweight module {pull}26220[26220]
- Add state_job metricset to Kubernetes module{pull}26479[26479]

*Packetbeat*

Expand Down
229 changes: 229 additions & 0 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ grouped in the following categories:

* <<exported-fields-activemq>>
* <<exported-fields-aerospike>>
* <<exported-fields-airflow>>
* <<exported-fields-apache>>
* <<exported-fields-appsearch>>
* <<exported-fields-aws>>
Expand Down Expand Up @@ -842,6 +843,234 @@ type: boolean

--

[[exported-fields-airflow]]
== Airflow fields

Airflow module




*`airflow.*.1m_rate`*::
+
--
Airflow 1m rate timers metric


type: object

--

*`airflow.*.5m_rate`*::
+
--
Airflow 5m rate timers metric


type: object

--

*`airflow.*.15m_rate`*::
+
--
Airflow 15 rate timers metric


type: object

--

*`airflow.*.count`*::
+
--
Airflow counters


type: object

--

*`airflow.*.max`*::
+
--
Airflow max timers metric


type: object

--

*`airflow.*.mean_rate`*::
+
--
Airflow mean rate timers metric


type: object

--

*`airflow.*.mean`*::
+
--
Airflow mean timers metric


type: object

--

*`airflow.*.median`*::
+
--
Airflow median timers metric


type: object

--

*`airflow.*.min`*::
+
--
Airflow min timers metric


type: object

--

*`airflow.*.p75`*::
+
--
Airflow 75 percentile timers metric


type: object

--

*`airflow.*.p95`*::
+
--
Airflow 95 percentile timers metric


type: object

--

*`airflow.*.p99_9`*::
+
--
Airflow 99.9 percentile timers metric


type: object

--

*`airflow.*.p99`*::
+
--
Airflow 99 percentile timers metric


type: object

--

*`airflow.*.stddev`*::
+
--
Airflow standard deviation timers metric


type: object

--

*`airflow.*.value`*::
+
--
Airflow gauges


type: object

--

*`airflow.dag_file`*::
+
--
Airflow dag file metadata


type: keyword

--

*`airflow.dag_id`*::
+
--
Airflow dag id metadata


type: keyword

--

*`airflow.job_name`*::
+
--
Airflow job name metadata


type: keyword

--

*`airflow.operator_name`*::
+
--
Airflow operator name metadata


type: keyword

--

*`airflow.pool_name`*::
+
--
Airflow pool name metadata


type: keyword

--

*`airflow.status`*::
+
--
Airflow status metadata


type: keyword

--

*`airflow.task_id`*::
+
--
Airflow task id metadata


type: keyword

--

[[exported-fields-apache]]
== Apache fields

Expand Down
60 changes: 60 additions & 0 deletions metricbeat/docs/modules/airflow.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
////
This file is generated! See scripts/mage/docs_collector.go
////

[[metricbeat-module-airflow]]
[role="xpack"]
== Airflow module

beta[]

This module collects metrics from
https://airflow.apache.org/docs/apache-airflow/stable/logging-monitoring/metrics.html[Airflow metrics] running a
statsd server where airflow will send metrics to. The default metricset is `statsd`.

[float]
=== Compatibility

The Airflow module is tested with Airflow 2.1.0. It should work with version
2.0.0 and later.

[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.

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:

```
[metrics]
statsd_on = True
statsd_host = %METRICBEAT_HOST%
statsd_port = 8126
statsd_prefix =
```


[float]
=== Example configuration

The Airflow module supports the standard configuration options that are described
in <<configuration-metricbeat>>. Here is an example configuration:

[source,yaml]
----
metricbeat.modules:
- module: airflow
host: "localhost"
port: "8126"
#ttl: "30s"
metricsets: [ 'statsd' ]
----

[float]
=== Metricsets

The following metricsets are available:

* <<metricbeat-metricset-airflow-statsd,statsd>>

include::airflow/statsd.asciidoc[]

25 changes: 25 additions & 0 deletions metricbeat/docs/modules/airflow/statsd.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
////
This file is generated! See scripts/mage/docs_collector.go
////

[[metricbeat-metricset-airflow-statsd]]
[role="xpack"]
=== Airflow statsd metricset

beta[]

include::../../../../x-pack/metricbeat/module/airflow/statsd/_meta/docs.asciidoc[]

This is a default metricset. If the host module is unconfigured, this metricset is enabled by default.

==== Fields

For a description of each field in the metricset, see the
<<exported-fields-airflow,exported fields>> section.

Here is an example document generated by this metricset:

[source,json]
----
include::../../../../x-pack/metricbeat/module/airflow/statsd/_meta/data.json[]
----
23 changes: 22 additions & 1 deletion metricbeat/docs/modules/statsd.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,28 @@ The `statsd` module has these additional config options:
Irrespective of the given ttl, metrics will be reported at least once.
A ttl of zero means metrics will never expire.

[float]
*`statsd.mapping`*:: It defines how metrics will mapped from the original metric label to the event json.
Here's an example configuration:
[source,yaml]
----
statsd.mappings:
- metric: 'ti_failures' <1>
value:
field: task_failures <2>
- metric: '<job_name>_start' <1>
labels:
- attr: job_name <3>
field: job_name <4>
value:
field: started <2>
----

<1> `metric`, required: the label key of the metric in statsd, either as a exact match string
or as a template with named label placeholder in the format `<label_placeholder>`
<2> `value.field`, required: field name where to save the metric value in the event json
<3> `label[].attr`, required when using named label placeholder: reference to the named label placeholder defined in `metric`
<4> `label[].field`, required when using named label placeholder field name where to save the named label placeholder value from the template in the event json

=== Metricsets

Currently, there is only `server` metricset in `statsd` module.
Expand Down
3 changes: 3 additions & 0 deletions metricbeat/docs/modules_list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ This file is generated! See scripts/mage/docs_collector.go
|<<metricbeat-metricset-activemq-topic,topic>>
|<<metricbeat-module-aerospike,Aerospike>> |image:./images/icon-yes.png[Prebuilt dashboards are available] |
.1+| .1+| |<<metricbeat-metricset-aerospike-namespace,namespace>>
|<<metricbeat-module-airflow,Airflow>> beta[] |image:./images/icon-no.png[No prebuilt dashboards] |
.1+| .1+| |<<metricbeat-metricset-airflow-statsd,statsd>> beta[]
|<<metricbeat-module-apache,Apache>> |image:./images/icon-yes.png[Prebuilt dashboards are available] |
.1+| .1+| |<<metricbeat-metricset-apache-status,status>>
|<<metricbeat-module-appsearch,App Search>> beta[] |image:./images/icon-no.png[No prebuilt dashboards] |
Expand Down Expand Up @@ -299,6 +301,7 @@ This file is generated! See scripts/mage/docs_collector.go

include::modules/activemq.asciidoc[]
include::modules/aerospike.asciidoc[]
include::modules/airflow.asciidoc[]
include::modules/apache.asciidoc[]
include::modules/appsearch.asciidoc[]
include::modules/aws.asciidoc[]
Expand Down
1 change: 1 addition & 0 deletions x-pack/metricbeat/include/list.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 814a048

Please sign in to comment.