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

[Metricbeat] Add STAN (NATS streaming) module #14839

Merged
merged 36 commits into from
Dec 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
10bca48
Add STAN metricbeat module (#1)
devon-kim Aug 14, 2019
3b78c08
bool -> boolean for field declaration
devon-kim Aug 14, 2019
8ce67ae
bool != boolean
devon-kim Oct 29, 2019
7ffee37
fmt update
ChrsMark Nov 28, 2019
febbd04
Add comments on exported structs
ChrsMark Nov 28, 2019
79743d4
Fix dahsboard
ChrsMark Dec 2, 2019
6050983
Move STAN to x-pack
ChrsMark Dec 3, 2019
8e58c92
Fix docs
ChrsMark Dec 3, 2019
6987169
Minor fixes
ChrsMark Dec 3, 2019
bb1c6c3
Add intgration tests
ChrsMark Dec 3, 2019
d6ce7e9
add system tests
ChrsMark Dec 3, 2019
f23c2c9
fmt
ChrsMark Dec 3, 2019
a8c275b
import parameterized
ChrsMark Dec 3, 2019
f9b4319
Fix Dockerfile
ChrsMark Dec 3, 2019
37ae90f
Fix mapping
ChrsMark Dec 3, 2019
9492c38
fix stats metricset
ChrsMark Dec 3, 2019
00519a6
fix fields
ChrsMark Dec 3, 2019
be9c7b4
Fix tests
ChrsMark Dec 3, 2019
5d15e28
Enhance Dockerfile to create channels
ChrsMark Dec 4, 2019
43adb6d
Fix subs and channelz
ChrsMark Dec 4, 2019
43f4540
fix config and fields
ChrsMark Dec 4, 2019
792fca2
Remove debug logs
ChrsMark Dec 5, 2019
b44bd10
remove dashboard
ChrsMark Dec 5, 2019
10e841d
Merge remote-tracking branch 'upstream/master' into stan_mb_module
ChrsMark Dec 9, 2019
8b38be4
fixes
ChrsMark Dec 10, 2019
4701ec6
Add changelog entry
ChrsMark Dec 10, 2019
f2e028e
minor review improvements
ChrsMark Dec 11, 2019
3530321
remove commented out lines from Dockerfile
ChrsMark Dec 11, 2019
c190bb1
improvements
ChrsMark Dec 11, 2019
75dd7c2
Merge remote-tracking branch 'upstream/master' into stan_mb_module
ChrsMark Dec 12, 2019
c582e48
make update
ChrsMark Dec 12, 2019
bd20e7e
Move python test to module folder
ChrsMark Dec 12, 2019
33e986e
fix location of Dockefile
ChrsMark Dec 12, 2019
e20c930
keep output active so as to prevent Travis timeout
ChrsMark Dec 12, 2019
82addd4
Make use travis_wait
ChrsMark Dec 12, 2019
a4bd16d
Enable testing output
ChrsMark Dec 12, 2019
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
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Fix timezone parsing in haproxy pipeline. {pull}14755[14755]
- Add module for ActiveMQ. {pull}14840[14840]
- Add dashboards for the ActiveMQ Filebeat module. {pull}14880[14880]
- Add STAN Metricbeat module. {pull}14839[14839]

*Heartbeat*
- Add non-privileged icmp on linux and darwin(mac). {pull}13795[13795] {issue}11498[11498]
Expand Down
13 changes: 7 additions & 6 deletions dev-tools/mage/gotest.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ func GoTest(ctx context.Context, params GoTestArgs) error {
fmt.Println(">> go test:", params.TestName, "Testing")

// Build args list to Go.
args := []string{"test", "-v"}
args := []string{"test"}
if mg.Verbose() {
args = append(args, "-v")
}
if params.Race {
args = append(args, "-race")
}
Expand All @@ -123,9 +126,7 @@ func GoTest(ctx context.Context, params GoTestArgs) error {
// Wire up the outputs.
bufferOutput := new(bytes.Buffer)
outputs := []io.Writer{bufferOutput}
if mg.Verbose() {
outputs = append(outputs, os.Stdout)
}

if params.OutputFile != "" {
fileOutput, err := os.Create(createDir(params.OutputFile))
if err != nil {
Expand All @@ -135,8 +136,8 @@ func GoTest(ctx context.Context, params GoTestArgs) error {
outputs = append(outputs, fileOutput)
}
output := io.MultiWriter(outputs...)
goTest.Stdout = output
goTest.Stderr = output
goTest.Stdout = io.MultiWriter(output, os.Stdout)
goTest.Stderr = io.MultiWriter(output, os.Stderr)

// Execute 'go test' and measure duration.
start := time.Now()
Expand Down
256 changes: 256 additions & 0 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ grouped in the following categories:
* <<exported-fields-rabbitmq>>
* <<exported-fields-redis>>
* <<exported-fields-sql>>
* <<exported-fields-stan>>
* <<exported-fields-statsd>>
* <<exported-fields-system>>
* <<exported-fields-tomcat>>
Expand Down Expand Up @@ -29518,6 +29519,261 @@ type: object

--

[[exported-fields-stan]]
== Stan fields

stan Module



[float]
=== stan

`stan` contains statistics that were read from Nats Streaming server (STAN)



*`stan.server.id`*::
+
--
The server ID


type: keyword

--

*`stan.cluster.id`*::
+
--
The cluster ID


type: keyword

--

[float]
=== channels

Contains stan / nats streaming/serverz endpoint metrics



*`stan.channels.name`*::
+
--
The name of the STAN streaming channel


type: keyword

--

*`stan.channels.messages`*::
+
--
The number of STAN streaming messages


type: long

--

*`stan.channels.bytes`*::
+
--
The number of STAN bytes in the channel


type: long

--

*`stan.channels.first_seq`*::
+
--
First sequence number stored in the channel. If first_seq > min([seq in subscriptions]) data loss has possibly occurred


type: long

--

*`stan.channels.last_seq`*::
+
--
Last sequence number stored in the channel


type: long

--

*`stan.channels.depth`*::
+
--
Queue depth based upon current sequence number and highest reported subscriber sequence number


type: long

--

[float]
=== stats

Contains only high-level stan / nats streaming server related metrics



*`stan.stats.state`*::
+
--
The cluster / streaming configuration state (STANDALONE, CLUSTERED)


type: keyword

--

*`stan.stats.role`*::
+
--
If clustered, role of this node in the cluster (Leader, Follower, Candidate)


type: keyword

--

*`stan.stats.clients`*::
+
--
The number of STAN clients


type: integer

--

*`stan.stats.subscriptions`*::
+
--
The number of STAN streaming subscriptions


type: integer

--

*`stan.stats.channels`*::
+
--
The number of STAN channels


type: integer

--

*`stan.stats.messages`*::
+
--
Number of messages across all STAN queues


type: long

--

*`stan.stats.bytes`*::
+
--
Number of bytes consumed across all STAN queues


type: long

--

[float]
=== subscriptions

Contains stan / nats streaming/serverz endpoint subscription metrics



*`stan.subscriptions.id`*::
+
--
The name of the STAN channel subscription (client_id)


type: keyword

--

*`stan.subscriptions.channel`*::
+
--
The name of the STAN channel the subscription is associated with


type: keyword

--

*`stan.subscriptions.queue`*::
+
--
The name of the NATS queue that the STAN channel subscription is associated with, if any


type: keyword

--

*`stan.subscriptions.last_sent`*::
+
--
Last known sequence number of the subscription that was acked


type: long

--

*`stan.subscriptions.pending`*::
+
--
Number of pending messages from / to the subscriber


type: long

--

*`stan.subscriptions.offline`*::
+
--
Is the subscriber marked as offline?


type: boolean

--

*`stan.subscriptions.stalled`*::
+
--
Is the subscriber known to be stalled?


type: boolean

--

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

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

[[metricbeat-module-stan]]
[role="xpack"]
== Stan module

beta[]

This is the STAN module. The STAN module uses https://github.com/nats-io/nats-streaming-server/blob/master/server/monitor.go[STAN monitoring server APIs] to collect metrics.

The default metricsets are `channels`, `stats` and `subscriptions`.

[float]
=== Compatibility

The STAN module is tested with STAN 0.15.1.


[float]
=== Example configuration

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

[source,yaml]
----
metricbeat.modules:
- module: stan
metricsets: ["stats", "channels", "subscriptions"]
period: 60s
hosts: ["localhost:8222"]
#stats.metrics_path: "/streaming/serverz"
#channels.metrics_path: "/streaming/channelsz"
#subscriptions.metrics_path: "/streaming/channelsz" # we retrieve streaming subscriptions with a detailed query param to the channelsz endpoint
----

[float]
=== Metricsets

The following metricsets are available:

* <<metricbeat-metricset-stan-channels,channels>>

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

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

include::stan/channels.asciidoc[]

include::stan/stats.asciidoc[]

include::stan/subscriptions.asciidoc[]

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

[[metricbeat-metricset-stan-channels]]
=== Stan channels metricset

beta[]

include::../../../../x-pack/metricbeat/module/stan/channels/_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-stan,exported fields>> section.

Here is an example document generated by this metricset:

[source,json]
----
include::../../../../x-pack/metricbeat/module/stan/channels/_meta/data.json[]
----
Loading