Menu

Monitoring

Crux can expose metrics about a node via Dropwizard to Prometheus, AWS’s CloudWatch, and Java’s JMX.

We expose metrics about transaction ingestion and running queries; if you use RocksDB you can also expose internal RocksDB metrics.

Project Dependency

In order to use any of the crux-metrics reporters, you will need to include the following dependency on crux-metrics:

  • deps.edn

  • pom.xml

pro.juxt.crux/crux-metrics {:mvn/version "1.18.1"}
<dependency>
    <groupId>pro.juxt.crux</groupId>
    <artifactId>crux-metrics</artifactId>
    <version>1.18.1</version>
</dependency>

You will also need to include dependencies for your individual reporters - these are outlined below.

Metrics module

The Crux metric reporters depend on a common metrics module:

  • JSON

  • Clojure

  • EDN

{
  "crux.metrics/metrics": { ... },
}
{:crux.metrics/metrics { ... }}
{:crux.metrics/metrics { ... }}

You can omit this if you’re happy with its default parameters.

Parameters

  • with-index-store-metrics? (boolean, default true): includes index-store metrics in the metrics registry

  • with-query-metrics? (boolean, default true): includes query metrics in the metrics registry

Prometheus reporter

This reporter pushes metrics to a Prometheus 'Pushgateway' at regular intervals.

You will need to add the following dependencies, alongside crux-metrics, in your project:

Additional dependencies

  • deps.edn

org.dhatim/dropwizard-prometheus {:mvn/version "2.2.0"}
io.prometheus/simpleclient_pushgateway {:mvn/version "0.8.1"}
io.prometheus/simpleclient_dropwizard {:mvn/version "0.8.1"}
io.prometheus/simpleclient_hotspot {:mvn/version "0.8.1"}
clj-commons/iapetos {:mvn/version "0.1.9"}

Node configuration

  • JSON

  • Clojure

  • EDN

{
  "crux.metrics.prometheus/reporter": { ... }
}
{:crux.metrics.prometheus/reporter { ... }}
{:crux.metrics.prometheus/reporter { ... }}

Parameters

  • registry (registry, defaults to shared registry)

  • push-gateway (string, required)

  • report-frequency (string/Duration, default "PT1S")

  • prefix (string): prefix all metric titles with this string

Prometheus HTTP exporter

The Prometheus HTTP exporter starts a standalone server hosting Prometheus metrics.

Additional dependencies

  • deps.edn

org.dhatim/dropwizard-prometheus {:mvn/version "2.2.0"}
io.prometheus/simpleclient_dropwizard {:mvn/version "0.8.1"}
io.prometheus/simpleclient_hotspot {:mvn/version "0.8.1"}
io.prometheus/simpleclient_httpserver {:mvn/version "0.8.1"}
clj-commons/iapetos {:mvn/version "0.1.9"}

Node configuration

  • JSON

  • Clojure

  • EDN

{
  "crux.metrics.prometheus/http-exporter": { ... }
}
{:crux.metrics.prometheus/http-exporter { ... }}
{:crux.metrics.prometheus/http-exporter { ... }}

Parameters

  • registry (registry, defaults to shared registry)

  • port (int, default 8080) port number for Prometheus client server.

  • jvm-metrics? (boolean, default false): includes JVM metrics in the metrics dump

AWS Cloudwatch

In addition to extra dependencies, you’ll need to ensure that your application has the cloudwatch:PutMetricData permission.

Additional dependencies

  • deps.edn

io.github.azagniotov/dropwizard-metrics-cloudwatch {:mvn/version "2.0.3"}
software.amazon.awssdk/cloudwatch {:mvn/version "2.10.61"}

Node configuration

  • JSON

  • Clojure

  • EDN

{
  "crux.metrics.cloudwatch/reporter": { ... }
}
{:crux.metrics.cloudwatch/reporter { ... }}
{:crux.metrics.cloudwatch/reporter { ... }}

Parameters

  • registry (registry, defaults to shared registry)

  • high-resolution? (boolean, default false): increase push rate from 1 minute to 1 second

  • dimensions (Map<String, String>): dimensions to include in the pushed metrics

  • jvm-metrics? (boolean, default false): includes JVM metrics in the pushed metrics

  • region (string): override default AWS region for uploading metrics

  • ignore-rules (List<String>): a list of metrics to ignore, in gitignore format. e.g. ["crux.tx" "!crux.tx.ingest"] would ignore crux.tx.*, except crux.tx.ingest

  • dry-run? (boolean, default false): reporter outputs to a local SLF4J logger instead

  • dry-run-report-frequency (string/Duration, default "PT1S")

JMX

Additional Dependencies

  • deps.edn

io.dropwizard.metrics/metrics-jmx {:mvn/version "4.1.2"}

Node configuration

  • JSON

  • Clojure

  • EDN

{
  "crux.metrics.jmx/reporter": { ... }
}
{:crux.metrics.jmx/reporter { ... }}
{:crux.metrics.jmx/reporter { ... }}

Parameters

  • registry (registry, defaults to shared registry)

  • domain (string): custom JMS domain

  • rate-unit (TimeUnit, default 'seconds'): unit to report rates

  • duration-unit (TimeUnit, default 'seconds'): unit to report durations

Console

The console reporter logs metrics to standard-out at regular intervals.

It has no additional dependencies.

Node configuration

  • JSON

  • Clojure

  • EDN

{
  "crux.metrics.console/reporter": { ... }
}
{:crux.metrics.console/reporter { ... }}
{:crux.metrics.console/reporter { ... }}

Parameters

  • registry (registry, defaults to shared registry)

  • report-frequency (string/Duration, default "PT1S")

  • rate-unit (TimeUnit, default 'seconds'): unit to report rates

  • duration-unit (TimeUnit, default 'seconds'): unit to report durations

CSV

The CSV reporter logs metrics to a CSV file at regular intervals.

It has no additional dependencies.

Node configuration

  • JSON

  • Clojure

  • EDN

{
  "crux.metrics.csv/reporter": { ... }
}
{:crux.metrics.csv/reporter { ... }}
{:crux.metrics.csv/reporter { ... }}

Parameters

  • registry (registry, defaults to shared registry)

  • output-file (string/File/Path, required)

  • report-frequency (string/Duration, default "PT1S")

  • rate-unit (TimeUnit, default 'seconds'): unit to report rates

  • duration-unit (TimeUnit, default 'seconds'): unit to report durations