metrics-exporter

command module
v0.0.0-...-72eeae7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

README

metrics-exporter

Proxy to filter and rewrite CockroachDB metrics in Prometheus format. Currently, it exports all metrics as is, except for histograms. Histograms are converted from a log-2 linear format (HDR histograms) to a log-10 linear format. They have consistent lower/upper buckets to work with Grafana's heatmaps.

Additional custom metrics can be generated by querying the sql activity tables.

Usage:

Usage of ./metrics-exporter:
  -config string
        YAML configuration
  -debug
        log debug info
  -local string
        use local file to read Prometheus metrics (for testing)
  -trace
        log trace info
  -version
        print version and exit

The configuration, in yaml format, specifies the cockroach db URL the proxy connects to and the port the proxy it listens to.

The log-10 linear format precision is configurable, specifying the lower range (in nanoseconds) and the number of linear bins for each logarithmic bin. Optionally, the user can specify the upper range (in nanoseconds), the unit (seconds,milliseconds,microseconds) to convert the bucket ranges, and a regex expression to include/exclude matching histograms (all the buckets matching the include regex will be included, even if the match the exclude regex).

The tls section allows the user to specify CA, cert and private key to connect to the backend. The same configuration is used to configure the HTTPS endpoint that the proxy listen to.

The custom section enables the collection of custom metrics:

  • sql activity per query (based on a fingerprint id)
  • global efficiency measurements (full scans, index joins, explicit transactions).

Custom metrics are exposed, by default, on the /_status/custom endpoint. The endpoint can be configured adding a endpoint entry to the custom section. Setting it to /_status/vars will force the custom metrics to be merged with the CockroachDB metrics.

Custom metrics are fetched from the node every 10 seconds, unless the frequency parameter is set in the configuration.

The /statement endpoint could be used to retrieve the statement associated to a fingerprint id.

The custom configuration section allows to disable functionality by setting one or more of the following:

  • DisableGetStatement=true disables the retrieval of statement based on an id.
  • SkipActivity=true disable sql activity metrics collection
  • SkipEfficiency=true disable efficiency metrics collection By default, all the functionality is enabled.
Sample configuration:
url: https://localhost:8080/_status/vars
port: 8888
bucket:
  startns: 100000 
  bins: 10 
  endns: 20000000000
  unit: millseconds 
  exclude: (.*internal)
  include: (sql_exec_latency_internal_bucket)
tls:
  ca: ./certs/ca.crt
  privatekey: ./certs/client.root.key
  certificate: ./certs/client.root.crt
custom:
  url: postgresql://root@localhost:26257?sslmode=disable
  limit: 100  

Documentation

Overview

The metrics-exported implements a simple proxy that filters and rewrites CockroachDB Prometheus metrics. In the current implementation it converts HDRHistograms to log10 linear based histograms.

Directories

Path Synopsis
internal
lib
Package lib provides utility functions to read/write/transform metrics.
Package lib provides utility functions to read/write/transform metrics.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL