Skip to content

Commit

Permalink
Add subscriptions metricset of nats module (elastic#10159)
Browse files Browse the repository at this point in the history
This PR adds `subscriptions` metricset to nats module as part of elastic#10071.

`subscriptions` metricset retrieves metrics from subsz monitoring URI of nats.

Co-Authored-By: Christos Markou <chrismarkou92@gmail.com>
Co-Authored-By:  Stamatis Katsaounis <katsaouniss@gmail.com>
  • Loading branch information
3 people authored and ruflin committed Jan 21, 2019
1 parent ac83498 commit 94e58e9
Show file tree
Hide file tree
Showing 29 changed files with 569 additions and 28 deletions.
4 changes: 0 additions & 4 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d

- Add `key` metricset to the Redis module. {issue}9582[9582] {pull}9657[9657] {pull}9746[9746]
- Add `socket_summary` metricset to system defaults, removing experimental tag and supporting Windows {pull}9709[9709]
- Add `nats` module with `stats` metricset. {pull}9825[9825]
- Add `connections` metricset to the `nats` module. {pull}10095[10095]
- Add `routes` metricset to the `nats` module. {pull}10095[10095]
- Add remaining memory metrics of pods in Kubernetes metricbeat module {pull}10157[10157]

*Packetbeat*

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Add AWS EC2 module. {pull}9257[9257] {issue}9300[9300]
- Release traefik Metricbeat module as GA. {pull}10166[10166]
- Release Elastic stack modules (Elasticsearch, Logstash, and Kibana) as GA. {pull}10094[10094]
- Add `nats` module. {issue}10071[10071]
- Release uswgi Metricbeat module GA. {pull}10164[10164]
- Release php_fpm module as GA. {pull}10198[10198]
- Release Memcached module as GA. {pull}10199[10199]
Expand Down
91 changes: 89 additions & 2 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -17273,7 +17273,7 @@ nats Module
*`nats.server_id`*::
*`nats.server.id`*::
+
--
type: string
Expand All @@ -17283,7 +17283,7 @@ The server ID
--
*`nats.now`*::
*`nats.server.time`*::
+
--
type: date
Expand Down Expand Up @@ -17577,6 +17577,93 @@ type: integer
The number of hits on root monitoring uri
--
[float]
== subscriptions fields
Contains nats subscriptions related metrics
*`nats.subscriptions.total`*::
+
--
type: integer
The number of active subscriptions
--
*`nats.subscriptions.inserts`*::
+
--
type: integer
The number of insert operations in subscriptions list
--
*`nats.subscriptions.removes`*::
+
--
type: integer
The number of remove operations in subscriptions list
--
*`nats.subscriptions.matches`*::
+
--
type: integer
The number of times a match is found for a subscription
--
*`nats.subscriptions.cache.size`*::
+
--
type: integer
The number of result sets in the cache
--
*`nats.subscriptions.cache.hit_rate`*::
+
--
type: integer
The rate matches are being retrieved from cache
--
*`nats.subscriptions.cache.fanout.max`*::
+
--
type: integer
The maximum fanout served by cache
--
*`nats.subscriptions.cache.fanout.avg`*::
+
--
type: integer
The average fanout served by cache
--
[[exported-fields-nginx]]
Expand Down
7 changes: 6 additions & 1 deletion metricbeat/docs/modules/nats.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ in <<configuration-metricbeat>>. Here is an example configuration:
----
metricbeat.modules:
- module: nats
metricsets: ["connections", "routes", "stats"]
metricsets: ["connections", "routes", "stats", "subscriptions"]
period: 10s
hosts: ["localhost:8222"]
#stats.metrics_path: "/varz"
#connections.metrics_path: "/connz"
#routes.metrics_path: "/routez"
#subscriptions.metrics_path: "/subsz"
----

[float]
Expand All @@ -48,9 +49,13 @@ The following metricsets are available:

* <<metricbeat-metricset-nats-stats,stats>>

* <<metricbeat-metricset-nats-subscriptions,subscriptions>>

include::nats/connections.asciidoc[]

include::nats/routes.asciidoc[]

include::nats/stats.asciidoc[]

include::nats/subscriptions.asciidoc[]

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

[[metricbeat-metricset-nats-subscriptions]]
=== Nats subscriptions metricset

experimental[]

include::../../../module/nats/subscriptions/_meta/docs.asciidoc[]


==== Fields

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

Here is an example document generated by this metricset:

[source,json]
----
include::../../../module/nats/subscriptions/_meta/data.json[]
----
3 changes: 2 additions & 1 deletion metricbeat/docs/modules_list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ This file is generated! See scripts/docs_collector.py
.2+| .2+| |<<metricbeat-metricset-mysql-galera_status,galera_status>> experimental[]
|<<metricbeat-metricset-mysql-status,status>>
|<<metricbeat-module-nats,Nats>> experimental[] |image:./images/icon-no.png[No prebuilt dashboards] |
.3+| .3+| |<<metricbeat-metricset-nats-connections,connections>> experimental[]
.4+| .4+| |<<metricbeat-metricset-nats-connections,connections>> experimental[]
|<<metricbeat-metricset-nats-routes,routes>> experimental[]
|<<metricbeat-metricset-nats-stats,stats>> experimental[]
|<<metricbeat-metricset-nats-subscriptions,subscriptions>> experimental[]
|<<metricbeat-module-nginx,Nginx>> |image:./images/icon-yes.png[Prebuilt dashboards are available] |
.1+| .1+| |<<metricbeat-metricset-nginx-stubstatus,stubstatus>>
|<<metricbeat-module-php_fpm,PHP_FPM>> |image:./images/icon-no.png[No prebuilt dashboards] |
Expand Down
1 change: 1 addition & 0 deletions metricbeat/include/list.go

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

3 changes: 2 additions & 1 deletion metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -518,12 +518,13 @@ metricbeat.modules:

#-------------------------------- Nats Module --------------------------------
- module: nats
metricsets: ["connections", "routes", "stats"]
metricsets: ["connections", "routes", "stats", "subscriptions"]
period: 10s
hosts: ["localhost:8222"]
#stats.metrics_path: "/varz"
#connections.metrics_path: "/connz"
#routes.metrics_path: "/routez"
#subscriptions.metrics_path: "/subsz"

#-------------------------------- Nginx Module -------------------------------
- module: nginx
Expand Down
3 changes: 2 additions & 1 deletion metricbeat/module/nats/_meta/config.reference.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
- module: nats
metricsets: ["connections", "routes", "stats"]
metricsets: ["connections", "routes", "stats", "subscriptions"]
period: 10s
hosts: ["localhost:8222"]
#stats.metrics_path: "/varz"
#connections.metrics_path: "/connz"
#routes.metrics_path: "/routez"
#subscriptions.metrics_path: "/subsz"
3 changes: 2 additions & 1 deletion metricbeat/module/nats/_meta/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
- module: nats
metricsets: ["connections", "routes", "stats"]
metricsets: ["connections", "routes", "stats", "subscriptions"]
period: 10s
hosts: ["localhost:8222"]
#stats.metrics_path: "/varz"
#connections.metrics_path: "/connz"
#routes.metrics_path: "/routez"
#subscriptions.metrics_path: "/subsz"
4 changes: 2 additions & 2 deletions metricbeat/module/nats/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
description: >
`nats` contains statistics that were read from Nats
fields:
- name: server_id
- name: server.id
type: string
description: >
The server ID
- name: now
- name: server.time
type: date
description: >
Server time of metric creation
6 changes: 4 additions & 2 deletions metricbeat/module/nats/connections/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
"rtt":44269
},
"nats":{
"server_id": "bUAdpRFtMWddIBWw80Yd9D",
"now": "2018-12-28T12:33:53.026865597Z",
"server": {
"id": "bUAdpRFtMWddIBWw80Yd9D",
"time": "2018-12-28T12:33:53.026865597Z"
},
"connections":{
"total": 10
}
Expand Down
6 changes: 4 additions & 2 deletions metricbeat/module/nats/connections/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ import (

var (
moduleSchema = s.Schema{
"server_id": c.Str("server_id"),
"now": c.Str("now"),
"server": s.Object{
"id": c.Str("server_id"),
"time": c.Str("now"),
},
}
connectionsSchema = s.Schema{
"total": c.Int("total"),
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/nats/fields.go

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

6 changes: 4 additions & 2 deletions metricbeat/module/nats/routes/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
"rtt":44269
},
"nats":{
"server_id": "bUAdpRFtMWddIBWw80Yd9D",
"now": "2018-12-28T12:33:53.026865597Z",
"server": {
"id": "bUAdpRFtMWddIBWw80Yd9D",
"time": "2018-12-28T12:33:53.026865597Z"
},
"routes":{
"total": 10
}
Expand Down
6 changes: 4 additions & 2 deletions metricbeat/module/nats/routes/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ import (

var (
moduleSchema = s.Schema{
"server_id": c.Str("server_id"),
"now": c.Str("now"),
"server": s.Object{
"id": c.Str("server_id"),
"time": c.Str("now"),
},
}
routesSchema = s.Schema{
"total": c.Int("num_routes"),
Expand Down
6 changes: 4 additions & 2 deletions metricbeat/module/nats/stats/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
"rtt":44269
},
"nats":{
"server_id":"bUAdpRFtMWddIBWw80Yd9D",
"now":"2018-12-28T12:33:53.026864929Z",
"server": {
"id": "bUAdpRFtMWddIBWw80Yd9D",
"time": "2018-12-28T12:33:53.026865597Z"
},
"stats":{
"cores":0,
"cpu":0,
Expand Down
6 changes: 4 additions & 2 deletions metricbeat/module/nats/stats/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ import (

var (
moduleSchema = s.Schema{
"server_id": c.Str("server_id"),
"now": c.Str("now"),
"server": s.Object{
"id": c.Str("server_id"),
"time": c.Str("now"),
},
}
httpReqStatsSchema = s.Schema{
"root_uri": c.Int("/"),
Expand Down
30 changes: 30 additions & 0 deletions metricbeat/module/nats/subscriptions/_meta/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"@timestamp":"2016-05-23T08:05:34.853Z",
"beat":{
"hostname":"beathost",
"name":"beathost"
},
"metricset":{
"host":"localhost",
"module":"nats",
"name":"subscriptions",
"rtt":44269
},
"nats":{
"subscriptions":{
"total": 0,
"cache": {
"hit_rate": 0,
"size": 0,
"fanout": {
"max": 0,
"avg": 0
}
},
"inserts": 0,
"removes": 0,
"matches": 0
}
},
"type":"metricsets"
}
1 change: 1 addition & 0 deletions metricbeat/module/nats/subscriptions/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is the subscriptions metricset of the module nats.
Loading

0 comments on commit 94e58e9

Please sign in to comment.