Skip to main content

Metrics & Monitoring

Yopass exposes metrics in Prometheus / OpenMetrics format on a dedicated port, separate from the main server port.


Enabling metrics​

yopass-server --metrics-port 9090

Metrics are served at http://host:9090/metrics. The metrics endpoint is intentionally on a separate port so it can be firewalled from public access while remaining reachable by your Prometheus scraper.


Available metrics​

HTTP request metrics​

MetricTypeDescription
yopass_http_requests_totalCounterTotal HTTP requests, labeled by method, path, and code
yopass_http_request_duration_secondsHistogramRequest latency in seconds, labeled by method and path

The path label is the route template, never the raw URL, so secret IDs do not end up in metrics (e.g. /create/secret, /secret/:key, /file/:key, /config). Requests that match no API route, such as frontend assets, are counted under /.

Process metrics​

Available on Linux, which includes the Docker image.

Metric prefixDescription
process_cpu_seconds_totalTotal user/system CPU time
process_open_fdsOpen file descriptors
process_resident_memory_bytesResident memory usage
process_virtual_memory_bytesVirtual memory usage

License metrics​

When --license-key is configured, an additional gauge is registered:

MetricTypeDescription
yopass_license_days_until_expiryGaugeDays until the license expires; negative if already expired

Webhook metrics​

When --webhook-url is configured (see Webhooks), deliveries are counted:

MetricTypeLabelsDescription
yopass_webhook_deliveries_totalCounterevent, outcomeWebhook deliveries by event name and outcome (delivered, failed, dropped)

Email metrics​

When --smtp-host is configured (see Email Notifications), notification mails are counted:

MetricTypeLabelsDescription
yopass_email_deliveries_totalCounterevent, outcomeMails by event name (secret.viewed, request.fulfilled, recipient.code) and outcome

Outcomes: delivered means the mail server accepted the mail. failed means delivery was given up on: the server refused it, could not be reached after the retries, or did not answer in time. dropped means no delivery was completed or tried: the queue was full, the stored address could not be read, or the server was shutting down.


Prometheus configuration​

Add a scrape job to your prometheus.yml:

scrape_configs:
- job_name: yopass
static_configs:
- targets: ["yopass-host:9090"]

For a Docker deployment, use the container name as the target:

scrape_configs:
- job_name: yopass
static_configs:
- targets: ["yopass:9090"]

Docker Compose example​

services:
yopass:
image: jhaals/yopass:latest
ports:
- "1337:1337"
- "9090:9090" # metrics — restrict this in production
environment:
DATABASE: redis
REDIS: redis://valkey:6379/0
METRICS_PORT: "9090"
depends_on:
- valkey

valkey:
image: valkey/valkey:8-alpine
command: valkey-server --save "" --appendonly no

prometheus:
image: prom/prometheus
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- "9091:9090"

grafana:
image: grafana/grafana
ports:
- "3000:3000"
depends_on:
- prometheus

Example alerting rules​

Save as yopass-alerts.yml and reference it from your Prometheus configuration:

groups:
- name: yopass
rules:
- alert: YopassHighErrorRate
expr: |
sum(rate(yopass_http_requests_total{code=~"5.."}[5m]))
/
sum(rate(yopass_http_requests_total[5m])) > 0.05
for: 5m
labels:
severity: warning
annotations:
summary: "Yopass HTTP error rate above 5%"

- alert: YopassHighLatency
expr: |
histogram_quantile(0.95,
sum by (le, path) (rate(yopass_http_request_duration_seconds_bucket[5m]))
) > 2
for: 5m
labels:
severity: warning
annotations:
summary: "Yopass p95 latency above 2s on {{ $labels.path }}"

- alert: YopassLicenseExpiringSoon
expr: yopass_license_days_until_expiry < 14
labels:
severity: warning
annotations:
summary: "Yopass license expires in {{ $value | printf \"%.0f\" }} days"

- alert: YopassLicenseExpired
expr: yopass_license_days_until_expiry < 0
labels:
severity: critical
annotations:
summary: "Yopass license has expired"

Grafana dashboard​

A minimal dashboard query set for the Grafana UI:

Request rate (per second):

sum(rate(yopass_http_requests_total[1m])) by (path)

Error rate:

sum(rate(yopass_http_requests_total{code=~"5.."}[1m])) by (path)

p95 latency:

histogram_quantile(0.95, sum(rate(yopass_http_request_duration_seconds_bucket[5m])) by (le, path))

Memory usage:

process_resident_memory_bytes{job="yopass"}

Securing the metrics endpoint​

The metrics endpoint has no authentication. In production, restrict access at the network level:

Firewall (ufw):

ufw allow from 10.0.0.0/8 to any port 9090
ufw deny 9090

Nginx basic auth in front of metrics. Nginx listens on its own port, since Yopass already holds 9090. Point Prometheus at 9091 with the credentials, and keep 9090 closed to everything but Nginx, or clients can skip the password by scraping it directly:

server {
listen 9091;
location /metrics {
auth_basic "Prometheus";
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_pass http://127.0.0.1:9090;
}
}

Docker: do not expose the port publicly. In Docker Compose, omit the host-side port binding and let Prometheus scrape via the internal network:

# Expose to internal network only — no host port mapping
yopass:
environment:
METRICS_PORT: "9090"
# No "ports:" entry for 9090

Flags​

FlagEnv varDefaultDescription
--metrics-portMETRICS_PORT-1Port for the metrics server. Set to a positive integer to enable.