Skip to content

Commit

Permalink
cockroachdb: support all v23.2 metrics
Browse files Browse the repository at this point in the history
CockroachDB exposes its metrics via a
[Prometheus endpoint](https://www.cockroachlabs.com/docs/v23.2/monitoring-and-alerting#prometheus-endpoint)
on `/_status/vars`. In CockroachDB v23.2 there are
[~1500 metrics exposed](https://github.com/cockroachdb/cockroach/blob/f6d211271f2ba51b57d083ffc5c2cbadc38b5b23/docs/generated/metrics/metrics.html)
via this endpoint.

After deduplication and removing histogram metrics (i.e., `.bucket`,
`.sum`), the `cockroachdb` Datadog integration only supports 372 metrics
per its
[metadata.csv](https://github.com/DataDog/integrations-core/blob/2ca3e82bb56a4215860a38aa2b7707137b5240c1/cockroachdb/metadata.csv)
file.

This patch updates the `cockroachdb` Datadog integration to support all
of the metrics exposed by CockroachDB as of the latest stable release,
which is v23.2 at the time of this writing.

Resolves #16694.
  • Loading branch information
sudomateo committed Mar 6, 2024
1 parent 3239303 commit a646e80
Show file tree
Hide file tree
Showing 7 changed files with 3,963 additions and 795 deletions.
1 change: 1 addition & 0 deletions cockroachdb/changelog.d/16697.changed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support all CockroachDB v23.2 metrics.
29 changes: 29 additions & 0 deletions cockroachdb/cmd/generate/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# generate

A program to generate the `metadata.csv` and metric name mapping required by the
`cockroachdb` Datadog integration.

## Usage

Build the `generate` program.

```
go build .
```

Download the `metrics.html` from
https://github.com/cockroachdb/cockroach/blob/master/docs/generated/metrics/metrics.html.

Run the generator against the `metrics.html` file.

```
generate metrics.html
```

Afterwards, you'll have a `metadata.csv` and `mapping.txt` file in your current
working directory.

Replace `cockroachdb/metadata.csv` with the generated `metadata.csv` file.

Update the `METRIC_MAP` in `cockroachdb/datadog_checks/cockroachdb/metrics.py`
with the content from `mapping.txt`.
11 changes: 11 additions & 0 deletions cockroachdb/cmd/generate/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module generate

go 1.22.1

require github.com/mdigger/htmlx v1.0.1

require (
github.com/mdigger/wstat v0.0.0-20210601091130-720a00d2ac3a // indirect
golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect
golang.org/x/text v0.3.6 // indirect
)
13 changes: 13 additions & 0 deletions cockroachdb/cmd/generate/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
github.com/mdigger/htmlx v1.0.1 h1:kRQkxy47ZMpLQDJvla0UuklO8dq03gaHAYVngUyxUB8=
github.com/mdigger/htmlx v1.0.1/go.mod h1:wvTL2EPWXHGVyER1/2wbjI04yBOIHuseQyZ7lYK1UXA=
github.com/mdigger/wstat v0.0.0-20210601091130-720a00d2ac3a h1:+ysqmGWt5uyXiXF8v8dvogWreUS4cuLRNexgZJSc7E4=
github.com/mdigger/wstat v0.0.0-20210601091130-720a00d2ac3a/go.mod h1:HakDzzxSevC21s4FVwJmfpV4Xm4IiRR8Y7/ly73h7NU=
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Loading

0 comments on commit a646e80

Please sign in to comment.