You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: platforms/stellar-disbursement-platform/admin-guide/monitoring.mdx
+50Lines changed: 50 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,3 +4,53 @@ description: Guide to using the Stellar Disbursement Platform CLI
4
4
keywords: [SDP, CLI]
5
5
sidebar_position: 70
6
6
---
7
+
8
+
This guide explains how the Stellar Disbursement Platform (SDP) exposes runtime metrics and how to hook those metrics into the Prometheus + Grafana stack.
9
+
10
+
### Metrics Endpoints
11
+
12
+
Both the Dashboard API and the Transaction Submission Service (TSS) expose Prometheus-compatible `/metrics` endpoints. The HTTP server is defined in [serve_metrics.go](https://github.com/stellar/stellar-disbursement-platform-backend/blob/develop/internal/serve/serve_metrics.go) and is controlled through the following environment variables:
13
+
14
+
-`METRICS_PORT` – Port used by the Dashboard API metrics server (defaults to [8002](https://github.com/stellar/stellar-disbursement-platform-backend/blob/develop/dev/docker-compose-sdp.yml)).
15
+
-`METRICS_TYPE` – Monitoring backend in use (currently `PROMETHEUS`).
16
+
-`TSS_METRICS_PORT` – Port used by the TSS metrics server (defaults to [9002](https://github.com/stellar/stellar-disbursement-platform-backend/blob/develop/dev/docker-compose-tss.yml)).
17
+
-`TSS_METRICS_TYPE` – Monitoring backend for the TSS (defaults to `TSS_PROMETHEUS`).
18
+
19
+
When the server starts, it mounts the `/metrics` route and surfaces request, database, and TSS-specific counters and histograms that align with the Grafana dashboards provided in [Grafana README](https://github.com/stellar/stellar-disbursement-platform-backend/blob/develop/resources/grafana/README.md).
20
+
21
+
### Local Prometheus and Grafana Stack
22
+
23
+
We provide a Docker Compose file that boots Prometheus and Grafana pre-wired to scrape the SDP metrics endpoints.
24
+
25
+
1. From the [repository root](https://github.com/stellar/stellar-disbursement-platform-backend/), run:
26
+
27
+
```sh
28
+
cd dev
29
+
docker compose -p sdp-multi-tenant -f docker-compose-monitoring.yml up -d
30
+
```
31
+
32
+
This launches Prometheus on port `9090` and Grafana on port `3002` by default [monitoring config](https://github.com/stellar/stellar-disbursement-platform-backend/blob/develop/dev/docker-compose-monitoring.yml).
33
+
34
+
2. The Prometheus container loads its configuration from [prometheus config](https://github.com/stellar/stellar-disbursement-platform-backend/blob/develop/dev/prometheus/prometheus.yml), which targets `host.docker.internal:8002/metrics` by default. Adjust the `targets` list if you run the API on a different host or if you want to scrape the TSS metrics (`host.docker.internal:9002`).
35
+
3. Grafana uses the datasource configuration in [datasource](https://github.com/stellar/stellar-disbursement-platform-backend/blob/develop/dev/grafana/datasource.yaml), which points to the Prometheus instance above. If you have an existing Prometheus deployment, update this URL accordingly.
36
+
37
+
To tear down the monitoring stack, run:
38
+
39
+
```sh
40
+
cd dev
41
+
docker compose -p sdp-multi-tenant -f docker-compose-monitoring.yml down
42
+
```
43
+
44
+
### Load the SDP Grafana Dashboard
45
+
46
+
1. Navigate to [http://localhost:3002](http://localhost:3002) and sign in with the default `admin` / `admin` credentials. 
47
+
48
+
2. Click the `+` icon in the top navigation bar (next to the search input), choose `Import dashboard`, and paste the contents of [Grafana Dashboard Json](https://github.com/stellar/stellar-disbursement-platform-backend/blob/develop/resources/grafana/dashboard.json). 
49
+
50
+
3. Select the `prometheus` datasource provided by [datasource](https://github.com/stellar/stellar-disbursement-platform-backend/blob/develop/dev/grafana/datasource.yaml). 
51
+
52
+
This dashboard visualizes HTTP request volume/latency, database query timings, and TSS transaction statistics, details described in [Grafana README.md](https://github.com/stellar/stellar-disbursement-platform-backend/blob/develop/resources/grafana/README.md). All panels can be filtered by method, route, tenant, or instance so you can distinguish traffic between multiple deployments.
53
+
54
+
### Integrating with External Prometheus Instances
55
+
56
+
If you already operate a Prometheus cluster, add scrape jobs equivalent to the ones in [prometheus config](https://github.com/stellar/stellar-disbursement-platform-backend/blob/develop/dev/prometheus/prometheus.yml). Each subsystem exposes metrics at `http://<host>:<METRICS_PORT>/metrics` (Dashboard API) and `http://<host>:<TSS_METRICS_PORT>/metrics` (TSS). [Helm](https://github.com/stellar/stellar-disbursement-platform-backend/blob/develop/helmchart/sdp/values.yaml) deployments expose the same configuration knobs through `sdp.configMap.data.METRICS_*` and `tss.configMap.data.TSS_METRICS_*`. Once the new jobs are present, you can import the same dashboard JSON into your existing Grafana deployment or adapt the PromQL queries to your preferred observability suite.
0 commit comments