Using metrics with Stargate

Stargate is a data gateway deployed between client applications and a database. Metrics can be monitored using Prometheus and Grafana. A docker-compose script is available to run Apache Cassandra, Stargate, Prometheus, and Grafana together to explore the metrics available.


To use Stargate you need:

  • Docker installed and running, if using Docker

  • cURL to run REST, Document, or GraphQL queries

Get the docker-compose file

The docker-compose YAML file contains the configuration for pulling the required docker images and configuration required for installing. It can be used to install:

  • 1-3 Apache Cassandra 3.11 nodes as a cluster (backend-1, backend-2, backend-3)

  • 1 Stargate node (stargate)

  • 1 Prometheus node (prometheus)

  • 1 Grafana node (grafana)

Two companion files are helpful: a script to run the docker-compose file with delays between node startup that prevents timing issues, and a text file that has the docker run commands for running a CQLSH Docker container to query against either one of the Cassandra nodes or the Stargate node, respectively.

Run the script after downloading the files:


Access Prometheus

Once all the images are running, you can access Prometheus in the browser at http://localhost:9090.

Note that the default file /etc/prometheus/prometheus.yml is replaced with a mounted file from the docker-compose repository, to identify the stargate node as the target for gathering metrics. The default target of localhost:9090 (the Prometheus node) has been replaced with 'stargate:8085' (the stargate node’s metrics port).

The Stargate metrics are grouped by API, and can accessed as any other metrics are accessed in Prometheus.

Access Grafana

Once all the images are running, you can access Grafana in the browser at http://localhost:3000. You’ll need to login with the default username and password, admin/admin. Grafana will require you to create a new password to proceed.

Add Prometheus as a data source by clicking the data source icon on the lefthand side editing the form with the following information:

Press "Save & Test" to check that the data source is added. Add a new dashboard and choose Prometheus as the data source. The Stargate metrics can be selected as a metric to display.

For more information on using Grafana, access the Grafana docs.