OpenGate/ Docs

Metrics

OpenGate IAM exposes Prometheus-compatible metrics on every service via Spring Boot Actuator. Scrape with Prometheus and visualize in Grafana.

On this page


Key Metrics

HTTP Metrics

MetricDescription
http_server_requests_seconds_countTotal HTTP request count per endpoint
http_server_requests_seconds_sumTotal request duration
http_server_requests_seconds_maxMax request duration

JVM Metrics

MetricDescription
jvm_memory_used_bytesJVM heap and non-heap usage
jvm_gc_pause_secondsGC pause duration
jvm_threads_live_threadsActive thread count

Database Metrics (HikariCP)

MetricDescription
hikaricp_connections_activeActive DB connections
hikaricp_connections_pendingWaiting for connection
hikaricp_connections_timeout_totalConnection timeout count

Custom Auth Metrics

MetricDescription
opengate_login_success_totalSuccessful logins per realm
opengate_login_failure_totalFailed logins per realm
opengate_token_issued_totalTokens issued per grant type
opengate_session_created_totalSessions created
opengate_mfa_challenge_totalMFA challenges issued

Prometheus Scrape Config

prometheus.ymlyaml
global:
scrape_interval: 15s

scrape_configs:
- job_name: 'opengate-gateway'
  static_configs:
    - targets: ['localhost:8080']
  metrics_path: /actuator/prometheus

- job_name: 'opengate-auth'
  static_configs:
    - targets: ['localhost:8081']
  metrics_path: /actuator/prometheus

- job_name: 'opengate-user'
  static_configs:
    - targets: ['localhost:8082']
  metrics_path: /actuator/prometheus

# Repeat for ports 8083–8089...

Run Prometheus with Docker:

docker run -d \
-p 9090:9090 \
-v $(pwd)/prometheus.yml:/etc/prometheus/prometheus.yml \
prom/prometheus:latest

Grafana Setup

docker-compose.observability.ymlyaml
services:
prometheus:
  image: prom/prometheus:latest
  ports: ["9090:9090"]
  volumes:
    - ./prometheus.yml:/etc/prometheus/prometheus.yml

grafana:
  image: grafana/grafana:latest
  ports: ["3002:3000"]
  environment:
    GF_SECURITY_ADMIN_PASSWORD: admin
  volumes:
    - grafana_data:/var/lib/grafana

volumes:
grafana_data:
  1. Open http://localhost:3002 → Login: admin / admin
  2. Add Prometheus data source: http://prometheus:9090
  3. Import dashboard ID 4701 (JVM Micrometer) from Grafana.com

Alerting Rules

alerts.ymlyaml
groups:
- name: opengate
  rules:
    - alert: HighLoginFailureRate
      expr: rate(opengate_login_failure_total[5m]) > 10
      for: 1m
      labels:
        severity: warning
      annotations:
        summary: "High login failure rate — possible brute force"

    - alert: ServiceDown
      expr: up{job=~"opengate-.*"} == 0
      for: 30s
      labels:
        severity: critical
      annotations:
        summary: "OpenGate service {{ $labels.job }} is down"

Scraping tip

All services run on predictable ports (8080–8089). In Kubernetes, use auto-discovery with pod annotations instead of static targets.