Medplum OpenTelemetry metrics and traces for self-hosted teams
A self-hosting team that needs to see individual Medplum requests, rather than only aggregate server health, should turn on Medplum's optional OpenTelemetry support. It emits metrics and traces, and a Collector moves that data to a backend where it can be stored and queried. OpenTelemetry is a framework and toolkit for generating, exporting and collecting telemetry. It is not a backend, so storage, query and dashboards are separate choices that your team must make and operate. Load balancer metrics show that latency rose and logs show that errors occurred, but neither shows which step inside a request consumed the time. A trace can show whether the Medplum server, PostgreSQL or Redis accounted for a slow call. If your incidents usually end at the load balancer, that is probably enough for now. If they end at "we cannot tell where it slowed down," traces are the next step.
The main decision is the route. The Collector can run as an agent beside Medplum or as a gateway that receives data from several sources, and each placement changes who patches it and where credentials live. The AWS Distro for OpenTelemetry route sends data to CloudWatch, while Prometheus or another backend needs its own exporter and storage. Before you commit, confirm with the Medplum release notes which signals and exporters your version emits and which configuration keys control them. Then check the stability notes in each Collector component's README, because support levels differ across components. Pin a Collector version in your build, and plan a test of the upgrade path, since the Collector ships new releases frequently. Authenticator extensions can protect receivers and add credentials to exporter requests if the Collector crosses a network boundary.
Plan for cost and data exposure before enabling anything. Backend ingestion and retention charges recur and grow with traffic, so ask your backend vendor or your cloud bill forecast what a sampling rate and retention period will cost. Collector hosting and its upkeep are a second recurring cost, and your team or a partner pays for both. Traces can carry request-level attributes, so review the Collector configuration best practices before sending data outside your network. Ask the implementer for a written list of enabled signals, exporters, sampling settings and retention, and test that no patient identifiers leave the cluster in an unexpected field.
Choosing a backend route: CloudWatch, Prometheus or another tool
This route fits teams that already run a self-hosted Medplum on AWS and want metrics and traces in CloudWatch and AWS X-Ray without operating a separate observability stack. The AWS Distro for OpenTelemetry (ADOT) packages a Collector build that receives telemetry from the Medplum server and exports it to AWS services, so the Collector becomes a component your team deploys and patches alongside the application.
- What you run: an ADOT Collector as a sidecar, daemon or gateway in the same VPC as the Medplum server, with IAM permissions scoped to the metric and trace APIs it writes to.
- Cost driver: CloudWatch and X-Ray charges scale with metric volume and trace volume, so sampling and label cardinality decisions drive the bill.
- Authentication: use Collector authenticator extensions to secure receivers and to add credentials to exporter requests where the chosen components support them.
- Version pinning: confirm the ADOT Collector release, the Medplum server version and the AWS exporter components are compatible before upgrading either side.
- Dashboards: plan CloudWatch dashboards and alarms as separate work, since the Collector only moves data.
Before you commit, confirm with AWS which ADOT release and exporter components support the metric and trace types your Medplum version emits.
This route fits teams that already operate Prometheus and Grafana, or that run Medplum on Kubernetes and want metrics in the same stack as other workloads. The Collector receives OTLP data from Medplum and exposes or pushes metrics in a format Prometheus can scrape or receive, which keeps alert rules and dashboards in tools your platform team already knows.
- What you run: a Prometheus server or compatible remote-write receiver, plus a Collector deployed as a gateway when several services send data.
- Trace storage: Prometheus stores metrics only, so traces need a separate backend if you want them.
- Retention and storage: plan local retention or long-term storage for time-series data, which grows with series count.
- Security: protect the scrape or write endpoints with network policy and, where supported, authenticator extensions on the Collector.
- Alerting: write alert rules against metric names that match the Medplum version you run, since names can change between releases.
Before you commit, confirm with the Prometheus and Collector documentation which exporter and receiver versions your metric names and label set depend on.
OpenTelemetry does not include a storage or visualization backend, so teams can send data to commercial or self-hosted tools that accept OTLP or a supported exporter. This route fits organizations with an existing observability platform, a tool approved by their security team, or a requirement to keep telemetry inside a specific data boundary.
- What you run: a Collector configured with the exporter for your backend, and the backend itself, whether hosted by a vendor or self-hosted in your infrastructure.
- Data handling: review what Medplum telemetry contains, including identifiers in span attributes, before exporting to any third party.
- Contract and access: check whether the backend vendor will sign the agreements your compliance program requires, and who on the vendor side can access stored data.
- Component maturity: check the stability level of each Collector component in its README, since stability varies across components.
- Credentials: store exporter credentials in your secrets manager and use authenticator extensions such as oauth2client where the exporter supports them.
Before you commit, confirm the backend's supported OTLP version and the Collector release it has been tested against.
Configuration options and when each fits
This table compares the main OpenTelemetry choices for a self-hosted Medplum: how the Collector is deployed, where data goes, how connections are authenticated, whether traces are sampled, and which Collector build to run. Read each row for the trade-off in plain terms, then pick the option that matches your team's operating model and your backend.
| Decision | Option | Trade-off | When to choose it |
|---|---|---|---|
| Collector deployment mode | Agent next to Medplum services | Each host or pod runs its own Collector, so local buffering and config are close to the source, but there are more instances to update and monitor. | Your team wants per-node resilience and has the tooling to manage many Collector instances. |
| Collector deployment mode | Gateway accepting from many sources | One central Collector pool is simpler to configure and secure, but it becomes a shared dependency that needs its own capacity planning. | You have one Medplum deployment or a small number of services and want a single place to manage credentials and export. |
| Exporter target | AWS Distro for OpenTelemetry to CloudWatch | Keeps telemetry inside the AWS account you already run, but you accept CloudWatch's own storage, query and cost model for metrics and traces. | Your Medplum runs on AWS and your operations team already works in CloudWatch. |
| Exporter target | Prometheus or another metrics backend | Works well with existing dashboards and alert rules, but traces need a separate backend and the team must run the storage tier. | You already operate Prometheus or Grafana and want metrics alongside other infrastructure data. |
| Authentication on receivers | OIDC authenticator extension | Ties access to the Collector's incoming endpoints to your identity provider, which adds a dependency on that provider being available. | Services or agents that send telemetry can obtain tokens from your corporate identity provider. |
| Authentication on exporters | oauth2client extension | Lets the Collector add credentials to outgoing requests to a protected backend, but the client secret must be stored and rotated securely. | The backend you export to requires OAuth2 client credentials. |
| Trace sampling | Keep all traces | Gives complete request visibility for troubleshooting, with higher storage and export volume that grows with traffic. | Your traffic is modest or you need full traces during go-live and early operation. |
| Trace sampling | Sample traces | Reduces volume and cost, but rare slow or failing requests may be dropped unless sampling rules keep errors and slow spans. | Traffic is high and you can define rules that keep error and high-latency traces. |
| Collector build | Contrib distribution | Includes a broad set of community components with signed artifacts, checksums and SBOM files, but ships components you may not use. | The components you need are already in the distribution and you want the least build work. |
| Collector build | Custom build with the Collector builder | Limits the binary to the components you choose, which reduces surface area, but your team owns rebuilds, version pinning and upgrades. | Your security review asks for a minimal build, or you need a component that is not in the distribution. |
Setup sequence for OpenTelemetry on self-hosted Medplum
This sequence takes a self-hosted Medplum team from confirming its version and documented telemetry settings to a verified path where metrics and traces reach the chosen backend. Each step closes with a check so the team knows it can move on.
Confirm the Medplum version and telemetry settings
The platform engineering lead checks which Medplum server version is running in your environment and reads the OpenTelemetry settings documented for that version before changing anything. Confirm the exact configuration keys and any environment variables with Medplum's documentation for your version, because option names can change between releases. Record the version and the settings you plan to use in your change record. You are done when a written note names the running version, the documented telemetry keys and the owner who will maintain them.
Choose and verify the Collector release
The team selects an OpenTelemetry Collector release from the official releases page and confirms the artifact you intend to deploy, using the signed artifacts, SHA256 checksums and SBOM files the project publishes with each release. Choose the distribution that contains the receivers and exporters you need, and check the component stability notes in each component's README. Verify the checksum of the downloaded file and confirm the signature against the published key before it enters your registry. You are done when the artifact checksum matches the published value and the SBOM is stored with the build record.
Configure receivers, processors and exporters
The observability engineer writes the Collector configuration with an OTLP receiver for the telemetry Medplum sends, processors for batching and memory limits, and exporters for your backend, such as Amazon CloudWatch through the AWS Distro for OpenTelemetry, Prometheus or another system you run. If the Collector accepts connections from other services, add an authenticator extension such as OIDC and configure the oauth2client extension for outbound exporter credentials, following the Collector's configuration best practices. Keep secrets in your secret store rather than in plain configuration files. You are done when the configuration validates with the Collector's validation command and each pipeline lists a receiver, its processors and an exporter.
Deploy the Collector next to Medplum
The platform team runs the Collector as an agent beside the Medplum application servers, or as a gateway that receives data from several services, depending on how your infrastructure is laid out. Set network rules so only the Medplum servers can reach the receiver port, and confirm the Collector can reach the backend endpoint. Start the process and read its startup logs for configuration errors or exporter connection failures. You are done when the Collector reports its pipelines as started and its health endpoint responds from the Medplum host.
Enable telemetry in Medplum
The Medplum administrator sets the documented OpenTelemetry options on the server, pointing them at the Collector endpoint, and restarts the server through your normal deployment process. Apply the change in a non-production environment first, and confirm the server starts without errors. Keep a record of the previous configuration so the change can be reverted. You are done when the server logs show telemetry initialized with the Collector endpoint and no export errors appear during startup.
Verify metrics and traces with a test request
The on-call engineer sends a known test request to a Medplum FHIR endpoint, such as a read on a test resource, and then checks the backend for the matching trace and the metrics for the request path. Compare the trace's span names and the metric names with the list in the Medplum documentation for your version. If nothing arrives, check the Collector logs for dropped data and the network rules between the server and the Collector. You are done when the test request appears as a trace in your backend and the expected metrics update within the export interval you configured.
Document the pipeline and ownership
The team records the final configuration, the Collector release and checksum, the backend destination, the test request used and the person responsible for each component. Add a Collector upgrade step to the operations runbook, because the Collector releases on its own schedule and should be verified the same way each time. Store the configuration in version control with secrets removed. You are done when the runbook names an owner for the Medplum settings, the Collector and the backend, and a reviewer has confirmed the record matches the running system.
How telemetry flows from Medplum through the Collector to backends
Telemetry starts in the Medplum server, which depends on PostgreSQL and Redis for its data and cache work. The server hands metrics and traces to the OpenTelemetry Collector, which receives them, processes them and exports them to one or more backends. The Collector sits inside the client's network, so the trust boundary and the authentication points on the receiver and exporter sides are the places to check before data leaves that network. Confirm which backend receives each signal and what authentication the Collector applies to each path.
Data path from the Medplum server through the Collector stages to backends.
Security risks in telemetry pipelines to plan for
Telemetry pipelines collect data from many places and send it to systems that often have looser access rules than the application itself. The cards below cover the risks that tend to appear when OpenTelemetry carries data from a self-hosted Medplum deployment to a backend you choose.
Filter sensitive identifiers from attributes
Span attributes, log bodies and metric labels can carry patient identifiers, resource IDs or query strings if instrumentation records them by default. Review which attributes your Medplum instrumentation emits and drop or hash any that contain names, dates of birth, record identifiers or search parameters. Use Collector processors to remove these fields before export, and test with real request paths in a non-production project. Under the shared model Medplum describes, deciding how telemetry containing health information is handled falls to your organization.
Config best practicesAuthenticate Collector receivers
A Collector receiver that accepts data without authentication lets any host on the network inject telemetry or flood the pipeline. Restrict receiver endpoints to the networks that need them, and where clients are not trusted, use an authenticator extension to validate incoming connections, for example with OIDC. Confirm the authentication method your receivers support in the Collector configuration documentation before you design the network path.
Collector configurationStore and rotate exporter credentials
Exporters to commercial or hosted backends usually need API keys or tokens, and an OAuth2 client credential flow can supply them to outgoing requests. Keep these values in your secrets manager rather than in configuration files checked into source control, limit who can read them, and set a rotation schedule. Confirm which credential type your backend supports and whether the Collector can read it from an environment variable or secret reference in your deployment method.
Verify Collector release artifacts
Collector binaries and images are installed into a path that sees all of your telemetry, so their provenance matters. Published Collector releases include signed artifacts, SHA256 checksums and SBOM files. Verify the checksum and signature of the distribution you install, keep an inventory of the SBOM for vulnerability review, and pin versions so upgrades go through testing. Choose the distribution that contains only the components your pipeline uses.
Collector releasesFollow the published configuration practices
The OpenTelemetry project publishes configuration best practices that cover securing receivers, limiting exposed ports and avoiding unnecessary components. Apply them to your Collector configuration, and review each enabled component's stability level in its README before using it in a production pipeline. Keep the config in version control, review changes the same way you review application code, and run the Collector with the least privileges your host allows.
Best practicesQuestions teams ask before enabling Medplum OpenTelemetry
What drives the cost of enabling OpenTelemetry for a self-hosted Medplum?
The cost is mostly the engineering time to instrument, route and verify telemetry, plus the backend that stores it. OpenTelemetry itself is open source under a permissive license, and the OpenTelemetry Collector is licensed under Apache-2.0, so software licensing is usually not the cost driver. The main variables are how many environments you run, whether you already operate a metrics or tracing backend, and whether your cloud provider charges for ingested telemetry. Ask any partner for a quote that separates one-time setup work from recurring items such as backend hosting, storage retention and on-call changes, and confirm which of those are included.
How long does enabling Medplum OpenTelemetry take?
Duration depends on the target backend, the number of services in your Medplum deployment and how much dashboarding and alerting you want at go-live. A deployment that exports to a backend your team already runs is faster to finish than one that needs a new collector tier, identity controls on the collector and new dashboards. No duration is fixed by the platform. Ask for a written plan with phases for instrumentation, collector configuration, verification in a non-production environment and production rollout, and confirm the review points in that plan.
What does our team need to provide before the work starts?
You need access to the cloud accounts or clusters where Medplum runs, a named owner for the chosen telemetry backend, and time from the people who run the platform. The work also needs a decision on where telemetry is stored and who can read it, because traces can contain request context. Expect to supply change windows for restarts and configuration updates, and a non-production environment that matches production closely enough to test collector behavior. Confirm these inputs in the scope document so that delays are visible early.
Can an in-house team enable Medplum OpenTelemetry without outside help?
Yes, if the team already runs Kubernetes or AWS workloads, operates a metrics backend and has someone comfortable with collector configuration. The OpenTelemetry documentation covers collector configuration and best practices, and the status page shows that trace APIs and SDKs are stable in many languages, although component stability varies. Teams without this experience often underestimate the work of securing the collector, tuning sampling and agreeing on metric names that alerts depend on. Decide early whether those tasks will be owned internally or scoped to a partner.
How does enabling OpenTelemetry interact with Medplum upgrades?
Telemetry configuration should be treated as part of the deployment, so it changes with each Medplum upgrade. Self-hosted Medplum must be upgraded through each minor version in sequence, and a telemetry change made during that window adds a second variable to troubleshoot. Keep collector and exporter versions pinned, test them against the next Medplum version in a non-production environment, and check that metric and span names used by dashboards and alerts still exist after each upgrade. Plan telemetry changes outside upgrade windows where possible.
Is telemetry from Medplum sensitive, and how should it be secured?
Treat telemetry as regulated data until your review shows otherwise, because traces and logs can carry request context from a healthcare system. Restrict who can read the backend, encrypt exporter traffic, and authenticate the collector. The Collector supports authenticator extensions for incoming connections, such as OIDC, and for adding credentials to outgoing exporter requests, such as the oauth2client extension. The Collector configuration best practices page is a sensible starting point for review. Confirm with your compliance team which backends and retention periods fit your obligations.
What should we ask for in a quote for this work?
Ask for a written scope that lists the Medplum version and deployment method, the telemetry backend, the signals in scope (metrics, traces and any logs), the environments covered and the verification steps. Request separate line items for one-time setup, recurring backend and retention costs, and any retainer for upgrades. Ask which deliverables are documentation, dashboards and alert rules, and which are handed over to your team. Confirm the timeline, the acceptance criteria, and what happens if a Medplum upgrade changes telemetry during the engagement.
How DeployOpen works on this
DeployOpen plans and implements optional OpenTelemetry support for a self-hosted Medplum deployment inside your own cloud accounts, data centers or air-gapped network. The work covers which metrics and traces to collect, how the Collector is deployed, where the data is sent and how your team operates it afterward.
How we scope
- We confirm your Medplum version and deployment path before choosing which telemetry signals and exporters to enable.
- The written scope names the backends in use, such as CloudWatch, Prometheus or another platform, and who owns each one.
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before any configuration changes begin.
How we build
- We configure Medplum's telemetry settings and deploy OpenTelemetry Collector pipelines in the environment you control.
- Authentication, exporter credentials and network paths to the telemetry backend are set up and tested before go-live.
- We verify that metrics and traces arrive in the target backend and that sensitive request data is excluded from exported telemetry.
How we hand over
- You receive written configuration, Collector version pinning notes and a record of every exporter and receiver enabled.
- Runbooks explain how to change sampling, add dashboards and troubleshoot a missing signal in your own pipeline.
- Your team gets a walkthrough so operators can review the setup and confirm it meets your internal logging and data handling policies.
How we support
- Ongoing support, Collector upgrades and Medplum version changes can be covered by a retainer after handover.
- Upgrades to the Collector and Medplum are retested against the telemetry pipeline before your team applies them.
- Ask any provider to confirm how they handle Collector version drift, credential rotation and telemetry backend changes over time.

