Prometheus Metrics Endpoint
Mango exposes its internal system metrics in Prometheus exposition format for scraping by external monitoring tools such as Prometheus and Grafana. This allows you to monitor Mango alongside other services in your existing observability infrastructure.
This feature was added in Mango 5.6.0 (MANGO-2155).
Overview
Mango provides two ways to expose metrics:
| Method | Endpoint | Authentication | Use case |
|---|---|---|---|
| REST API (default) | /rest/latest/system-metrics/prometheus | Required (superadmin) | Secure scraping from a Prometheus server that supports authentication |
| Dedicated metrics server | GET /metrics on a separate port | Optional (anonymous) | Scraping from infrastructure that cannot send credentials |
REST API Endpoint
The primary metrics endpoint is part of the Mango REST API:
GET /rest/latest/system-metrics/prometheus
Authentication
Requests must be authenticated as a superadmin user by default. Access can be granted to other roles via a system permission.
To configure access:
- Navigate to Administration > System Settings > Permissions.
- Find the System metrics permission.
- Add the roles or users that should be allowed to read metrics.
Scraping with Basic Authentication
To scrape from Prometheus with HTTP basic authentication, add a basic_auth block to your Prometheus job configuration:
scrape_configs:
- job_name: mango
scrape_interval: 30s
scheme: https
static_configs:
- targets: ['your-mango-host:8443']
metrics_path: /rest/latest/system-metrics/prometheus
basic_auth:
username: admin
password: <mango-admin-password>
Scraping with Bearer Token
Alternatively, use a Mango API token:
scrape_configs:
- job_name: mango
metrics_path: /rest/latest/system-metrics/prometheus
static_configs:
- targets: ['your-mango-host:8443']
authorization:
credentials: <your-mango-api-token>
Dedicated Metrics Server (Anonymous Access)
For environments where the Prometheus scraper cannot send authentication credentials, Mango can run a separate lightweight HTTP server that exposes metrics without authentication.
Enabling the Metrics Server
Add the following to your mango.properties file:
metrics.server.enabled=true
By default, the metrics server listens on a different port than the main Mango server. Check the mango.properties reference for the default port and additional options such as:
# Enable the dedicated metrics HTTP server
metrics.server.enabled=true
# Port for the metrics server (check mango.properties for default)
# metrics.server.port=9090
Restart Mango after changing mango.properties.
Endpoint
Once enabled, metrics are available at:
GET http://your-mango-host:<metrics-port>/metrics
No authentication is required. Secure this port at the network level — do not expose it to untrusted networks.
Prometheus Configuration (No Auth)
scrape_configs:
- job_name: mango
scrape_interval: 30s
static_configs:
- targets: ['your-mango-host:9090']
metrics_path: /metrics
Available Metrics
Mango exposes metrics about its internal runtime, including:
- JVM metrics — heap and non-heap memory usage, GC activity, thread counts, class loading
- Work item queue — queue depth, processing times, and throughput
- Data point values — point value insertion rates and counts
- HTTP requests — request counts and response times for the REST API
- Database connection pool — pool size, active connections, wait times
- Background tasks — counts and durations of scheduled tasks
For a live list of all exposed metric names and their current values, query the endpoint directly and inspect the output.
Grafana Integration
The Mango Prometheus endpoint works with any Grafana setup that has a Prometheus data source configured.
- Add Prometheus as a data source in Grafana (or ensure it exists).
- Configure Prometheus to scrape Mango as described above.
- In Grafana, use the Explore view to browse available
mango_*metrics. - Build dashboards using Mango metrics alongside metrics from other services.
Security Considerations
| Consideration | Recommendation |
|---|---|
| REST API endpoint | Use HTTPS and a dedicated read-only role for the Prometheus scraper user. |
| Dedicated metrics server | Do not expose the metrics port to untrusted networks. Use firewall rules to restrict access to your Prometheus server only. |
| Metric content | Metrics expose operational data (queue depths, memory, request rates). They do not expose point values or configuration. |
Troubleshooting
| Symptom | Cause | Resolution |
|---|---|---|
| 401 Unauthorized from REST endpoint | Wrong credentials or insufficient permissions | Verify the scraper user exists and has the system metrics permission. |
| 404 Not Found from REST endpoint | Mango version older than 5.6.0 | Upgrade Mango to 5.6.0 or later. |
| Metrics server not responding | metrics.server.enabled not set, or Mango not restarted | Set metrics.server.enabled=true in mango.properties and restart Mango. |
| Prometheus shows stale or no metrics | Scrape interval too long or Mango is slow to respond | Increase Prometheus scrape_timeout to at least 15s for Mango. |
Related Pages
- Internal Metrics — Viewing Mango's built-in metrics in the UI
- Debug Logging — Enable debug logging to troubleshoot Mango performance
- Mango Properties Reference — Full
mango.propertiesconfiguration options includingmetrics.server.* - Work Items — Understanding and monitoring the Mango work item queue