Skip to main content

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:

MethodEndpointAuthenticationUse case
REST API (default)/rest/latest/system-metrics/prometheusRequired (superadmin)Secure scraping from a Prometheus server that supports authentication
Dedicated metrics serverGET /metrics on a separate portOptional (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:

  1. Navigate to Administration > System Settings > Permissions.
  2. Find the System metrics permission.
  3. 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.

  1. Add Prometheus as a data source in Grafana (or ensure it exists).
  2. Configure Prometheus to scrape Mango as described above.
  3. In Grafana, use the Explore view to browse available mango_* metrics.
  4. Build dashboards using Mango metrics alongside metrics from other services.

Security Considerations

ConsiderationRecommendation
REST API endpointUse HTTPS and a dedicated read-only role for the Prometheus scraper user.
Dedicated metrics serverDo not expose the metrics port to untrusted networks. Use firewall rules to restrict access to your Prometheus server only.
Metric contentMetrics expose operational data (queue depths, memory, request rates). They do not expose point values or configuration.

Troubleshooting

SymptomCauseResolution
401 Unauthorized from REST endpointWrong credentials or insufficient permissionsVerify the scraper user exists and has the system metrics permission.
404 Not Found from REST endpointMango version older than 5.6.0Upgrade Mango to 5.6.0 or later.
Metrics server not respondingmetrics.server.enabled not set, or Mango not restartedSet metrics.server.enabled=true in mango.properties and restart Mango.
Prometheus shows stale or no metricsScrape interval too long or Mango is slow to respondIncrease Prometheus scrape_timeout to at least 15s for Mango.