title: 'Grafana & Prometheus'
sidebar_label: 'Grafana & Prometheus'
description: 'Monitoring Spice instances with Grafana & Prometheus'
pagination_prev: 'clients/index'
pagination_next: null
Spice can be monitored with Grafana (opens in a new tab) using the Spice Metrics Endpoint (opens in a new tab) and pre-built dashboards available in the Spice repository (opens in a new tab).
Import Grafana Dashboard
Navigate to the Dashboards section in Grafana and click "New" > "Import".
Copy the dashboard JSON from monitoring/grafana-dashboard.json (opens in a new tab) into the Grafana import box.
Click "Load".
Kubernetes
View the Kubernetes (opens in a new tab) deployment guide for configuring the Prometheus Operator to scrape metrics from the Spice instances in Kubernetes.
Prometheus
Configure a Prometheus instance to scrape metrics from the Spice runtimes.
global:
scrape_interval: 1s
scrape_configs:
- job_name: spiceai
static_configs:
- targets: ['127.0.0.1:9090'] # Change to your Spice runtime endpoint + port
global:
scrape_interval: 1s
scrape_configs:
- job_name: spiceai
static_configs:
- targets: ['127.0.0.1:9090'] # Change to your Spice runtime endpoint + port
Local Quickstart
This tutorial creates and configures Grafana and Prometheus locally to scrape and display metrics from several Spice instances. It assumes:
- Two Spice runtimes,
spiced-main and spiced-edge, are running on 127.0.0.1:9091 and 127.0.0.1:9092 respectively.
-
Create a compose.yaml:
version: '3'
services:
prometheus:
image: prom/prometheus:latest
volumes:
- ./prometheus.yaml:/etc/prometheus/prometheus.yml
ports:
- 9090:9090
network_mode: 'host'
grafana:
image: grafana/grafana:latest
volumes:
- ./.grafana/provisioning:/etc/grafana/provisioning
ports:
- 3000:3000
network_mode: 'host'
version: '3'
services:
prometheus:
image: prom/prometheus:latest
volumes:
- ./prometheus.yaml:/etc/prometheus/prometheus.yml
ports:
- 9090:9090
network_mode: 'host'
grafana:
image: grafana/grafana:latest
volumes:
- ./.grafana/provisioning:/etc/grafana/provisioning
ports:
- 3000:3000
network_mode: 'host'
-
Create a prometheus.yaml to
global:
scrape_interval: 1s
scrape_configs:
- job_name: spiced-main
static_configs:
- targets: ['127.0.0.1:9091']
- job_name: spiced-edge
static_configs:
- targets: ['127.0.0.1:9092']
global:
scrape_interval: 1s
scrape_configs:
- job_name: spiced-main
static_configs:
- targets: ['127.0.0.1:9091']
- job_name: spiced-edge
static_configs:
- targets: ['127.0.0.1:9092']
-
Add a prometheus as a source to grafana. Create a .grafana/provisioning/datasources/prometheus.yml
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://localhost:9090
isDefault: true
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://localhost:9090
isDefault: true
-
Run the Docker Compose
-
Go to http://localhost:3000/dashboard/import and add the JSON from monitoring/grafana-dashboard.json (opens in a new tab).
-
The dashboard will have data from the Spice runtimes.