Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add statsd module #13109

Merged
merged 26 commits into from
Aug 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ grouped in the following categories:
* <<exported-fields-prometheus>>
* <<exported-fields-rabbitmq>>
* <<exported-fields-redis>>
* <<exported-fields-statsd>>
* <<exported-fields-system>>
* <<exported-fields-traefik>>
* <<exported-fields-uwsgi>>
Expand Down Expand Up @@ -26018,6 +26019,33 @@ type: long

--

[[exported-fields-statsd]]
== Statsd fields

Statsd module



*`statsd.*.count`*::
+
--
Statsd counters


type: object

--

*`statsd.*.*`*::
+
--
Statsd metrics - release: beta


type: object

--

[[exported-fields-system]]
== System fields

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

[[metricbeat-module-statsd]]
== Statsd module

beta[]

The Statsd module is a Metricbeat module which opens a UDP port and listens for statsd metrics.

NOTE: Sample rates are ignored at the moment.



[float]
=== Example configuration

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

[source,yaml]
----
metricbeat.modules:
- module: statsd
host: "localhost"
port: "8125"
enabled: false
#reservoir_size: 1000
#ttl: "30s"
----

[float]
=== Metricsets

The following metricsets are available:

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

include::statsd/server.asciidoc[]

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

[[metricbeat-metricset-statsd-server]]
=== Statsd server metricset

beta[]

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


==== Fields

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

Here is an example document generated by this metricset:

[source,json]
----
include::../../../../x-pack/metricbeat/module/statsd/server/_meta/data.json[]
----
3 changes: 3 additions & 0 deletions metricbeat/docs/modules_list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ This file is generated! See scripts/mage/docs_collector.go
.3+| .3+| |<<metricbeat-metricset-redis-info,info>>
|<<metricbeat-metricset-redis-key,key>>
|<<metricbeat-metricset-redis-keyspace,keyspace>>
|<<metricbeat-module-statsd,Statsd>> beta[] |image:./images/icon-no.png[No prebuilt dashboards] |
.1+| .1+| |<<metricbeat-metricset-statsd-server,server>> beta[]
|<<metricbeat-module-system,System>> |image:./images/icon-yes.png[Prebuilt dashboards are available] |
.15+| .15+| |<<metricbeat-metricset-system-core,core>>
|<<metricbeat-metricset-system-cpu,cpu>>
Expand Down Expand Up @@ -227,6 +229,7 @@ include::modules/postgresql.asciidoc[]
include::modules/prometheus.asciidoc[]
include::modules/rabbitmq.asciidoc[]
include::modules/redis.asciidoc[]
include::modules/statsd.asciidoc[]
include::modules/system.asciidoc[]
include::modules/traefik.asciidoc[]
include::modules/uwsgi.asciidoc[]
Expand Down
5 changes: 4 additions & 1 deletion metricbeat/helper/server/udp/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,12 @@ func (g *UdpServer) watchMetrics() {
continue
}

bufCopy := make([]byte, length)
copy(bufCopy, buffer)

g.eventQueue <- &UdpEvent{
event: common.MapStr{
server.EventDataKey: buffer[:length],
server.EventDataKey: bufCopy,
},
meta: server.Meta{
"client_ip": addr.IP.String(),
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/http/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
}, nil
}

// Run method provides the Graphite server with a reporter with which events can be reported.
// Run method provides the module with a reporter with which events can be reported.
func (m *MetricSet) Run(reporter mb.PushReporterV2) {
// Start event watcher
m.server.Start()
Expand Down
2 changes: 2 additions & 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.

8 changes: 8 additions & 0 deletions x-pack/metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,14 @@ metricbeat.modules:
# Redis AUTH password. Empty by default.
#password: foobared

#-------------------------------- Statsd Module --------------------------------
- module: statsd
host: "localhost"
port: "8125"
enabled: false
#reservoir_size: 1000
#ttl: "30s"

#------------------------------- Traefik Module -------------------------------
- module: traefik
metricsets: ["health"]
Expand Down
6 changes: 6 additions & 0 deletions x-pack/metricbeat/module/statsd/_meta/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- module: statsd
host: "localhost"
port: "8125"
enabled: false
#reservoir_size: 1000
#ttl: "30s"
4 changes: 4 additions & 0 deletions x-pack/metricbeat/module/statsd/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The Statsd module is a Metricbeat module which opens a UDP port and listens for statsd metrics.

NOTE: Sample rates are ignored at the moment.

18 changes: 18 additions & 0 deletions x-pack/metricbeat/module/statsd/_meta/fields.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- key: statsd
title: "Statsd"
description: >
Statsd module
release: beta
fields:
- name: statsd.*.count
type: object
object_type: long
object_type_mapping_type: "long"
description: >
Statsd counters
- name: statsd.*.*
type: object
object_type: float
object_type_mapping_type: "*"
description: >
Statsd metrics
5 changes: 5 additions & 0 deletions x-pack/metricbeat/module/statsd/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

package statsd
23 changes: 23 additions & 0 deletions x-pack/metricbeat/module/statsd/fields.go

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

104 changes: 104 additions & 0 deletions x-pack/metricbeat/module/statsd/server/_meta/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"@timestamp": "2017-10-12T08:05:34.853Z",
"labels": {
"k1": "v1",
"k2": "v2"
},
"service": {
"type": "statsd"
},
"statsd": {
"metric01": {
"value": 1
},
"metric02": {
"count": 2
},
"metric03": {
"count": 3
},
"metric04": {
"15m_rate": 0,
"1m_rate": 0,
"5m_rate": 0,
"count": 1,
"max": 4,
"mean": 4,
"mean_rate": 78665.82756450598,
"median": 4,
"min": 4,
"p75": 4,
"p95": 4,
"p99": 4,
"p99_9": 4,
"stddev": 0
},
"metric05": {
"count": 1,
"max": 0,
"mean": 0,
"median": 0,
"min": 0,
"p75": 0,
"p95": 0,
"p99": 0,
"p99_9": 0,
"stddev": 0
},
"metric06": {
"count": 1,
"max": 0,
"mean": 0,
"median": 0,
"min": 0,
"p75": 0,
"p95": 0,
"p99": 0,
"p99_9": 0,
"stddev": 0
},
"metric07": {
"15m_rate": 0,
"1m_rate": 0,
"5m_rate": 0,
"count": 1,
"max": 7,
"mean": 7,
"mean_rate": 134156.15776764153,
"median": 7,
"min": 7,
"p75": 7,
"p95": 7,
"p99": 7,
"p99_9": 7,
"stddev": 0
},
"metric08": {
"count": 1
},
"metric09": {
"count": 1,
"max": 0,
"mean": 0,
"median": 0,
"min": 0,
"p75": 0,
"p95": 0,
"p99": 0,
"p99_9": 0,
"stddev": 0
},
"metric10_with_dots": {
"count": 1,
"max": 0,
"mean": 0,
"median": 0,
"min": 0,
"p75": 0,
"p95": 0,
"p99": 0,
"p99_9": 0,
"stddev": 0
}
}
}
18 changes: 18 additions & 0 deletions x-pack/metricbeat/module/statsd/server/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
This is the server metricset of the statsd module.

Events sent to the stats endpoint will be put by default under the `statsd` prefix.

_ttl_ defines how long a metric will be reported after it was last recorded.
Irrespective of the given ttl, metrics will be reported at least once.
A ttl of zero means metrics will never expire.

["source","yaml",subs="attributes"]
------------------------------------------------------------------------------
- module: statsd
metricsets: ["server"]
host: "localhost"
port: "8125"
#reservoir_size: 1000
#ttl: "30s"
------------------------------------------------------------------------------

1 change: 1 addition & 0 deletions x-pack/metricbeat/module/statsd/server/_meta/fields.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- release: beta
Loading