Skip to content

Add docs and example for OTel JVM runtime metrics - #1861

Merged
zeitlinger merged 12 commits into
mainfrom
otel-metrics
Feb 12, 2026
Merged

Add docs and example for OTel JVM runtime metrics#1861
zeitlinger merged 12 commits into
mainfrom
otel-metrics

Conversation

@zeitlinger

@zeitlinger zeitlinger commented Feb 9, 2026

Copy link
Copy Markdown
Member

Alternative for #1854

Summary

  • Add documentation for using OpenTelemetry's runtime-telemetry module as an alternative to prometheus-metrics-instrumentation-jvm for JVM metrics following OTel semantic conventions
  • Add a runnable example project (examples/example-otel-jvm-runtime-metrics) demonstrating combined Prometheus + OTel runtime metrics on a single /metrics endpoint
  • Document RuntimeMetricsBuilder configuration options (captureGcCause(), emitExperimentalTelemetry())
  • Cover standalone setup, combined setup with PrometheusMetricReader, Java 17 JFR support, and OTel-to-Prometheus metric name mapping

Test plan

  • mise run build passes
  • mise run lint:super-linter passes
  • Manual: java -jar examples/example-otel-jvm-runtime-metrics/target/example-otel-jvm-runtime-metrics.jar then curl localhost:9400/metrics shows both uptime_seconds_total and jvm_* metrics
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger zeitlinger self-assigned this Feb 9, 2026
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1

- name: Remap main branch URLs to PR branch for link checking

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not related to this PR, but a good opportunity to fix - last time I merged with this check failing and I didn't like it

@zeitlinger zeitlinger closed this Feb 9, 2026
@zeitlinger zeitlinger reopened this Feb 9, 2026
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds documentation and a runnable example showing how to expose OpenTelemetry JVM runtime metrics (runtime-telemetry) alongside Prometheus Java client metrics on a single /metrics endpoint, including configuration notes and name-mapping guidance.

Changes:

  • Adds a new runnable Maven example module demonstrating combined Prometheus + OTel JVM runtime metrics on one endpoint.
  • Adds a new docs page describing standalone vs combined setup, configuration toggles, Java 17 JFR notes, and OTel→Prometheus metric name mapping.
  • Adjusts link-lint workflow behavior to handle links pointing at main for newly added files.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
examples/pom.xml Adds the new example module to the examples reactor build.
examples/example-otel-jvm-runtime-metrics/src/main/java/io/prometheus/metrics/examples/otelruntimemetrics/Main.java Demonstrates wiring PrometheusMetricReader into a shared PrometheusRegistry and serving via HTTPServer.
examples/example-otel-jvm-runtime-metrics/pom.xml Adds OTel SDK/exporter/runtime-telemetry dependencies and shaded runnable jar packaging.
examples/example-otel-jvm-runtime-metrics/README.md Provides build/run instructions and expected /metrics output excerpts.
docs/content/otel/jvm-runtime-metrics.md New documentation page describing OTel runtime metrics usage patterns and options.
docs/content/instrumentation/jvm.md Adds a note linking to the new OTel runtime metrics alternative docs.
.github/workflows/lint-rest.yml Updates permissions and adds PR-branch URL remapping for link checking.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread examples/example-otel-jvm-runtime-metrics/pom.xml Outdated
Comment thread .github/workflows/lint-rest.yml Outdated

@jaydeluca jaydeluca left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couple small nitpicks but lgtm

Comment thread examples/example-otel-jvm-runtime-metrics/pom.xml Outdated
Comment thread docs/content/otel/jvm-runtime-metrics.md Outdated
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger
zeitlinger merged commit 64c521b into main Feb 12, 2026
10 checks passed
@zeitlinger
zeitlinger deleted the otel-metrics branch February 12, 2026 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants