KrakenD Monitoring with Grafana
Ahmet Can Aydemir
Posted on January 17, 2022
KrakenD is an ultra-performant open-source Gateway that can transform, aggregate, or remove data from multiple services, with linear scalability.
I will explain how to monitor the status of KrakenD services with the Grafana dashboard.
Instead of creating a dashboard from scratch, we can use one of the pre-configured dashboards available on grafana.com. In this article, we will use the KrakenD dashboard with ID 5722, prepared by dlopez
. If you want, you can customize the dashboard according to your needs.
By default, this dashboard provides us with the following metrics:
- Requests from users to KrakenD
- Requests from KrakenD to your backends
- Response times
- Memory usage and details
- Endpoints and status codes
- Heatmaps
- Open connections
- Throughput
- Distributions, timers, garbage collection, etc.
Prerequisites
- KrakenD
InfluxDB Setup
The dashboard we will use uses InfluxDB to read metric data. You can easily run InfluxDB with Docker.
docker run -p 8086:8086 \
-e INFLUXDB_DB=krakend \
-e INFLUXDB_USER=myusername -e INFLUXDB_USER_PASSWORD=mypassword \
-e INFLUXDB_ADMIN_USER=admin -e INFLUXDB_ADMIN_PASSWORD=myadminpassword \
-d --name=influx-1.8 \
influxdb:1.8
docker exec -it influx-1.8 /bin/bash
Grafana Setup
If Grafana is not installed, you run it with Docker. After the following command, Grafana will be running at http://localhost:3000
.
docker run \
-d \
-p 3000:3000 \
--name=grafana \
grafana/grafana
KrakenD Configuration
Add the following configuration to your krakend.json at the root level. After this, your KrakenD metrics will start saving to InfluxDB at <your-influx-db-server-ip>:8086
.
{
"version": 2,
"extra_config": {
"github_com/letgoapp/krakend-influx":{
"address":"http://<your-influx-db-server-ip>:8086",
"ttl":"25s",
"buffer_size":0
},
"github_com/devopsfaith/krakend-metrics": {
"collection_time": "30s",
"listen_address": "127.0.0.1:8090"
}
}
}
Importing the Grafana Dashboard
Go to the browser and open
http://localhost:3000
. Useadmin
for both username and passwordClick
Configuration
from the side menu and find the button to add the data source. Select InfluxDB as the database and fill in the details you provided when starting InfluxDB:
- Query Language:
InfluxQL
- URL:
http://localhost:8086
- Access:
Browser
- Database:
krakend
- User:
admin
- Password:
myadminpassword
- HTTP Method:
GET
- To import the dashboard: Click the
+
icon in the side menu from the Grafana interface and then clickImport
. SelectImport via Grafana.com
. Enter5722
as the ID and clickLoad
. Your dashboard is ready, enjoy it.
References
Posted on January 17, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.