Skip to content

Commit 9911b5d

Browse files
authored
Merge pull request #54 from zegelin/keyspace-metrics
Add support for exporting Cassandra's keyspace- and node-level metrics.
2 parents a4a290d + 9723977 commit 9911b5d

File tree

3 files changed

+272
-128
lines changed

3 files changed

+272
-128
lines changed

README.md

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -100,28 +100,26 @@ The format/structure of the JSON output is subject to change.
100100

101101
The available command line options may be seen by passing `-h`/`--help`:
102102

103-
Usage: cassandra-exporter-standalone [-hV] [--enable-collector-timing]
104-
[--enable-per-thread-cpu-times]
105-
[--exclude-system-tables]
106-
[--no-fast-float] [--no-global-labels]
107-
[--no-table-labels] [--cql-address=
108-
[ADDRESS][:PORT]]
109-
[--cql-password=PASSWORD]
110-
[--cql-user=NAME] [--family-help=VALUE]
111-
[--jmx-password=PASSWORD]
112-
[--jmx-service-url=URL] [--jmx-user=NAME]
113-
[--exclude-keyspaces=<excludedKeyspaces>]..
114-
. [-g=LABEL[,LABEL...]]... [-l=[ADDRESS][:
115-
PORT]]... [-t=LABEL[,LABEL...]]...
116-
[-e=EXCLUSION...]...
103+
Usage: cassandra-exporter [-hV] [--enable-collector-timing]
104+
[--enable-per-thread-cpu-times]
105+
[--exclude-system-tables] [--no-fast-float]
106+
[--no-global-labels] [--no-table-labels] [-v]...
107+
[--cql-address=[ADDRESS][:PORT]]
108+
[--cql-password=PASSWORD] [--cql-user=NAME]
109+
[--family-help=VALUE] [--jmx-password=PASSWORD]
110+
[--jmx-service-url=URL] [--jmx-user=NAME]
111+
[--keyspace-metrics=FILTER] [--node-metrics=FILTER]
112+
[--table-metrics=FILTER]
113+
[--exclude-keyspaces=<excludedKeyspaces>]... [-g=LABEL
114+
[,LABEL...]]... [-l=[ADDRESS][:PORT]]... [-t=LABEL[,
115+
LABEL...]]... [-e=EXCLUSION...]...
117116
-g, --global-labels=LABEL[,LABEL...]
118117
Select which global labels to include on all exported
119118
metrics. Valid options are: 'CLUSTER' (cluster name),
120-
'HOST_ID' (UUID of the node), 'NODE' (node endpoint IP
121-
address), 'DATACENTER' (DC name), 'RACK' (rack name).
122-
The default is to include all global labels except
123-
HOST_ID. To disable all global labels use
124-
--no-global-labels.
119+
'NODE' (node endpoint IP address), 'DATACENTER' (DC
120+
name), 'RACK' (rack name). The default is to include
121+
all global labels except HOST_ID. To disable all
122+
global labels use --no-global-labels.
125123
-t, --table-labels=LABEL[,LABEL...]
126124
Select which labels to include on table-level metrics.
127125
Valid options are: 'TABLE_TYPE' (table, view or
@@ -131,6 +129,20 @@ The available command line options may be seen by passing `-h`/`--help`:
131129
tables & views, compaction-related metrics only). The
132130
default is to include all table labels. To disable all
133131
table labels use --no-table-labels.
132+
--table-metrics=FILTER
133+
Select which table-level metrics to expose. Valid
134+
options are: 'ALL' (all metrics), 'HISTOGRAMS' (only
135+
histograms & summaries), 'NONE' (no metrics). The
136+
default is 'ALL'.
137+
--keyspace-metrics=FILTER
138+
Select which keyspace-level aggregate metrics to expose.
139+
Valid options are: 'ALL' (all metrics), 'HISTOGRAMS'
140+
(only histograms & summaries), 'NONE' (no metrics).
141+
The default is 'HISTOGRAMS'.
142+
--node-metrics=FILTER Select which node-level aggregate metrics to expose.
143+
Valid options are: 'ALL' (all metrics), 'HISTOGRAMS'
144+
(only histograms & summaries), 'NONE' (no metrics).
145+
The default is 'HISTOGRAMS'.
134146
--enable-per-thread-cpu-times
135147
Collect per-thread CPU times, where each thread gets its
136148
own time-series. (EXPERIMENTAL)
@@ -139,7 +151,6 @@ The available command line options may be seen by passing `-h`/`--help`:
139151
and export the results.
140152
--exclude-keyspaces=<excludedKeyspaces>
141153

142-
--no-global-labels Disable all global labels.
143154
-e, --exclude=EXCLUSION...
144155
Exclude a metric family or MBean from exposition.
145156
EXCLUSION may be the full name of a metric family
@@ -153,6 +164,7 @@ The available command line options may be seen by passing `-h`/`--help`:
153164
prefixed with '#' are considered comments and are
154165
ignored. This option may be specified more than once
155166
to define multiple exclusions.
167+
--no-global-labels Disable all global labels.
156168
--no-table-labels Disable all table labels.
157169
--no-fast-float Disable the use of fast float -> ascii conversion.
158170
--exclude-system-tables
@@ -188,11 +200,14 @@ The available command line options may be seen by passing `-h`/`--help`:
188200
--cql-user=NAME CQL authentication user name.
189201
--cql-password=PASSWORD
190202
CQL authentication password.
203+
-v, --verbose Enable verbose logging. Multiple invocations increase
204+
the verbosity.
191205
-h, --help Show this help message and exit.
192206
-V, --version Print version information and exit.
193207

194208

195209

210+
196211
Options may also be provided via an `@`-file:
197212

198213
- *Standalone*
@@ -254,8 +269,12 @@ For exporters that run as a separate process there is additional overhead of int
254269

255270
The exporter attempts to follow Prometheus' best practices for metric names, labels and data types.
256271

257-
Cassandras built-in aggregate metrics, such as the table-related metrics at the keyspace and node level, are skipped.
258-
Instead only the table-level metrics are exported &mdash; aggregates can be computed on-the-fly using PromQL queries or once using Prometheus recording rules.
272+
Cassandra has keyspace- and node-level metrics that are aggregates of the per-table metrics. By default, only a subset of these
273+
aggregate metrics, specifically histograms, are exposed by *cassandra-exporter*. All other keyspace- and node-level
274+
metrics are skipped in favour of only exporting the per-table metrics. The rationale behind this is that apart from the histograms,
275+
the aggregate metrics are essentially duplicates. If they are needed they may be computed on-the-fly via PromQL or
276+
once, at scrape time, using Prometheus recording rules.
277+
259278

260279
Unlike the metrics exported via JMX, where each table metric has a unique name, Cassandras metrics are coalesced when appropriate so they share the same exported metric family name, opting for *labels* to differentiate individual time series.
261280
For example, each table level metric has a constant name and at minimum a `table` & `keyspace` label, which allows for complex PromQL queries.
@@ -297,13 +316,13 @@ Element | Value
297316
### Global Labels
298317

299318
The exporter does attach global labels to the exported metrics.
300-
These may be configured with the `--global-labels` (or disabled via `--no-global-labels) CLI option.
319+
These may be configured with the `--global-labels` (or disabled via `--no-global-labels`) CLI option.
301320

302321
These labels are:
303322

304323
- `cassandra_cluster`
305324

306-
The name of the cluster, as specified in cassandra.yaml.
325+
The name of the cluster, as specified in `cassandra.yaml`.
307326

308327
- `cassandra_host_id`
309328

0 commit comments

Comments
 (0)