Skip to content

Java (JVM)

Collect JVM runtime and HTTP metrics from any JVM application and get curated dashboards and alerts for them with a single import.

JVM apps instrumented with the OpenTelemetry Java agent export their metrics over OTLP to your LeanSignal agent gateway (one per cluster or environment) — never to a remote or third-party endpoint. The gateway keeps full fidelity locally and forwards only the demanded subset to your central dataplane. This integration covers JVM runtime health (heap/non-heap memory, GC duration, threads, classes, CPU) plus HTTP server request metrics.

Metric names follow the standard OTLP → Prometheus normalization (dots become underscores, unit/_total suffixes are added), so jvm.memory.used becomes jvm_memory_used_bytes and http.server.request.duration becomes http_server_request_duration_seconds. The demands below are built against those names.

  • A LeanSignal agent gateway deployed and connected — one per cluster or environment. If you haven’t deployed it yet, follow Install the agent (source: LeanSignal/leansignal-agent). It should show as Connected under Agents in the LeanSignal app.
  • Network reachability to the gateway’s OTLP port4317 (gRPC) or 4318 (HTTP). See Agent configuration.
  • Your Java (JVM) app instrumented with the OpenTelemetry SDK, exporting metrics over OTLP to the gateway — configured in Setup.
  • Editor or admin role in the LeanSignal app (importing a demand creates dashboards and alert rules).

Attach the OpenTelemetry Java agent and point it at your LeanSignal agent gateway (OTLP gRPC :4317 / HTTP :4318) — not a SaaS endpoint. No code changes are required; JVM runtime and HTTP server metrics are on by default.

Terminal window
# 1. Download the agent (pin a version in production)
curl -Lo opentelemetry-javaagent.jar \
https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar
# 2. Configure export to the gateway
export OTEL_SERVICE_NAME=orders-service
export OTEL_EXPORTER_OTLP_ENDPOINT=http://<gateway-host>:4317
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc # or http/protobuf against :4318
export OTEL_METRICS_EXPORTER=otlp # default; keep metrics enabled
# 3. Run with the agent attached
java -javaagent:/path/opentelemetry-javaagent.jar -jar app.jar

The equivalent as JVM system properties: -Dotel.service.name=orders-service -Dotel.exporter.otlp.endpoint=http://<gateway-host>:4317.

The Java agent from Setup already exports all three signals: with OTEL_EXPORTER_OTLP_ENDPOINT set, traces and logs flow to the gateway by default alongside metrics — Logback and Log4j output is captured automatically, and every supported framework is traced with no code changes. To turn a signal off, set OTEL_TRACES_EXPORTER=none or OTEL_LOGS_EXPORTER=none. See the Java zero-code instrumentation docs.

Java (JVM) ships as a ready-made demand in three variants. You don’t copy any JSON — in the LeanSignal app go to Demands, press the ˅ arrow on the Add Demand button (the arrow opens the import menu), choose Import from catalog…, and pick the variant. Each variant below lists the slug that identifies its published bundle. See Integrations for the full import flow.

The variants are nested — Standard is a superset of Essential, Extended a superset of Standard. Pick whichever is closest to what you need and treat it as a starting point: after import everything is a normal, editable copy, so retune thresholds, add or drop panels, and adjust queries for your environment — your edits reshape the demand automatically. Start small and re-import a larger variant later if you outgrow it.

The golden signals. 1 dashboard · 4 panels · 3 alerts — traffic, errors, latency, and heap headroom at a glance.

Import this variant from the catalog. Its demand slug:

Demand slug
java-otel-demand-essential

Dashboard — HTTP request rate, HTTP 5xx error rate, HTTP request duration p95, and Heap utilization vs limit.

Alerts (3)

AlertSeverityFires when
High HTTP 5xx error ratecritical5xx ratio > 5% for 5m
High HTTP p95 latencywarningp95 latency > 1s for 5m
Heap memory near limitcriticalpost-GC heap floor > 90% of limit for 5m

Review the bundle JSON →

Each variant imports one Java (JVM) dashboard, its panels grouped into collapsible sections. Every dashboard carries an Instance filter (on the instance label), so one import covers the whole fleet — view every instance at once, or focus on one. Legends are sortable tables showing last/mean/max per series, so the outlier instance stands out. Dashboards are demand-driven: importing one tells your agents to forward exactly the timeseries its panels query, and nothing else. Panels are ordinary Perses panels — edit queries, add panels, or retune them after import, and your changes reshape the demand automatically.

Thresholds are conservative starting points — tune them to your workload.

Was this page helpful?