Spring Boot Actuator is the starting point for StatLite, the lightweight monitoring tool built at PVR Labs. StatLite 0.9.0 adds six native integrations for Traefik, FastAPI, Django, Flask, Express and Fastify. A single Go binary scrapes the endpoints, stores history in local SQLite and serves the dashboard. The native integrations use the framework’s established metrics library or the proxy’s built-in exporter. They run without a Prometheus server, Grafana or StatLite-specific instrumentation.
The dashboard charts request rates, HTTP errors and average latency where the source provides compatible measurements. Some integrations also provide process CPU, heap or restart signals. The dashboard’s Attention section automatically flags elevated HTTP 5xx rates when enough recent request and error data is available. See the dashboard with simulated traffic.
Choose the metric source that suits the app
| Source | When to use it |
|---|---|
| Spring Boot Actuator | Use the built-in Spring endpoints for HTTP, JVM and process metrics, with health reporting when configured. |
| Framework-native exporter | Scrape an established exporter for application HTTP metrics and the runtime signals that exporter provides. |
| Reverse proxy | Track HTTP traffic by Caddy host or Traefik service with no backend changes. |
| StatLite Metrics v1 | Use the fully supported JSON format for explicit application health, custom instrumentation that maps to supported fields, or apps without a suitable native integration. |
Scrape a framework’s Prometheus metrics directly
Enable the exporter in your app, point a StatLite target at the metrics endpoint, and open the dashboard after two usable polls. In the examples, the app and StatLite share a host. Keep the endpoint on loopback or a private network, and add the target fragment to your existing statlite.yaml. Configure StatLite generates a complete starter file.
For Java, start with the Spring Boot Actuator setup. Quarkus and Micronaut use their Micrometer endpoints. The FastAPI article covers prometheus-fastapi-instrumentator, and the Express article covers express-prom-bundle.
Django with django-prometheus
Install django-prometheus, add django_prometheus to INSTALLED_APPS, and put the exporter’s PrometheusBeforeMiddleware first and PrometheusAfterMiddleware last in MIDDLEWARE. For inline metrics, include the exporter URLs at the root without a namespace:
from django.urls import include, path
urlpatterns += [path("", include("django_prometheus.urls"))]
targets:
- name: django-app
type: django
url: http://127.0.0.1:8000/metrics
django_metrics_mode: inline
Inline mode reports requests and exact 404, 4xx and 5xx counts. For average latency, remove the inline URL include and start a separate Prometheus listener once in the single-process WSGI entry point. It uses the same registry as the Django middleware:
from django.core.wsgi import get_wsgi_application
from prometheus_client import start_http_server
application = get_wsgi_application()
start_http_server(8001, addr="127.0.0.1")
targets:
- name: django-app
type: django
url: http://127.0.0.1:8001/metrics
django_metrics_mode: separate
Use one WSGI process. Both modes can expose process CPU and restart signals with Linux process metrics. Runtime heap and application health are unavailable. Separate-mode latency requires matching histogram and completed-response counts. See the Django target guide.
Flask with prometheus-flask-exporter
Install prometheus-flask-exporter and initialize it with its defaults when creating the app. It serves /metrics on the application listener and excludes its own scrapes.
from flask import Flask
from prometheus_flask_exporter import PrometheusMetrics
app = Flask(__name__)
metrics = PrometheusMetrics(app)
targets:
- name: flask-app
type: flask
url: http://127.0.0.1:8000/metrics
One serving process provides requests, exact 404s, 4xx and 5xx, and average latency when the histogram matches the completed responses. Compatible process metrics add CPU and restart detection. Application health and runtime heap are unavailable. The default exporter uses concrete paths in its histogram. If the scrape exceeds StatLite’s 256-duration-tuple limit, request and error counts continue while latency is unavailable. See the Flask target guide.
Fastify with fastify-metrics
Install fastify-metrics in your Fastify 5 app. Register it before your routes, inside your async startup function. Enable unmatched-route tracking and exclude scrapes from the exporter’s histogram:
await app.register(require('fastify-metrics'), {
routeMetrics: { registeredRoutesOnly: false },
endpoint: { url: '/metrics', config: { disableMetrics: true } },
});
targets:
- name: fastify-app
type: fastify
url: http://127.0.0.1:3000/metrics
The configured recipe covers requests, exact 404s, 4xx and 5xx, and average latency when histogram counts match. It also provides CPU, V8 heap and process restart signals. Use one worker and a direct metrics URL. Application health is unavailable, and exceeding 256 request tuples fails the poll. See the Fastify target guide.
Monitor HTTP traffic at the reverse proxy
If you only need HTTP metrics, collect them at the proxy without changing your backend applications. Caddy reports per-host HTTP metrics. Traefik reports per-service HTTP metrics. In both cases, requests, errors and latency reflect what the proxy sees. Backend application health, CPU, heap and restart information require a direct application integration.
For Traefik, merge a dedicated Prometheus listener into the proxy’s static configuration:
entryPoints:
observability:
address: "127.0.0.1:8082"
metrics:
prometheus:
entryPoint: observability
addServicesLabels: true
Send traffic through the route, then copy the exact service label from traefik_service_requests_total. Include the provider suffix, such as alpha@file:
targets:
- name: alpha-via-traefik
type: traefik
url: http://127.0.0.1:8082/metrics
service: alpha@file
Use a separate StatLite target for each service you want to monitor. The Traefik target guide covers typed inspection, service selection and how reloads affect the baseline.
What StatLite used on a 512 MiB Linux VM
During v0.9.0 certification, we compared v0.8.0 and the v0.9.0 candidate on the same Linux VM, configured with 512 MiB of RAM, one vCPU and no swap. Each build ran twice with three Metrics v1 targets, two-second polls, copies of the same SQLite snapshot and dashboard requests once per second. We observed no meaningful resource regression in those runs. Steady median StatLite RSS was 17.02–17.12 MiB for v0.8.0 and 16.92–16.97 MiB for the v0.9.0 candidate.
In a separate nine-target stress run, six native targets scraped overlapping exporter responses close to the decoded response limit. StatLite peaked at 24.32 MiB RSS. That is resident memory for the StatLite process during this workload. The figure excludes the monitored applications and their exporters, which need their own memory budget.
Get started
Install StatLite, then generate a starter configuration for your integration.
Discussion
Questions, feedback, or suggestions? Join the discussion using your GitHub account.