Smile CDR Observability
This guide walks you through setting up Smile CDR with a complete observability stack using OpenTelemetry, Grafana, Loki, and Tempo.
This guide covers:
OpenTelemetry is a framework and toolkit designed to create and manage telemetry data such as traces, metrics, and logs. Starting with the 2024.02 release, Smile CDR includes built-in support for OpenTelemetry Java agent, making it possible to generate telemetry data out-of-the-box.
Currently, Smile CDR generates traces and metrics using the OpenTelemetry Java agent with some Smile-specific customizations.
Full docs: OpenTelemetry Integration Guide.
To enable OpenTelemetry instrumentation in Smile CDR, set the environment variable CDR_OTEL
when running Smile CDR.
CDR_OTEL=y OTEL_LOGS_EXPORTER=otlp bin/smilecdr start
Or export the variables separately:
export CDR_OTEL=y
export OTEL_LOGS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317 # Recommended when running in containers or remote setup
bin/smilecdr start
To override the default agent configuration:
export JAVA_TOOL_OPTIONS="-javaagent:/path/to/opentelemetry-javaagent.jar"
export OTEL_JAVAAGENT_CONFIGURATION_FILE=/path/to/javaagent.properties
Starting from 2025.05.R01, this override is optional unless using AWS/Azure-specific OpenTelemetry agents.
Sample javaagent.properties
file:
otel.service.name=smilecdr
otel.logs.exporter=otlp
otel.javaagent.extensions=./otel/bin/cdr-otel-agent-extension.jar
otel.instrumentation.logback-appender.experimental.capture-mdc-attributes=*
otel.instrumentation.http.server.capture-response-headers=X-Request-ID
otel.jmx.config=./otel/etc/jmx_rules.yaml
To disable log export:
otel.logs.exporter=none
Metrics are sent from Smile CDR via OpenTelemetry to Prometheus. Common metrics include:
git clone https://gitlab.com/smilecdr-public/smilcdr-grafana.git
cd smilecdr-grafana
docker compose up -d
This starts:
In Grafana, go to Dashboards → Smile CDR where you will find:
If metrics are missing, check:
CDR_OTEL=y
is setOTEL_LOGS_EXPORTER=otlp
is setotel.logs.exporter=otlp
is set in javaagent.properties
Example query in Grafana Explore:
smilecdr_session_count
docker logs otel-collector
docker logs loki
docker logs grafana
With this setup, you have full observability of Smile CDR including logs, metrics, and traces using Grafana, Loki, Tempo, and Prometheus.
You are about to leave the Smile Digital Health documentation and navigate to the Open Source HAPI-FHIR Documentation.