Prometheus and Grafana monitoring for HAPI FHIR

A practical plan for scraping HAPI FHIR metrics with Prometheus, visualizing JVM and connection pool health in Grafana, and alerting on errors, latency and database saturation.

On this page

Why HAPI FHIR monitoring with Prometheus and Grafana needs a plan before go-live

Prometheus collects time-series metrics from your HAPI FHIR server and its database host, and Grafana turns those numbers into dashboards and alerts your team can read at a glance. If a clinical or integration FHIR server runs in your own infrastructure, someone must watch its request rates, error responses, latency and database connections every day, and that watching needs to be designed before go-live, not added after the first incident. The HAPI FHIR JPA server starter can be deployed as a Docker image, on Tomcat, Jetty or Wildfly, or on Kubernetes with a Helm chart, so the exact metrics endpoint depends on your build and how it is exposed. Confirm which endpoint your build serves, whether it requires authentication, and which network path Prometheus will use to reach it before you write any scrape configuration.

Prometheus is pull-based: it fetches metrics over HTTP from targets it discovers through service discovery or static configuration, so the server must be reachable from the Prometheus host and the scrape interval becomes a decision you own. Local Prometheus storage is a single-node database that is not clustered or replicated, and its default retention is 15 days unless you configure time or size limits. Plan where long-term data goes, using remote write to an external system if you need history beyond that window, and decide who will patch and back up the Prometheus host. Grafana needs its own database for configuration in production, since the installation docs say SQLite does not scale and MySQL or PostgreSQL is required for production and high availability.

Teams need this setup when the FHIR server supports live clinical or partner workflows and an outage or slow search would be noticed by users before engineers. Before go-live, agree on the alert recipients, the on-call path through Alertmanager, and the threshold owners for error rates, latency and database saturation. Write those decisions down, because alert rules that nobody owns tend to be silenced rather than tuned.

How metrics and alerts flow from the HAPI FHIR server to operators

The flow starts at the HAPI FHIR JPA server pod, which exposes a metrics endpoint that Prometheus scrapes through a ServiceMonitor or a static target. Prometheus keeps samples in its local time series store and evaluates alert rules, then hands firing alerts to Alertmanager, which groups and routes them. Grafana reads from Prometheus for dashboards and keeps its own configuration in PostgreSQL, outside the cluster trust boundary. Check that the metrics endpoint requires authentication and that Prometheus points at every Alertmanager instance.

Metrics and alert paths from the FHIR server to operators, with the cluster trust boundary.

Which monitoring deployment fits your team and environment

This table compares the main deployment choices for Prometheus and Grafana around a HAPI FHIR server, from scrape method to Grafana edition. Read each row against your platform, your on-call model and your audit requirements, then choose the option that matches your current environment and the next step you expect to take.

DecisionOption AOption BChoose when
Scrape methodPrometheus Operator with a ServiceMonitor on Kubernetes, where the HAPI FHIR Service is discovered by label and scrape config is managed as Kubernetes objectsStatic scrape configuration on virtual machines, where each HAPI FHIR node is listed in the Prometheus configuration fileOption A fits if HAPI FHIR already runs on the Helm chart. Option B fits if it runs as a WAR or Docker container on VMs and your team edits configuration by hand
Prometheus storageSingle Prometheus server with local storage, which the Prometheus storage docs say is not clustered or replicated and must be managed like any single-node databaseSingle Prometheus plus remote write to external long-term storage, which keeps history beyond local retention and moves storage sizing outside the scraperOption A fits short retention needs and small teams. Option B fits audit or capacity-review requirements for longer metric history
Grafana instancesSingle Grafana server, backed by SQLite by default, which the Grafana installation docs say does not scale for productionTwo or more active-active Grafana servers behind a load balancer sharing MySQL or PostgreSQL, as described in the Grafana high availability docsOption A fits a lab or a single-team dashboard. Option B fits production use, where alerting needs extra configuration to avoid duplicate notifications
Grafana editionGrafana Open Source, which supports LDAP, generic OAuth, Entra ID, Okta and other listed methods but not SAML, team sync, active sync or SCIMGrafana Enterprise, which adds SAML, team sync, active sync and SCIM provisioning according to the Grafana authentication docsOption A fits when your identity provider supports OAuth or OIDC and you do not need SCIM. Option B fits when your access policy requires SAML or automated user provisioning
Alert routingSingle Alertmanager instance, which is simpler to run but has no built-in high availabilityClustered Alertmanager using its cluster flags, with Prometheus pointed at every instance rather than a load balancerOption A fits low-stakes alerts and a single site. Option B fits on-call paths where a lost alert would delay response to HAPI FHIR outages
Configuration as codeManual dashboard and data source setup in the Grafana interfaceGrafana provisioning with YAML or JSON files loaded at startup, with Terraform or Git Sync as further as-code optionsOption A fits a short pilot. Option B fits teams that need reviewable change history and repeatable rebuilds across environments

Setting up scraping, dashboards and alerts step by step

This sequence takes a HAPI FHIR server from an unmonitored endpoint to a working set of scrape targets, Grafana dashboards provisioned as code, and alert rules that have each been tested with a deliberate failure. Each step ends with a check you can run before moving on.

  1. Confirm and secure the metrics endpoint

    Start by identifying which metrics endpoint your HAPI FHIR deployment exposes, since the path and whether it is enabled depend on the version and configuration in use. Confirm the exact metric names against the HAPI FHIR version you run, because names can change between releases. Restrict access to the endpoint to the Prometheus scraper, for example through network policy or a separate management port, so that the FHIR API and its metrics are not exposed to the same audience. Verification: request the endpoint from the scraper's network segment and from an outside network, and confirm that only the scraper succeeds. Record the metric names you will alert on in your runbook.

  2. Deploy Prometheus with a scrape configuration

    The platform team deploys Prometheus in a cluster or host they control, using a ServiceMonitor if the HAPI FHIR deployment runs on Kubernetes with the Prometheus Operator, or a static or service discovery scrape job otherwise. Set the scrape interval and retention to values your team agrees on, and plan disk for the local time series database, since local storage is single-node and is not replicated. Decide early whether long-term storage will go through remote write to an external system. Verification: the configuration validates, and the Prometheus server starts and shows its configuration on the status page without errors.

  3. Verify that scrape targets are up

    Open the targets view in the Prometheus web interface and confirm that the HAPI FHIR job appears with every expected pod or instance in the UP state. Run a simple query for the up metric for that job to confirm the same result from PromQL. Check the labels attached to each target, since dashboards and alerts will rely on them to separate instances, environments and tenants. If a target is down, fix the network path, port or authentication before continuing, because every later panel and alert depends on this data. Verification: each instance returns a value of 1 for the up metric over a short window.

  4. Deploy Alertmanager as a cluster

    Deploy Alertmanager with the cluster flags enabled so that multiple instances share notification state and silences. Configure Prometheus to send alerts to every Alertmanager instance directly, not through a load balancer, as the Alertmanager documentation describes. Define receivers for your on-call tool and set grouping and inhibition rules for the alert families you will add. Decide who owns the receiver credentials and where they are stored. Verification: a test alert sent from Prometheus reaches the receiver once, and stopping one Alertmanager instance does not stop notifications.

  5. Provision Grafana data sources and dashboards as code

    Deploy Grafana with a production-grade configuration database, since the installation guidance says SQLite does not scale for production and high availability needs MySQL or PostgreSQL. Define the Prometheus data source and the HAPI FHIR dashboards in YAML or JSON provisioning files, store them in version control, and load them at startup. Apply the security hardening settings your team has agreed on, including the setting that requires authentication for the metrics endpoint. Verification: after a clean restart, the data source tests successfully and the dashboards appear without anyone having created them by hand.

  6. Build JVM and connection pool panels

    Using the metric names you confirmed in the first step, build panels for JVM heap use, garbage collection pauses, thread counts and the database connection pool, including active, idle and pending connections. Add request rate, error rate and latency panels per operation or resource type where the metrics allow it. Keep the database saturation panels next to the pool panels so that an operator can compare them during an incident. Save the panels in the provisioned dashboard files. Verification: run a short load test against a non-production server and confirm that pool and heap panels move as expected.

  7. Write alert rules for errors, latency and saturation

    Write Prometheus alert rules for three conditions: a sustained rise in server error responses, high latency at a chosen percentile over a defined window, and database connection pool saturation or pending waits. Set thresholds from a baseline measured in your own environment, not from published examples, and use a for duration so that brief spikes do not page anyone. Add the rules to version control and load them through the Prometheus rule configuration. Verification: each rule appears on the rules page in the expected state, and the rule file passes validation before deployment.

  8. Test each alert with a deliberate failure

    For each alert, create a controlled condition in a non-production environment that should trigger it, such as a burst of invalid requests, an artificial delay, or a constrained connection pool. Confirm that the alert moves to firing in Prometheus, that Alertmanager groups and routes it, and that the receiver gets exactly one notification. Then remove the condition and confirm the alert resolves. Record the result of each test, including the threshold and window that fired, in the runbook. Verification: every alert has a recorded test showing firing, notification and resolution, and any alert that did not fire is revised before go-live.

Securing the metrics path and Grafana access

Metrics and dashboards often expose more than teams expect: endpoints that reveal server internals, labels that carry patient identifiers, and consoles that can change alerting. The cards below cover the controls that keep the monitoring stack from becoming a second path into HAPI FHIR data, and the limits of what Prometheus records.

Authenticate the metrics endpoint

The HAPI FHIR metrics endpoint and Prometheus scrape targets should not be readable by anonymous network users. Decide how Prometheus authenticates to each target, such as a bearer token or a TLS client certificate, and store that credential in a secret manager rather than in the scrape configuration file. Check that a request without credentials is refused on every path that returns metrics, including any that a reverse proxy or ingress exposes.

Prometheus security model

Keep PHI out of labels and alerts

Prometheus labels become part of every series, and alert payloads are copied into Alertmanager, chat channels and email. Patient identifiers, MRNs, names or raw request paths that embed identifiers must never become label values or annotation text. Review each custom metric and alert template with your privacy officer, and use resource types or route templates instead of concrete IDs.

Restrict Prometheus and Alertmanager access

Limit network paths so that only Prometheus can reach the HAPI FHIR metrics port, and only Grafana and Prometheus can reach the Prometheus API. Prometheus should list every Alertmanager instance directly, and the Alertmanager cluster ports should be reachable only between its own members. Confirm these rules with network policies or firewall rules and test them from a host outside the monitoring network.

Alertmanager docs

Harden Grafana cookies and browser policy

Grafana's security hardening guidance recommends secure and SameSite cookies, a Content Security Policy, Trusted Types, and hiding the version from unauthenticated users. Set these in the Grafana configuration file and confirm them in the browser developer tools after a login. Require authentication for Grafana's own metrics endpoint, and enable domain verification to block DNS rebinding attempts against the instance.

Grafana hardening docs

Choose SSO by Grafana edition

Grafana's authentication docs list LDAP, generic OAuth, Entra ID, Okta, GitHub, GitLab, Google OAuth, auth proxy and JWT as available in all editions. SAML, team sync, active sync and SCIM provisioning are limited to Grafana Enterprise and Grafana Cloud. If your identity provider speaks only SAML or your access reviews depend on SCIM, confirm the edition and license terms before the design is fixed.

Grafana authentication docs

Prometheus is not an audit record

The Prometheus documentation says it values reliability over precision and is not a good choice where 100 percent accuracy is required. Scrapes can be missed, samples can be dropped during restarts, and default local retention is short. Use HAPI FHIR audit logging (BALP) and application logs as the record of who accessed data, and treat metrics as operational signals only.

Default local retention
15 days

Day-two operations: upgrades, retention and dashboard ownership

Prometheus ships a new minor release every 6 weeks, and a minor release generally stops receiving bug fixes once that cycle ends. Teams that run a minor version in production therefore need an upgrade routine, not a one-time install. Prometheus also publishes long-term support lines that receive bug fixes for one year. The current LTS line is 3.13, released July 1, 2026 and supported until July 31, 2027, so a platform team can stay on one line and take patch releases without tracking every minor version.

  • Pick a support model: Decide between following minor releases on a 6-week rhythm or staying on the LTS line and applying patch releases.
  • Read release notes before each change: Check for changes to PromQL behavior, configuration keys and feature flags.
  • Snapshot before upgrading: Back up the data directory and configuration so a rollback is possible.
  • Test rules and scrape configs: Validate changed configuration and alert rules against a staging instance before production.
  • Track end-of-life dates: Record the support end date of the running line in your operations calendar.

Before the next change window, confirm which line you run and whether your planned version is still supported on the date of the upgrade.

Limits to confirm before you commit to this design

The monitoring stack for HAPI FHIR is only as dependable as its weakest component, and several of those limits are set by the tools themselves rather than by the design. Confirm each one below against your own environment, your licensing needs and your HAPI FHIR version before you approve the architecture.

Prometheus storage is single-node

Local Prometheus storage is not clustered or replicated, so it should be run and recovered like any other single-node database. If a server or disk is lost, the local history goes with it unless you have configured remote write to external long-term storage. Confirm how long you must keep metrics, who owns the storage volume, and how a failed Prometheus instance will be rebuilt and how quickly its alerts must resume.

Default local retention
15 days
Prometheus storage docs

Grafana HA needs extra alerting setup

Grafana high availability uses two or more active-active servers behind a load balancer sharing a MySQL or PostgreSQL database. The documentation notes that alerting needs additional configuration to avoid duplicate notifications, so a clinical or operations alert could page your on-call team twice or not at all if this is left unplanned. Test alert delivery during failover, not only during normal operation.

Grafana HA setup guide

Grafana Live has HA limits

Grafana Live, which pushes live updates to open dashboards, has limitations when Grafana runs in a high availability configuration. Decide whether your operators depend on live dashboard refresh during incidents or whether scheduled refresh is acceptable. Confirm the current limitations for your Grafana version before you promise real-time views to an on-call team.

Metric names depend on versions

The metric names, labels and endpoint behavior that the dashboards and alert rules depend on come from the HAPI FHIR server and its starter, and can change between releases. Record the exact HAPI FHIR version and starter image you deploy, then check that every panel and alert query returns data after each upgrade. Treat dashboards as version-specific artifacts that move through the same change process as the server.

HAPI FHIR versions

Grafana is AGPLv3 with an Enterprise option

Grafana, Loki and Tempo moved from Apache License 2.0 to AGPLv3 in April 2021, while plugins and SDKs kept other licenses. Have legal review how AGPLv3 applies to your use, including any modifications you make and any service you expose to users. Also decide whether SAML, team sync and SCIM provisioning are needed, since the authentication docs limit them to Grafana Enterprise and Grafana Cloud.

Grafana licensing page

Cloud pricing does not replace the design

Grafana Cloud has a free tier, a Pro tier with a monthly platform fee plus usage, and an Enterprise tier with a stated annual minimum. Those prices cover Grafana Cloud only. A hosted service does not decide where your metrics live, how long they are retained, or whether they can leave your infrastructure, so the on-premises design still has to be planned. Ask any vendor for a written quote that lists usage assumptions, retention and data residency.

Grafana pricing page

What teams ask before hiring help with HAPI FHIR monitoring

What drives the cost of setting up Prometheus and Grafana for HAPI FHIR?

The main cost driver is how much of the monitoring stack is new to your environment and how many systems must be wired in. Prometheus is licensed under Apache-2.0 and has no paid edition, so the spend is infrastructure, storage, implementation labor and the people who run it. Cost rises with the number of HAPI FHIR nodes, the database and any other services you want to scrape, whether you already run a Prometheus Operator, how many dashboards and alert rules you need, and whether you add long-term storage. Grafana's self-managed editions are also a cost line to check, because its licensing has changed over time. Ask any partner for a quote that separates one-time build work from recurring operations work and lists each component you will own.

How long does a Prometheus and Grafana monitoring setup take?

Duration depends on the size of the HAPI FHIR deployment, how many metric sources need wiring, and how many decisions the team has already made. The work usually runs in phases: confirming the metrics endpoint and scrape path, creating a ServiceMonitor or static scrape configuration, building JVM and connection pool dashboards, writing alert rules, and then testing those alerts against real failures. Each phase waits on different people, such as cluster administrators for network policy and on-call owners for thresholds. No duration is stated here because it depends on your environment, so ask for a timeline tied to a written scope with named deliverables and dependencies.

What must our team provide before monitoring work starts?

Most delays come from missing access and missing decisions, not from the tooling itself. Plan to provide:

  • Cluster or host access with rights to create ServiceMonitor or scrape resources and to deploy Prometheus and Grafana
  • A decision on how the HAPI FHIR metrics endpoint is exposed, and whether it requires authentication
  • Named on-call owners who will receive alerts and confirm what a page should mean
  • Agreed alert thresholds for error rates, latency and database saturation, based on your service level targets
  • Storage and retention requirements, since Prometheus keeps local data for 15 days by default

Confirm these items in writing before the engagement starts.

Can our internal platform team set up HAPI FHIR monitoring alone?

Often yes, if the team already runs Kubernetes or Linux servers, operates a database and has someone comfortable with PromQL. The gaps tend to be the HAPI FHIR-specific parts: knowing which JVM and connection pool metrics matter, choosing alert thresholds that do not page constantly, and making Grafana production-ready. Grafana's own documentation says SQLite does not scale for production, so a production setup needs MySQL or PostgreSQL, and high availability needs additional alerting configuration to avoid duplicate notifications. Be honest about bandwidth. An internal team can build the stack, but it also needs time to test failures and keep the stack patched. A partner can take the build while your staff own the runbooks.

What security settings should we review in Grafana before going live?

Review the Grafana security hardening guidance before exposing dashboards to clinicians, analysts or operators. Confirm that cookies are secure and use SameSite, that a Content Security Policy is set, and that the version is hidden from unauthenticated users. Require authentication for the metrics endpoint, and set domain verification against DNS rebinding. Also decide how people sign in. Per the Grafana authentication documentation, SAML, team sync, active sync and SCIM provisioning are limited to Grafana Enterprise and Grafana Cloud, so confirm whether your identity provider needs one of those features. Dashboards may reveal patient volumes or internal service names, so review what labels you export into metrics.

What ongoing work follows once monitoring is live?

Monitoring needs routine upkeep. Prometheus releases a new minor version about every 6 weeks, and a minor release generally stops receiving bug fixes after those 6 weeks, so plan upgrades or move to the long-term support line. The current LTS line is 3.13, supported until July 31, 2027, per the Prometheus release cycle page. Grafana publishes patch releases at least monthly, and each minor release is supported for 9 months. Recurring tasks include applying upgrades, reviewing alert noise, adjusting thresholds as traffic grows, rotating credentials, checking storage and retention, and testing alert routes. Ask any partner whether a retainer covers these tasks and how upgrades are tested first.

Does Prometheus replace a full observability platform for HAPI FHIR?

No, it covers metrics and alerting, not every signal. The Prometheus storage documentation says local storage is not clustered or replicated, so it must be run like any single-node database, and long-term retention needs remote write to an external system. Prometheus also values reliability over precision, so it is not the right tool where every request must be counted exactly, such as per-request billing. Traces and logs are handled by other tools in the same family, and Alertmanager should be run with every instance listed in Prometheus rather than behind a load balancer. Decide early which signals each tool owns so alerts do not duplicate.

Is Prometheus monitoring licensed for commercial use?

Yes, Prometheus is licensed under Apache-2.0 according to its GitHub repository, and the project has no paid enterprise edition. Grafana needs a closer look. In April 2021, Grafana Labs relicensed Grafana from Apache License 2.0 to AGPLv3, and Grafana Enterprise is offered as a separate commercial option. Your legal team should review whether AGPLv3 terms fit how you will run and modify Grafana, particularly if you expose it to outside users. Also confirm that any plugins you install carry licenses you accept, since the licensing page notes that plugins kept other licenses.

Official Prometheus and Grafana documentation to read next

Start with the Prometheus storage documentation before you size the monitoring host for a HAPI FHIR server. It states that local storage is not clustered or replicated and should be managed like any other single-node database, and the default retention of 15 days is configurable by time or size. Your retention decision for JVM, connection pool and HTTP latency series depends on that text, and so does whether you plan remote write to long-term storage. Read the Prometheus storage docs alongside the Prometheus release cycle and long-term support page, which tells you how long a minor release receives fixes and which LTS line to pin for production.

Read the Alertmanager documentation before writing any alert rule for error rates, latency or database saturation. Confirm how your team wants grouping, inhibition and silences to behave for a clinical system, and whether Alertmanager will run as a cluster using its cluster flags. Prometheus should point at every Alertmanager instance rather than a load balancer, which affects how your ServiceMonitor and Prometheus configuration are written.

On the Grafana side, read the Grafana high availability guide if more than one Grafana instance is planned, since it notes that alerting needs extra configuration to avoid duplicate notifications. Then read the Grafana provisioning documentation so data sources and dashboards for the HAPI FHIR server are defined as files under version control, and the Grafana security hardening guide, which covers requiring authentication for the metrics endpoint. Confirm current behavior against the version you deploy, since the supplied material lists recent releases only as dated facts.

How DeployOpen scopes, delivers and supports HAPI FHIR monitoring

DeployOpen plans, builds and hands over Prometheus and Grafana monitoring for a HAPI FHIR server inside infrastructure you control. Each engagement starts with a written scope that names the metrics, dashboards, alerts and operating responsibilities before any configuration begins.

How we scope

  • Confirm the HAPI FHIR version, JDK level and deployment method (Docker, Kubernetes, WAR) that metrics collection must cover.
  • Inventory which Prometheus and Grafana instances exist, which ones you operate, and where long-term storage will sit.
  • Agree in writing which dashboards, alert rules and notification routes are in scope, and who receives each alert.

How we build

  • Configure the ServiceMonitor, scrape intervals and label conventions so the HAPI FHIR endpoints are discovered reliably in your cluster.
  • Build JVM, connection pool and request latency dashboards as provisioned files so they can be reviewed and version controlled.
  • Test each alert rule against induced error and saturation conditions in a non-production environment before it is enabled.

How we hand over

  • Deliver a written runbook covering each alert, its likely causes, the first checks to run and the escalation path.
  • Document retention settings, the Alertmanager cluster layout and the metrics endpoint protection applied to Grafana and Prometheus.
  • Walk your platform and on-call teams through the dashboards and alerts, and confirm the handover checklist is signed off.

How we support

  • Engagements are fixed-scope, and ongoing support, upgrades and continuous testing are available as a retainer.
  • Retainers can cover tracking Prometheus and Grafana patch releases and planning upgrades against their published support windows.
  • Review alert noise and dashboard coverage after go-live, and ask your team which additional signals the scope should include.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.