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.

Prerequisites

If you are looking to just get started, DataStax Astra Database-as-a-Service can get you started with no install steps.

  • Install cURL, a utility for running REST, Document, or GraphQL queries on the command line.

  • [Optional] If you prefer, you can use Postman as a client interface for exploring the APIs

    • You will also find links to downloadable collections and environments in Using Postman

  • [Optional] If you going to use the GraphQL API, you will want to use the GraphQL Playground to deploy schema and execute mutations and queries.

  • [Optional] For the REST and Document APIs, you can use the Swagger UI.

  • Install Docker for Desktop

  • Pull a Stargate Docker image

  • Cassandra 4.0

  • Cassandra 3.x

  • DSE 6.8

This image contains the Cassandra Query Language (CQL), REST, Document, GraphQL APIs, and GraphQL Playground, along with an Apache Cassandra 4.0 backend.

docker pull stargateio/stargate-4_0:v1.0.57

This image contains the Cassandra Query Language (CQL), REST, Document, GraphQL APIs, and GraphQL Playground, along with an Apache Cassandra 3.11 backend.

docker pull stargateio/stargate-3_11:v1.0.57

This image contains the Cassandra Query Language (CQL), REST, Document, GraphQL APIs, and GraphQL Playground, along with a DataStax Enterprise 6.8 backend.

docker pull stargateio/stargate-dse-68:v1.0.57
  • Run the Stargate Docker image

  • Cassandra 4.0

  • Cassandra 3.x

  • DSE 6.8

Start the Stargate container in developer mode. Developer mode removes the need to set up a separate Cassandra instance and is meant for development and testing only.

docker run --name stargate \
  -p 8080:8080 \
  -p 8081:8081 \
  -p 8082:8082 \
  -p 127.0.0.1:9042:9042 \
  -d \
  -e CLUSTER_NAME=stargate \
  -e CLUSTER_VERSION=4.0 \
  -e DEVELOPER_MODE=true \
  stargateio/stargate-4_0:v1.0.57

Start the Stargate container in developer mode. Developer mode removes the need to set up a separate Cassandra instance and is meant for development and testing only.

docker run --name stargate \
  -p 8080:8080 \
  -p 8081:8081 \
  -p 8082:8082 \
  -p 127.0.0.1:9042:9042 \
  -d \
  -e CLUSTER_NAME=stargate \
  -e CLUSTER_VERSION=3.11 \
  -e DEVELOPER_MODE=true \
  stargateio/stargate-3_11:v1.0.57

Start the Stargate container in developer mode. Developer mode removes the need to set up a separate DSE instance and is meant for development and testing only.

docker run --name stargate \
  -p 8080:8080 \
  -p 8081:8081 \
  -p 8082:8082 \
  -p 127.0.0.1:9042:9042 \
  -d \
  -e CLUSTER_NAME=stargate \
  -e CLUSTER_VERSION=6.8 \
  -e DEVELOPER_MODE=true \
  stargateio/stargate-dse-68:v1.0.57

Access Prometheus

Once all the images are running, you can access Prometheus in the browser at https://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 https://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.