From a9cb65d71639fa3e662cadef86925acaf55ce704 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 12 Feb 2026 13:53:26 +0100 Subject: [PATCH 1/5] Make example projects standalone (no parent POM) Each example POM is now self-contained: no parent element, explicit groupId/version, and a prometheus-metrics-bom import for dependency management. Users can copy an example POM and use it directly without needing the parent chain. Also replace hardcoded versions with $version marker in OTel docs and update set-release-version-github-pages.sh to process all docs. Signed-off-by: Gregor Zeitlinger --- .../tasks/set-release-version-github-pages.sh | 2 +- docs/content/otel/jvm-runtime-metrics.md | 17 +++--- docs/content/otel/support.md | 53 +++++++++++++++++++ examples/example-custom-buckets/pom.xml | 23 ++++---- .../example-greeting-service/pom.xml | 25 ++++----- .../example-hello-world-app/pom.xml | 25 ++++----- .../example-exemplars-tail-sampling/pom.xml | 12 +---- examples/example-exporter-httpserver/pom.xml | 23 ++++---- .../example-exporter-multi-target/pom.xml | 23 ++++---- .../example-exporter-opentelemetry/pom.xml | 23 ++++---- .../example-exporter-servlet-tomcat/pom.xml | 25 ++++----- examples/example-native-histogram/pom.xml | 23 ++++---- .../example-otel-jvm-runtime-metrics/pom.xml | 28 +++++----- .../example-prometheus-properties/pom.xml | 23 ++++---- examples/example-simpleclient-bridge/pom.xml | 22 +++++--- 15 files changed, 215 insertions(+), 132 deletions(-) create mode 100644 docs/content/otel/support.md diff --git a/.mise/tasks/set-release-version-github-pages.sh b/.mise/tasks/set-release-version-github-pages.sh index 142d0eb82..cf4a42313 100755 --- a/.mise/tasks/set-release-version-github-pages.sh +++ b/.mise/tasks/set-release-version-github-pages.sh @@ -6,4 +6,4 @@ set -euox pipefail version=$(git tag -l | grep 'v' | sort | tail -1 | sed 's/v//') marker="\$version" -sed -i "s/$marker/$version/g" docs/content/getting-started/quickstart.md +find ./docs/content -name '*.md' -exec sed -i "s/$marker/$version/g" {} + diff --git a/docs/content/otel/jvm-runtime-metrics.md b/docs/content/otel/jvm-runtime-metrics.md index 9015f7772..6ed84bbcc 100644 --- a/docs/content/otel/jvm-runtime-metrics.md +++ b/docs/content/otel/jvm-runtime-metrics.md @@ -24,12 +24,15 @@ OTel SDK wiring shown below. ## Dependencies +Use the [OTel Support]({{< relref "support.md" >}}) module +to pull in the OTel SDK and Prometheus exporter, then add +the runtime-telemetry instrumentation: + {{< tabs "jvm-runtime-deps" >}} {{< tab "Gradle" >}} ```groovy -implementation 'io.opentelemetry:opentelemetry-sdk' -implementation 'io.opentelemetry:opentelemetry-exporter-prometheus' +implementation platform('io.prometheus:prometheus-metrics-otel-support:$version') // Pick ONE of the following: // Java 8+: @@ -43,12 +46,10 @@ implementation 'io.opentelemetry.instrumentation:opentelemetry-runtime-telemetry ```xml - io.opentelemetry - opentelemetry-sdk - - - io.opentelemetry - opentelemetry-exporter-prometheus + io.prometheus + prometheus-metrics-otel-support + $version + pom diff --git a/docs/content/otel/support.md b/docs/content/otel/support.md new file mode 100644 index 000000000..045c3f96f --- /dev/null +++ b/docs/content/otel/support.md @@ -0,0 +1,53 @@ +--- +title: OTel Support +weight: 2 +--- + +The `prometheus-metrics-otel-support` module bundles the +OpenTelemetry SDK and the Prometheus exporter into a single +POM dependency. It also imports the OTel instrumentation BOM +so that version management is handled automatically. + +Use this module when you want to combine OpenTelemetry +instrumentations (e.g. JVM runtime metrics) with the +Prometheus Java client on one `/metrics` endpoint. + +## Dependencies + +{{< tabs "otel-support-deps" >}} +{{< tab "Gradle" >}} + +```groovy +implementation platform('io.prometheus:prometheus-metrics-otel-support:$version') +``` + +{{< /tab >}} +{{< tab "Maven" >}} + +```xml + + io.prometheus + prometheus-metrics-otel-support + $version + pom + +``` + +{{< /tab >}} +{{< /tabs >}} + +This single dependency replaces: + +- `io.opentelemetry:opentelemetry-sdk` +- `io.opentelemetry:opentelemetry-exporter-prometheus` + +It also imports the `opentelemetry-instrumentation-bom-alpha` +so you can add OTel instrumentation modules (like +`opentelemetry-runtime-telemetry-java8`) without specifying +their version. + +## Use Cases + +See [JVM Runtime Metrics]({{< relref "jvm-runtime-metrics.md" >}}) +for a concrete example of combining OTel JVM metrics with +the Prometheus Java client. diff --git a/examples/example-custom-buckets/pom.xml b/examples/example-custom-buckets/pom.xml index b7e104e5a..e2ba1ca2e 100644 --- a/examples/example-custom-buckets/pom.xml +++ b/examples/example-custom-buckets/pom.xml @@ -3,34 +3,39 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - io.prometheus - examples - 1.5.0-SNAPSHOT - - + io.prometheus example-custom-buckets + 1.0-SNAPSHOT Example - Custom Buckets End-to-End example of Native Histograms with Custom Buckets (NHCB): Java app -> Prometheus -> Grafana + + + + io.prometheus + prometheus-metrics-bom + 1.5.0-SNAPSHOT + pom + import + + + + io.prometheus prometheus-metrics-core - ${project.version} io.prometheus prometheus-metrics-instrumentation-jvm - ${project.version} io.prometheus prometheus-metrics-exporter-httpserver - ${project.version} diff --git a/examples/example-exemplars-tail-sampling/example-greeting-service/pom.xml b/examples/example-exemplars-tail-sampling/example-greeting-service/pom.xml index b2e1006a4..4117f905a 100644 --- a/examples/example-exemplars-tail-sampling/example-greeting-service/pom.xml +++ b/examples/example-exemplars-tail-sampling/example-greeting-service/pom.xml @@ -4,13 +4,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - io.prometheus - example-exemplars-tail-sampling - 1.5.0-SNAPSHOT - - + io.prometheus example-greeting-service + 1.0-SNAPSHOT Example - OpenTelemetry Exemplars - Greeting Service @@ -18,25 +14,30 @@ tracing - - 25 - + + + + io.prometheus + prometheus-metrics-bom + 1.5.0-SNAPSHOT + pom + import + + + io.prometheus prometheus-metrics-core - ${project.version} io.prometheus prometheus-metrics-instrumentation-jvm - ${project.version} io.prometheus prometheus-metrics-exporter-servlet-jakarta - ${project.version} org.apache.tomcat.embed diff --git a/examples/example-exemplars-tail-sampling/example-hello-world-app/pom.xml b/examples/example-exemplars-tail-sampling/example-hello-world-app/pom.xml index bccd6cb43..0cddd9518 100644 --- a/examples/example-exemplars-tail-sampling/example-hello-world-app/pom.xml +++ b/examples/example-exemplars-tail-sampling/example-hello-world-app/pom.xml @@ -4,13 +4,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - io.prometheus - example-exemplars-tail-sampling - 1.5.0-SNAPSHOT - - + io.prometheus example-hello-world-app + 1.0-SNAPSHOT Example - OpenTelemetry Exemplars - Hello World App @@ -18,25 +14,30 @@ tracing - - 25 - + + + + io.prometheus + prometheus-metrics-bom + 1.5.0-SNAPSHOT + pom + import + + + io.prometheus prometheus-metrics-core - ${project.version} io.prometheus prometheus-metrics-instrumentation-jvm - ${project.version} io.prometheus prometheus-metrics-exporter-servlet-jakarta - ${project.version} org.apache.tomcat.embed diff --git a/examples/example-exemplars-tail-sampling/pom.xml b/examples/example-exemplars-tail-sampling/pom.xml index 49b168955..ac4c6ccf5 100644 --- a/examples/example-exemplars-tail-sampling/pom.xml +++ b/examples/example-exemplars-tail-sampling/pom.xml @@ -4,13 +4,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - io.prometheus - examples - 1.5.0-SNAPSHOT - - + io.prometheus example-exemplars-tail-sampling + 1.0-SNAPSHOT pom Example - Exemplars with OpenTelemetry's Tail Sampling @@ -18,10 +14,6 @@ Example project showing Exemplars with OpenTelemetry's Tail Sampling. - - 11 - - example-greeting-service example-hello-world-app diff --git a/examples/example-exporter-httpserver/pom.xml b/examples/example-exporter-httpserver/pom.xml index f9ee206f0..822188b96 100644 --- a/examples/example-exporter-httpserver/pom.xml +++ b/examples/example-exporter-httpserver/pom.xml @@ -4,34 +4,39 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - io.prometheus - examples - 1.5.0-SNAPSHOT - - + io.prometheus example-exporter-httpserver + 1.0-SNAPSHOT Example - HTTPServer Exporter Prometheus Metrics Example using the HTTPServer for exposing the metrics endpoint + + + + io.prometheus + prometheus-metrics-bom + 1.5.0-SNAPSHOT + pom + import + + + + io.prometheus prometheus-metrics-core - ${project.version} io.prometheus prometheus-metrics-instrumentation-jvm - ${project.version} io.prometheus prometheus-metrics-exporter-httpserver - ${project.version} diff --git a/examples/example-exporter-multi-target/pom.xml b/examples/example-exporter-multi-target/pom.xml index ac13ff2a1..de6655ea8 100644 --- a/examples/example-exporter-multi-target/pom.xml +++ b/examples/example-exporter-multi-target/pom.xml @@ -4,34 +4,39 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - io.prometheus - examples - 1.5.0-SNAPSHOT - - + io.prometheus example-exporter-multi-target + 1.0-SNAPSHOT Example - HTTPServer Exporter Multi Target Prometheus Metrics Example for multi-target pattern implementation + + + + io.prometheus + prometheus-metrics-bom + 1.5.0-SNAPSHOT + pom + import + + + + io.prometheus prometheus-metrics-core - ${project.version} io.prometheus prometheus-metrics-instrumentation-jvm - ${project.version} io.prometheus prometheus-metrics-exporter-httpserver - ${project.version} diff --git a/examples/example-exporter-opentelemetry/pom.xml b/examples/example-exporter-opentelemetry/pom.xml index 8e8fa6891..131b71665 100644 --- a/examples/example-exporter-opentelemetry/pom.xml +++ b/examples/example-exporter-opentelemetry/pom.xml @@ -4,34 +4,39 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - io.prometheus - examples - 1.5.0-SNAPSHOT - - + io.prometheus example-exporter-opentelemetry + 1.0-SNAPSHOT Example - OpenTelemetry Metrics Exporter Example of exposing metrics in OpenTelemetry format and pushing them to an OpenTelemetry collector + + + + io.prometheus + prometheus-metrics-bom + 1.5.0-SNAPSHOT + pom + import + + + + io.prometheus prometheus-metrics-core - ${project.version} io.prometheus prometheus-metrics-instrumentation-jvm - ${project.version} io.prometheus prometheus-metrics-exporter-opentelemetry - ${project.version} diff --git a/examples/example-exporter-servlet-tomcat/pom.xml b/examples/example-exporter-servlet-tomcat/pom.xml index 26da0ae97..444d01e5b 100644 --- a/examples/example-exporter-servlet-tomcat/pom.xml +++ b/examples/example-exporter-servlet-tomcat/pom.xml @@ -3,38 +3,39 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - io.prometheus - examples - 1.5.0-SNAPSHOT - - + io.prometheus example-exporter-servlet-tomcat + 1.0-SNAPSHOT Example - Servlet Exporter with Tomcat Prometheus Metrics Example using Embedded Tomcat and the Exporter Servlet - - 25 - + + + + io.prometheus + prometheus-metrics-bom + 1.5.0-SNAPSHOT + pom + import + + + io.prometheus prometheus-metrics-core - ${project.version} io.prometheus prometheus-metrics-instrumentation-jvm - ${project.version} io.prometheus prometheus-metrics-exporter-servlet-jakarta - ${project.version} org.apache.tomcat.embed diff --git a/examples/example-native-histogram/pom.xml b/examples/example-native-histogram/pom.xml index 5324ffb91..925230d7f 100644 --- a/examples/example-native-histogram/pom.xml +++ b/examples/example-native-histogram/pom.xml @@ -3,34 +3,39 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - io.prometheus - examples - 1.5.0-SNAPSHOT - - + io.prometheus example-native-histogram + 1.0-SNAPSHOT Example - Native Histogram End-to-End example of a Native histogram: Java app -> Prometheus -> Grafana + + + + io.prometheus + prometheus-metrics-bom + 1.5.0-SNAPSHOT + pom + import + + + + io.prometheus prometheus-metrics-core - ${project.version} io.prometheus prometheus-metrics-instrumentation-jvm - ${project.version} io.prometheus prometheus-metrics-exporter-httpserver - ${project.version} diff --git a/examples/example-otel-jvm-runtime-metrics/pom.xml b/examples/example-otel-jvm-runtime-metrics/pom.xml index 276a58f2f..c7b8024b2 100644 --- a/examples/example-otel-jvm-runtime-metrics/pom.xml +++ b/examples/example-otel-jvm-runtime-metrics/pom.xml @@ -4,13 +4,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - io.prometheus - examples - 1.5.0-SNAPSHOT - - + io.prometheus example-otel-jvm-runtime-metrics + 1.0-SNAPSHOT Example - OTel JVM Runtime Metrics @@ -19,10 +15,17 @@ + + io.prometheus + prometheus-metrics-bom + 1.5.0-SNAPSHOT + pom + import + io.opentelemetry.instrumentation opentelemetry-instrumentation-bom-alpha - ${otel.instrumentation.version} + 2.24.0-alpha pom import @@ -33,20 +36,15 @@ io.prometheus prometheus-metrics-core - ${project.version} io.prometheus prometheus-metrics-exporter-httpserver - ${project.version} - - - io.opentelemetry - opentelemetry-sdk - io.opentelemetry - opentelemetry-exporter-prometheus + io.prometheus + prometheus-metrics-otel-support + pom io.opentelemetry.instrumentation diff --git a/examples/example-prometheus-properties/pom.xml b/examples/example-prometheus-properties/pom.xml index b02b8fa03..24aab5318 100644 --- a/examples/example-prometheus-properties/pom.xml +++ b/examples/example-prometheus-properties/pom.xml @@ -3,34 +3,39 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - io.prometheus - examples - 1.5.0-SNAPSHOT - - + io.prometheus example-prometheus-properties + 1.0-SNAPSHOT Example - prometheus.properties Example of runtime configuration with prometheus.properties + + + + io.prometheus + prometheus-metrics-bom + 1.5.0-SNAPSHOT + pom + import + + + + io.prometheus prometheus-metrics-core - ${project.version} io.prometheus prometheus-metrics-instrumentation-jvm - ${project.version} io.prometheus prometheus-metrics-exporter-httpserver - ${project.version} diff --git a/examples/example-simpleclient-bridge/pom.xml b/examples/example-simpleclient-bridge/pom.xml index f6d2c4207..9b0d6e736 100644 --- a/examples/example-simpleclient-bridge/pom.xml +++ b/examples/example-simpleclient-bridge/pom.xml @@ -3,19 +3,27 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - io.prometheus - examples - 1.5.0-SNAPSHOT - - + io.prometheus example-simpleclient-bridge + 1.0-SNAPSHOT Example - Simpleclient Bridge Prometheus Metrics Example of the Simpleclient Backwards Compatibility module + + + + io.prometheus + prometheus-metrics-bom + 1.5.0-SNAPSHOT + pom + import + + + + io.prometheus @@ -25,12 +33,10 @@ io.prometheus prometheus-metrics-simpleclient-bridge - ${project.version} io.prometheus prometheus-metrics-exporter-httpserver - ${project.version} From eb58b80ea76013e13ebdcc706ad48aa699d50298 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 12 Feb 2026 13:58:40 +0100 Subject: [PATCH 2/5] add bom Signed-off-by: Gregor Zeitlinger --- pom.xml | 1 + prometheus-metrics-bom/pom.xml | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/pom.xml b/pom.xml index 30ebd46bc..a67440fef 100644 --- a/pom.xml +++ b/pom.xml @@ -60,6 +60,7 @@ prometheus-metrics-instrumentation-dropwizard prometheus-metrics-instrumentation-guava prometheus-metrics-simpleclient-bridge + prometheus-metrics-otel-support diff --git a/prometheus-metrics-bom/pom.xml b/prometheus-metrics-bom/pom.xml index a13398228..d8e9d7ada 100644 --- a/prometheus-metrics-bom/pom.xml +++ b/prometheus-metrics-bom/pom.xml @@ -119,6 +119,12 @@ prometheus-metrics-model ${project.version} + + io.prometheus + prometheus-metrics-otel-support + ${project.version} + pom + io.prometheus prometheus-metrics-simpleclient-bridge From 67e1e3e19303b19a1b8f90213bf131e141905790 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 12 Feb 2026 13:59:21 +0100 Subject: [PATCH 3/5] add pom Signed-off-by: Gregor Zeitlinger --- prometheus-metrics-otel-support/pom.xml | 52 +++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 prometheus-metrics-otel-support/pom.xml diff --git a/prometheus-metrics-otel-support/pom.xml b/prometheus-metrics-otel-support/pom.xml new file mode 100644 index 000000000..bea2ce649 --- /dev/null +++ b/prometheus-metrics-otel-support/pom.xml @@ -0,0 +1,52 @@ + + + 4.0.0 + + + io.prometheus + client_java + 1.5.0-SNAPSHOT + + + prometheus-metrics-otel-support + pom + + Prometheus Metrics OpenTelemetry Support + + Bundles the OpenTelemetry SDK and Prometheus exporter so that users + who want to combine OTel instrumentations with the Prometheus Java + client only need a single dependency. + + + + true + true + true + true + + + + + + io.opentelemetry.instrumentation + opentelemetry-instrumentation-bom-alpha + ${otel.instrumentation.version} + pom + import + + + + + + + io.opentelemetry + opentelemetry-sdk + + + io.opentelemetry + opentelemetry-exporter-prometheus + + + From 00b04569734ca689b49dd542d3e49d4d7455b0aa Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Fri, 13 Feb 2026 10:58:43 +0100 Subject: [PATCH 4/5] Address PR review comments - Fix Gradle snippets: use implementation instead of platform() so transitive dependencies are actually added to the classpath - Add explicit versions for OTel instrumentation dependencies since Maven dependencyManagement is not transitive to consumers - Remove misleading claims about automatic version management in docs - Add maven.compiler.release and project.build.sourceEncoding to all standalone example POMs (Java 8 for most, Java 17 for Tomcat 11) - Update set-release-version-github-pages.sh description to reflect broader docs/content scope - Document $version placeholder convention in CLAUDE.md Signed-off-by: Gregor Zeitlinger --- .mise/tasks/set-release-version-github-pages.sh | 2 +- CLAUDE.md | 6 ++++++ docs/content/otel/jvm-runtime-metrics.md | 12 ++++++------ docs/content/otel/support.md | 10 ++-------- examples/example-custom-buckets/pom.xml | 5 +++++ .../example-greeting-service/pom.xml | 5 +++++ .../example-hello-world-app/pom.xml | 5 +++++ examples/example-exporter-httpserver/pom.xml | 5 +++++ examples/example-exporter-multi-target/pom.xml | 5 +++++ examples/example-exporter-opentelemetry/pom.xml | 5 +++++ examples/example-exporter-servlet-tomcat/pom.xml | 5 +++++ examples/example-native-histogram/pom.xml | 5 +++++ examples/example-otel-jvm-runtime-metrics/pom.xml | 5 +++++ examples/example-prometheus-properties/pom.xml | 5 +++++ examples/example-simpleclient-bridge/pom.xml | 5 +++++ 15 files changed, 70 insertions(+), 15 deletions(-) diff --git a/.mise/tasks/set-release-version-github-pages.sh b/.mise/tasks/set-release-version-github-pages.sh index cf4a42313..08911dd4b 100755 --- a/.mise/tasks/set-release-version-github-pages.sh +++ b/.mise/tasks/set-release-version-github-pages.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -#MISE description="Set release version in GitHub Pages quickstart.md" +#MISE description="Set release version in all GitHub Pages docs" set -euox pipefail diff --git a/CLAUDE.md b/CLAUDE.md index 9c1c60571..22712e005 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -119,6 +119,12 @@ mise run lint:super-linter - Integration tests are in `integration-tests/` and run during `verify` phase - Acceptance tests use OATs framework: `mise run acceptance-test` +## Documentation + +- Docs live under `docs/content/` and use `$version` as a placeholder for the library version +- When publishing GitHub Pages, `mise run set-release-version-github-pages` replaces `$version` with the latest git tag across all `docs/content/**/*.md` files (the published site is not versioned) +- When writing docs, always use `$version` for the Prometheus client version — never hardcode it + ## Java Version Source compatibility: Java 8. Tests run on Java 25 (configured in `mise.toml`). diff --git a/docs/content/otel/jvm-runtime-metrics.md b/docs/content/otel/jvm-runtime-metrics.md index 6ed84bbcc..3bccbf1a2 100644 --- a/docs/content/otel/jvm-runtime-metrics.md +++ b/docs/content/otel/jvm-runtime-metrics.md @@ -32,13 +32,11 @@ the runtime-telemetry instrumentation: {{< tab "Gradle" >}} ```groovy -implementation platform('io.prometheus:prometheus-metrics-otel-support:$version') +implementation 'io.prometheus:prometheus-metrics-otel-support:$version' -// Pick ONE of the following: -// Java 8+: -implementation 'io.opentelemetry.instrumentation:opentelemetry-runtime-telemetry-java8' -// Java 17+ (adds JFR-based metrics): -// implementation 'io.opentelemetry.instrumentation:opentelemetry-runtime-telemetry-java17' +// Use opentelemetry-runtime-telemetry-java8 (Java 8+) +// or opentelemetry-runtime-telemetry-java17 (Java 17+, JFR-based) +implementation 'io.opentelemetry.instrumentation:opentelemetry-runtime-telemetry-java8:2.24.0-alpha' ``` {{< /tab >}} @@ -57,12 +55,14 @@ implementation 'io.opentelemetry.instrumentation:opentelemetry-runtime-telemetry io.opentelemetry.instrumentation opentelemetry-runtime-telemetry-java8 + 2.24.0-alpha ``` diff --git a/docs/content/otel/support.md b/docs/content/otel/support.md index 045c3f96f..e3b8cbe3a 100644 --- a/docs/content/otel/support.md +++ b/docs/content/otel/support.md @@ -5,8 +5,7 @@ weight: 2 The `prometheus-metrics-otel-support` module bundles the OpenTelemetry SDK and the Prometheus exporter into a single -POM dependency. It also imports the OTel instrumentation BOM -so that version management is handled automatically. +POM dependency. Use this module when you want to combine OpenTelemetry instrumentations (e.g. JVM runtime metrics) with the @@ -18,7 +17,7 @@ Prometheus Java client on one `/metrics` endpoint. {{< tab "Gradle" >}} ```groovy -implementation platform('io.prometheus:prometheus-metrics-otel-support:$version') +implementation 'io.prometheus:prometheus-metrics-otel-support:$version' ``` {{< /tab >}} @@ -41,11 +40,6 @@ This single dependency replaces: - `io.opentelemetry:opentelemetry-sdk` - `io.opentelemetry:opentelemetry-exporter-prometheus` -It also imports the `opentelemetry-instrumentation-bom-alpha` -so you can add OTel instrumentation modules (like -`opentelemetry-runtime-telemetry-java8`) without specifying -their version. - ## Use Cases See [JVM Runtime Metrics]({{< relref "jvm-runtime-metrics.md" >}}) diff --git a/examples/example-custom-buckets/pom.xml b/examples/example-custom-buckets/pom.xml index e2ba1ca2e..52ae60627 100644 --- a/examples/example-custom-buckets/pom.xml +++ b/examples/example-custom-buckets/pom.xml @@ -7,6 +7,11 @@ example-custom-buckets 1.0-SNAPSHOT + + 8 + UTF-8 + + Example - Custom Buckets End-to-End example of Native Histograms with Custom Buckets (NHCB): Java app -> Prometheus -> Grafana diff --git a/examples/example-exemplars-tail-sampling/example-greeting-service/pom.xml b/examples/example-exemplars-tail-sampling/example-greeting-service/pom.xml index 4117f905a..532b7290b 100644 --- a/examples/example-exemplars-tail-sampling/example-greeting-service/pom.xml +++ b/examples/example-exemplars-tail-sampling/example-greeting-service/pom.xml @@ -8,6 +8,11 @@ example-greeting-service 1.0-SNAPSHOT + + 17 + UTF-8 + + Example - OpenTelemetry Exemplars - Greeting Service Part of a distributed "Hello, World" REST service to show Exemplars with OpenTelemetry's distributed diff --git a/examples/example-exemplars-tail-sampling/example-hello-world-app/pom.xml b/examples/example-exemplars-tail-sampling/example-hello-world-app/pom.xml index 0cddd9518..4c1702bbe 100644 --- a/examples/example-exemplars-tail-sampling/example-hello-world-app/pom.xml +++ b/examples/example-exemplars-tail-sampling/example-hello-world-app/pom.xml @@ -8,6 +8,11 @@ example-hello-world-app 1.0-SNAPSHOT + + 17 + UTF-8 + + Example - OpenTelemetry Exemplars - Hello World App Part of a distributed "Hello, World" REST service to show Exemplars with OpenTelemetry's distributed diff --git a/examples/example-exporter-httpserver/pom.xml b/examples/example-exporter-httpserver/pom.xml index 822188b96..ac9ed5e10 100644 --- a/examples/example-exporter-httpserver/pom.xml +++ b/examples/example-exporter-httpserver/pom.xml @@ -8,6 +8,11 @@ example-exporter-httpserver 1.0-SNAPSHOT + + 8 + UTF-8 + + Example - HTTPServer Exporter Prometheus Metrics Example using the HTTPServer for exposing the metrics endpoint diff --git a/examples/example-exporter-multi-target/pom.xml b/examples/example-exporter-multi-target/pom.xml index de6655ea8..3b736ae36 100644 --- a/examples/example-exporter-multi-target/pom.xml +++ b/examples/example-exporter-multi-target/pom.xml @@ -8,6 +8,11 @@ example-exporter-multi-target 1.0-SNAPSHOT + + 8 + UTF-8 + + Example - HTTPServer Exporter Multi Target Prometheus Metrics Example for multi-target pattern implementation diff --git a/examples/example-exporter-opentelemetry/pom.xml b/examples/example-exporter-opentelemetry/pom.xml index 131b71665..a94e82ce4 100644 --- a/examples/example-exporter-opentelemetry/pom.xml +++ b/examples/example-exporter-opentelemetry/pom.xml @@ -8,6 +8,11 @@ example-exporter-opentelemetry 1.0-SNAPSHOT + + 8 + UTF-8 + + Example - OpenTelemetry Metrics Exporter Example of exposing metrics in OpenTelemetry format and pushing them to an OpenTelemetry collector diff --git a/examples/example-exporter-servlet-tomcat/pom.xml b/examples/example-exporter-servlet-tomcat/pom.xml index 444d01e5b..65b91b5ed 100644 --- a/examples/example-exporter-servlet-tomcat/pom.xml +++ b/examples/example-exporter-servlet-tomcat/pom.xml @@ -7,6 +7,11 @@ example-exporter-servlet-tomcat 1.0-SNAPSHOT + + 17 + UTF-8 + + Example - Servlet Exporter with Tomcat Prometheus Metrics Example using Embedded Tomcat and the Exporter Servlet diff --git a/examples/example-native-histogram/pom.xml b/examples/example-native-histogram/pom.xml index 925230d7f..eedadf6fe 100644 --- a/examples/example-native-histogram/pom.xml +++ b/examples/example-native-histogram/pom.xml @@ -7,6 +7,11 @@ example-native-histogram 1.0-SNAPSHOT + + 8 + UTF-8 + + Example - Native Histogram End-to-End example of a Native histogram: Java app -> Prometheus -> Grafana diff --git a/examples/example-otel-jvm-runtime-metrics/pom.xml b/examples/example-otel-jvm-runtime-metrics/pom.xml index c7b8024b2..6e7ad8213 100644 --- a/examples/example-otel-jvm-runtime-metrics/pom.xml +++ b/examples/example-otel-jvm-runtime-metrics/pom.xml @@ -8,6 +8,11 @@ example-otel-jvm-runtime-metrics 1.0-SNAPSHOT + + 8 + UTF-8 + + Example - OTel JVM Runtime Metrics Example of combining Prometheus metrics with OpenTelemetry JVM runtime metrics on one endpoint diff --git a/examples/example-prometheus-properties/pom.xml b/examples/example-prometheus-properties/pom.xml index 24aab5318..ac0279853 100644 --- a/examples/example-prometheus-properties/pom.xml +++ b/examples/example-prometheus-properties/pom.xml @@ -7,6 +7,11 @@ example-prometheus-properties 1.0-SNAPSHOT + + 8 + UTF-8 + + Example - prometheus.properties Example of runtime configuration with prometheus.properties diff --git a/examples/example-simpleclient-bridge/pom.xml b/examples/example-simpleclient-bridge/pom.xml index 9b0d6e736..82459eb0c 100644 --- a/examples/example-simpleclient-bridge/pom.xml +++ b/examples/example-simpleclient-bridge/pom.xml @@ -7,6 +7,11 @@ example-simpleclient-bridge 1.0-SNAPSHOT + + 8 + UTF-8 + + Example - Simpleclient Bridge Prometheus Metrics Example of the Simpleclient Backwards Compatibility module From f7b98b9817601ebb7fe4fba684a210acc508ddde Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Fri, 13 Feb 2026 11:16:07 +0100 Subject: [PATCH 5/5] Replace hardcoded OTel version with $otelVersion-alpha marker The script strips the -alpha suffix so $otelVersion resolves to the base version (e.g. 2.24.0), and docs write $otelVersion-alpha explicitly to produce the full version string. Signed-off-by: Gregor Zeitlinger --- .mise/tasks/set-release-version-github-pages.sh | 7 +++++-- CLAUDE.md | 2 +- docs/content/otel/jvm-runtime-metrics.md | 8 +++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.mise/tasks/set-release-version-github-pages.sh b/.mise/tasks/set-release-version-github-pages.sh index 08911dd4b..2016373c8 100755 --- a/.mise/tasks/set-release-version-github-pages.sh +++ b/.mise/tasks/set-release-version-github-pages.sh @@ -5,5 +5,8 @@ set -euox pipefail version=$(git tag -l | grep 'v' | sort | tail -1 | sed 's/v//') -marker="\$version" -find ./docs/content -name '*.md' -exec sed -i "s/$marker/$version/g" {} + +otelVersion=$(grep -oP '\K[^<]+' pom.xml | sed 's/-alpha$//') + +find ./docs/content -name '*.md' \ + -exec sed -i "s/\$version/$version/g" {} + \ + -exec sed -i "s/\$otelVersion/$otelVersion/g" {} + diff --git a/CLAUDE.md b/CLAUDE.md index 22712e005..406194944 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -123,7 +123,7 @@ mise run lint:super-linter - Docs live under `docs/content/` and use `$version` as a placeholder for the library version - When publishing GitHub Pages, `mise run set-release-version-github-pages` replaces `$version` with the latest git tag across all `docs/content/**/*.md` files (the published site is not versioned) -- When writing docs, always use `$version` for the Prometheus client version — never hardcode it +- Use `$version` for the Prometheus client version and `$otelVersion-alpha` for the OTel instrumentation version — never hardcode them ## Java Version diff --git a/docs/content/otel/jvm-runtime-metrics.md b/docs/content/otel/jvm-runtime-metrics.md index 3bccbf1a2..d61da1861 100644 --- a/docs/content/otel/jvm-runtime-metrics.md +++ b/docs/content/otel/jvm-runtime-metrics.md @@ -36,7 +36,9 @@ implementation 'io.prometheus:prometheus-metrics-otel-support:$version' // Use opentelemetry-runtime-telemetry-java8 (Java 8+) // or opentelemetry-runtime-telemetry-java17 (Java 17+, JFR-based) -implementation 'io.opentelemetry.instrumentation:opentelemetry-runtime-telemetry-java8:2.24.0-alpha' +implementation( + 'io.opentelemetry.instrumentation:opentelemetry-runtime-telemetry-java8:$otelVersion-alpha' +) ``` {{< /tab >}} @@ -55,14 +57,14 @@ implementation 'io.opentelemetry.instrumentation:opentelemetry-runtime-telemetry io.opentelemetry.instrumentation opentelemetry-runtime-telemetry-java8 - 2.24.0-alpha + $otelVersion-alpha ```