From 66b3b1546366359cb18121e5d413615735ebd612 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 23 Apr 2026 16:39:47 +0000 Subject: [PATCH 01/15] chore: update flint to 0.20.4 Signed-off-by: Gregor Zeitlinger --- .github/config/.editorconfig-checker.json | 7 +++++-- .github/renovate.json5 | 2 +- .markdownlint.yml | 2 -- .rumdl.toml | 5 +++++ .yamllint.yml | 8 ++++++++ mise.toml | 24 ++++++++++++++--------- 6 files changed, 34 insertions(+), 14 deletions(-) delete mode 100644 .markdownlint.yml create mode 100644 .rumdl.toml create mode 100644 .yamllint.yml diff --git a/.github/config/.editorconfig-checker.json b/.github/config/.editorconfig-checker.json index b44b17eaf..1db338a9a 100644 --- a/.github/config/.editorconfig-checker.json +++ b/.github/config/.editorconfig-checker.json @@ -1,4 +1,7 @@ { - "_comment": "Java files are handled by flint, so editorconfig-checker ignores them.", - "Exclude": [".*\\.java$"] + "Exclude": [ + ".*\\.java$", + ".*\\.md$" + ], + "_comment": "Java files are handled by flint, so editorconfig-checker ignores them." } diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 27afa5920..53ada7433 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -1,6 +1,6 @@ { $schema: "https://docs.renovatebot.com/renovate-schema.json", - extends: ["config:best-practices", "config:recommended", "github>grafana/flint#v0.20.3"], + extends: ["config:best-practices", "config:recommended", "github>grafana/flint#v0.20.4"], platformCommit: "enabled", automerge: true, ignorePaths: [ diff --git a/.markdownlint.yml b/.markdownlint.yml deleted file mode 100644 index 0ba730636..000000000 --- a/.markdownlint.yml +++ /dev/null @@ -1,2 +0,0 @@ -# Line length is enforced by editorconfig-checker via .editorconfig -MD013: false diff --git a/.rumdl.toml b/.rumdl.toml new file mode 100644 index 000000000..066c5b40f --- /dev/null +++ b/.rumdl.toml @@ -0,0 +1,5 @@ +[MD013] +enabled = true +line-length = 120 +code-blocks = false +tables = false diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 000000000..bf0a00277 --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,8 @@ +extends: relaxed + +rules: + document-start: disable + line-length: + max: 120 + indentation: + spaces: 2 diff --git a/mise.toml b/mise.toml index 18ff6275f..0ef7d5c9a 100644 --- a/mise.toml +++ b/mise.toml @@ -1,23 +1,25 @@ [tools] -"go:github.com/gohugoio/hugo" = "v0.160.1" -"go:github.com/grafana/oats" = "0.6.1" -java = "temurin-25.0.3+9.0.LTS" -lychee = "0.23.0" -node = "24.15.0" -"npm:renovate" = "43.129.1" -protoc = "34.1" # Linters actionlint = "1.7.12" +biome = "2.4.12" "cargo:xmloxide" = "0.4.1" +"cargo:yaml-lint" = "0.1.0" editorconfig-checker = "v3.6.1" -"github:grafana/flint" = "0.20.3" "github:google/google-java-format" = "1.35.0" -"npm:@biomejs/biome" = "2.4.12" +"github:grafana/flint" = "0.20.4" +"go:github.com/gohugoio/hugo" = "v0.160.1" +"go:github.com/grafana/oats" = "0.6.1" +java = "temurin-25.0.3+9.0.LTS" +lychee = "0.23.0" +node = "24.15.0" "npm:markdownlint-cli2" = "0.22.0" "npm:prettier" = "3.8.3" +"npm:renovate" = "43.129.1" "pipx:codespell" = "2.4.2" "pipx:ruff" = "0.15.11" +protoc = "34.1" +rumdl = "0.1.80" shellcheck = "v0.11.0" shfmt = "3.13.1" @@ -115,3 +117,7 @@ java -jar ./benchmarks/target/benchmarks.jar -rf json -rff benchmark-results.jso [tasks."benchmark:generate-summary"] description = "Generate summary from existing benchmark-results.json" run = "python3 ./.mise/tasks/generate_benchmark_summary.py" + +[tasks."lint:pre-commit"] +description = "Fast auto-fix lint (skips slow checks) — for pre-commit/pre-push hooks" +run = "flint run --fix --fast-only" From 5885a34482efd3fdc1e58c16a203570455e1ce32 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 23 Apr 2026 16:43:24 +0000 Subject: [PATCH 02/15] fix: remove legacy markdownlint tool pin Signed-off-by: Gregor Zeitlinger --- .github/renovate-tracked-deps.json | 5 +++-- mise.toml | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/renovate-tracked-deps.json b/.github/renovate-tracked-deps.json index e0d8185f9..f6a80b696 100644 --- a/.github/renovate-tracked-deps.json +++ b/.github/renovate-tracked-deps.json @@ -67,7 +67,9 @@ "mise.toml": { "mise": [ "actionlint", + "biome", "cargo:xmloxide", + "cargo:yaml-lint", "editorconfig-checker", "github:google/google-java-format", "github:grafana/flint", @@ -76,13 +78,12 @@ "java", "lychee", "node", - "npm:@biomejs/biome", - "npm:markdownlint-cli2", "npm:prettier", "npm:renovate", "pipx:codespell", "pipx:ruff", "protoc", + "rumdl", "shellcheck", "shfmt" ] diff --git a/mise.toml b/mise.toml index 0ef7d5c9a..f530cf646 100644 --- a/mise.toml +++ b/mise.toml @@ -13,7 +13,6 @@ editorconfig-checker = "v3.6.1" java = "temurin-25.0.3+9.0.LTS" lychee = "0.23.0" node = "24.15.0" -"npm:markdownlint-cli2" = "0.22.0" "npm:prettier" = "3.8.3" "npm:renovate" = "43.129.1" "pipx:codespell" = "2.4.2" From 6ff2d339f2c39452cf4492a3f6b5f17597b0d501 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 23 Apr 2026 16:45:22 +0000 Subject: [PATCH 03/15] fix: add flint-managed linter configs Signed-off-by: Gregor Zeitlinger --- .github/config/.rumdl.toml | 5 +++++ .github/config/.yamllint.yml | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 .github/config/.rumdl.toml create mode 100644 .github/config/.yamllint.yml diff --git a/.github/config/.rumdl.toml b/.github/config/.rumdl.toml new file mode 100644 index 000000000..066c5b40f --- /dev/null +++ b/.github/config/.rumdl.toml @@ -0,0 +1,5 @@ +[MD013] +enabled = true +line-length = 120 +code-blocks = false +tables = false diff --git a/.github/config/.yamllint.yml b/.github/config/.yamllint.yml new file mode 100644 index 000000000..bf0a00277 --- /dev/null +++ b/.github/config/.yamllint.yml @@ -0,0 +1,8 @@ +extends: relaxed + +rules: + document-start: disable + line-length: + max: 120 + indentation: + spaces: 2 From c610fa62e02241182a211748128b5673204ab1ad Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 23 Apr 2026 16:48:43 +0000 Subject: [PATCH 04/15] fix: finish rust-native formatter cutover Signed-off-by: Gregor Zeitlinger --- .github/config/.yamllint.yml | 6 ++---- .github/renovate-tracked-deps.json | 1 - .yamllint.yml | 6 ++---- mise.toml | 1 - 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/config/.yamllint.yml b/.github/config/.yamllint.yml index bf0a00277..5a46209b1 100644 --- a/.github/config/.yamllint.yml +++ b/.github/config/.yamllint.yml @@ -2,7 +2,5 @@ extends: relaxed rules: document-start: disable - line-length: - max: 120 - indentation: - spaces: 2 + line-length: disable + indentation: warning diff --git a/.github/renovate-tracked-deps.json b/.github/renovate-tracked-deps.json index f6a80b696..0567c7437 100644 --- a/.github/renovate-tracked-deps.json +++ b/.github/renovate-tracked-deps.json @@ -78,7 +78,6 @@ "java", "lychee", "node", - "npm:prettier", "npm:renovate", "pipx:codespell", "pipx:ruff", diff --git a/.yamllint.yml b/.yamllint.yml index bf0a00277..5a46209b1 100644 --- a/.yamllint.yml +++ b/.yamllint.yml @@ -2,7 +2,5 @@ extends: relaxed rules: document-start: disable - line-length: - max: 120 - indentation: - spaces: 2 + line-length: disable + indentation: warning diff --git a/mise.toml b/mise.toml index f530cf646..c58899e80 100644 --- a/mise.toml +++ b/mise.toml @@ -13,7 +13,6 @@ editorconfig-checker = "v3.6.1" java = "temurin-25.0.3+9.0.LTS" lychee = "0.23.0" node = "24.15.0" -"npm:prettier" = "3.8.3" "npm:renovate" = "43.129.1" "pipx:codespell" = "2.4.2" "pipx:ruff" = "0.15.11" From 04e9ec637f1a7c0898a561112dda792bd7ca51f9 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 23 Apr 2026 16:52:23 +0000 Subject: [PATCH 05/15] chore: remove obsolete lint excludes Signed-off-by: Gregor Zeitlinger --- .github/config/flint.toml | 2 -- .github/config/super-linter.env | 24 ------------------------ 2 files changed, 26 deletions(-) delete mode 100644 .github/config/super-linter.env diff --git a/.github/config/flint.toml b/.github/config/flint.toml index cc437ea00..418612791 100644 --- a/.github/config/flint.toml +++ b/.github/config/flint.toml @@ -9,6 +9,4 @@ exclude = [ ] [checks.renovate-deps] -# This inventory is regenerated from the files flint still inspects, so -# super-linter-era entries drop out when they are excluded or no longer used. exclude_managers = ["github-actions", "github-runners", "maven"] diff --git a/.github/config/super-linter.env b/.github/config/super-linter.env deleted file mode 100644 index 29797cdb0..000000000 --- a/.github/config/super-linter.env +++ /dev/null @@ -1,24 +0,0 @@ -FILTER_REGEX_EXCLUDE=mvnw|src/main/generated/.*|docs/themes/.*|keystore.pkcs12|.*.java|prometheus-metrics-exporter-opentelemetry-shaded/pom.xml|CODE_OF_CONDUCT.md|CLAUDE.md|CHANGELOG.md -IGNORE_GITIGNORED_FILES=true -JAVA_FILE_NAME=google_checks.xml -LOG_LEVEL=ERROR - -VALIDATE_BASH=true -VALIDATE_EDITORCONFIG=true -VALIDATE_GIT_MERGE_CONFLICT_MARKERS=true -VALIDATE_GITHUB_ACTIONS=true -VALIDATE_JSON_PRETTIER=true -VALIDATE_MARKDOWN=true -VALIDATE_MARKDOWN_PRETTIER=true -VALIDATE_RENOVATE=true -VALIDATE_SHELL_SHFMT=true -VALIDATE_SPELL_CODESPELL=true -VALIDATE_XML=true -VALIDATE_YAML_PRETTIER=true - -FIX_JSON_PRETTIER=true -FIX_MARKDOWN=true -FIX_MARKDOWN_PRETTIER=true -FIX_SHELL_SHFMT=true -FIX_SPELL_CODESPELL=true -FIX_YAML_PRETTIER=true From 8698697d7f11ff263ead405e92a04a242ece9f90 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 23 Apr 2026 16:52:55 +0000 Subject: [PATCH 06/15] chore: remove stale super-linter reference Signed-off-by: Gregor Zeitlinger --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 98cf13e2f..9d16d10c2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,7 +7,7 @@ indent_size = 2 [{version-rules.xml,maven-wrapper.properties,checkstyle.xml,docker-compose.yaml,docker-compose.yml,Dockerfile,example_target_info.json,mise.toml,mvnm,mvnw.cmd,generate-protobuf.sh,.gitleaksignore,prometheus.properties}] max_line_length = 200 -[{grafana-dashboard-*.json,.editorconfig,super-linter.env,lychee.toml,renovate.json5,CODE_OF_CONDUCT.md}] +[{grafana-dashboard-*.json,.editorconfig,lychee.toml,renovate.json5,CODE_OF_CONDUCT.md}] max_line_length = 300 [pom.xml] From 2de2b13cdf3d939c177ddc9f07e48d9d365f26ec Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 23 Apr 2026 16:56:18 +0000 Subject: [PATCH 07/15] chore: keep flint config under config dir Signed-off-by: Gregor Zeitlinger --- .rumdl.toml | 5 ----- .yamllint.yml | 6 ------ 2 files changed, 11 deletions(-) delete mode 100644 .rumdl.toml delete mode 100644 .yamllint.yml diff --git a/.rumdl.toml b/.rumdl.toml deleted file mode 100644 index 066c5b40f..000000000 --- a/.rumdl.toml +++ /dev/null @@ -1,5 +0,0 @@ -[MD013] -enabled = true -line-length = 120 -code-blocks = false -tables = false diff --git a/.yamllint.yml b/.yamllint.yml deleted file mode 100644 index 5a46209b1..000000000 --- a/.yamllint.yml +++ /dev/null @@ -1,6 +0,0 @@ -extends: relaxed - -rules: - document-start: disable - line-length: disable - indentation: warning From 128b2e3b35e596ebbee7bb0e125e8ea4f921a6e0 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Sat, 25 Apr 2026 13:01:18 +0000 Subject: [PATCH 08/15] docs: fix flint markdown lint failures Signed-off-by: Gregor Zeitlinger --- .github/config/.editorconfig-checker.json | 5 +--- README.md | 7 ++++- docs/content/otel/names.md | 8 +++--- docs/content/otel/otlp.md | 26 +++++++++++-------- .../example-exporter-servlet-tomcat/README.md | 4 ++- .../example-prometheus-properties/README.md | 6 +++-- 6 files changed, 34 insertions(+), 22 deletions(-) diff --git a/.github/config/.editorconfig-checker.json b/.github/config/.editorconfig-checker.json index 1db338a9a..5bcecc85d 100644 --- a/.github/config/.editorconfig-checker.json +++ b/.github/config/.editorconfig-checker.json @@ -1,7 +1,4 @@ { - "Exclude": [ - ".*\\.java$", - ".*\\.md$" - ], + "Exclude": [".*\\.java$", ".*\\.md$"], "_comment": "Java files are handled by flint, so editorconfig-checker ignores them." } diff --git a/README.md b/README.md index aa5a0ba52..daef2ac3d 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,15 @@ -[![Build](https://github.com/prometheus/client_java/actions/workflows/build.yml/badge.svg)](https://github.com/prometheus/client_java/actions/workflows/build.yml) java 8+ Apache 2.0 +[![Build][build-badge]][build-workflow] +java 8+ +Apache 2.0 +[build-badge]: https://github.com/prometheus/client_java/actions/workflows/build.yml/badge.svg +[build-workflow]: https://github.com/prometheus/client_java/actions/workflows/build.yml + ## Documentation [https://prometheus.github.io/client_java](https://prometheus.github.io/client_java) diff --git a/docs/content/otel/names.md b/docs/content/otel/names.md index a5425e07f..236c3d629 100644 --- a/docs/content/otel/names.md +++ b/docs/content/otel/names.md @@ -10,10 +10,11 @@ spec, and the [OpenTelemetryExporter](/client_java/api/io/prometheus/metrics/exporter/opentelemetry/OpenTelemetryExporter.html) implements that specification. -The goal is, if you set up a pipeline as illustrated below, you will see the same metric names in -the Prometheus server as if you had exposed Prometheus metrics directly. +The goal is, if you set up a pipeline as illustrated below, you will see the same +metric names in the Prometheus server as if you had exposed Prometheus metrics +directly. -![Image of a with the Prometheus client library pushing metrics to an OpenTelemetry collector](/client_java/images/otel-pipeline.png) +![Image of a with the Prometheus client library pushing metrics to an OpenTelemetry collector][otel-pipeline] The main steps when converting OpenTelemetry metric names to Prometheus metric names are: @@ -34,3 +35,4 @@ Dots in metric and label names are now supported in the Prometheus Java client l described in [Unicode support]. [Unicode support]: {{< relref "../exporters/unicode.md" >}} +[otel-pipeline]: /client_java/images/otel-pipeline.png diff --git a/docs/content/otel/otlp.md b/docs/content/otel/otlp.md index 568219dd0..184adaf0b 100644 --- a/docs/content/otel/otlp.md +++ b/docs/content/otel/otlp.md @@ -3,10 +3,10 @@ title: OTLP weight: 1 --- -The Prometheus Java client library allows you to push metrics to an OpenTelemetry endpoint using the -OTLP protocol. +The Prometheus Java client library allows you to push metrics to an +OpenTelemetry endpoint using the OTLP protocol. -![Image of a with the Prometheus client library pushing metrics to an OpenTelemetry collector](/client_java/images/otel-pipeline.png) +![Image of a with the Prometheus client library pushing metrics to an OpenTelemetry collector][otel-pipeline] To implement this, you need to include `prometheus-metrics-exporter` as a dependency @@ -39,11 +39,10 @@ OpenTelemetryExporter.builder() .buildAndStart(); ``` -By default, the `OpenTelemetryExporter` will push metrics every 60 seconds to `localhost:4317` using -`grpc` protocol. You can configure this in code using -the [OpenTelemetryExporter.Builder](/client_java/api/io/prometheus/metrics/exporter/opentelemetry/OpenTelemetryExporter.Builder.html), -or at runtime via [`io.prometheus.exporter.opentelemetry.*`]({{< relref "../config/config.md#exporter-opentelemetry-properties" >}}) -properties. +By default, the `OpenTelemetryExporter` will push metrics every 60 seconds to +`localhost:4317` using `grpc` protocol. You can configure this in code using +the [OpenTelemetryExporter.Builder][builder-javadoc], or at runtime via +[`io.prometheus.exporter.opentelemetry.*`][otel-properties] properties. In addition to the Prometheus Java client configuration, the exporter also recognizes standard OpenTelemetry configuration. For example, you can set @@ -56,6 +55,11 @@ attach the for tracing, and use the Prometheus Java client for metrics, it is sufficient to configure the OTel agent because the Prometheus library will pick up the same configuration. -The [examples/example-exporter-opentelemetry](https://github.com/prometheus/client_java/tree/main/examples/example-exporter-opentelemetry) -folder has a Docker compose with a complete end-to-end example, including a Java app, the OTel -collector, and a Prometheus server. +The [examples/example-exporter-opentelemetry][opentelemetry-example] folder has +a Docker compose with a complete end-to-end example, including a Java app, the +OTel collector, and a Prometheus server. + +[builder-javadoc]: /client_java/api/io/prometheus/metrics/exporter/opentelemetry/OpenTelemetryExporter.Builder.html +[opentelemetry-example]: https://github.com/prometheus/client_java/tree/main/examples/example-exporter-opentelemetry +[otel-pipeline]: /client_java/images/otel-pipeline.png +[otel-properties]: {{< relref "../config/config.md#exporter-opentelemetry-properties" >}} diff --git a/examples/example-exporter-servlet-tomcat/README.md b/examples/example-exporter-servlet-tomcat/README.md index 5a77001f9..fa7dae805 100644 --- a/examples/example-exporter-servlet-tomcat/README.md +++ b/examples/example-exporter-servlet-tomcat/README.md @@ -97,4 +97,6 @@ Use the `histogram_quantile()` function to calculate quantiles from the native h histogram_quantile(0.95, rate(request_duration_seconds[10m])) ``` -![Screenshot showing the 95th Percentile Calculated from a Prometheus Native Histogram](https://github.com/prometheus/client_java/assets/330535/889fb769-9445-4f6f-8540-2b1ddffca55e) +![Screenshot showing the 95th Percentile Calculated from a Prometheus Native Histogram][native-histogram-quantile] + +[native-histogram-quantile]: https://github.com/prometheus/client_java/assets/330535/889fb769-9445-4f6f-8540-2b1ddffca55e diff --git a/examples/example-prometheus-properties/README.md b/examples/example-prometheus-properties/README.md index 2a4e61e80..9faed9201 100644 --- a/examples/example-prometheus-properties/README.md +++ b/examples/example-prometheus-properties/README.md @@ -17,8 +17,8 @@ This should create the file java -jar ./examples/example-prometheus-properties/target/example-prometheus-properties.jar ``` -View the metrics -on [http://localhost:9401/metrics?name[]=request_duration_seconds&name[]=request_size_bytes](http://localhost:9401/metrics?name[]=request_duration_seconds&name[]=request_size_bytes). +View the metrics on +[http://localhost:9401/metrics?name[]=request_duration_seconds&name[]=request_size_bytes][metrics-url]. The example has a `prometheus.properties` file in the classpath with a few examples of how to change settings at runtime. @@ -28,3 +28,5 @@ There are multiple alternative ways to specify the location of the `prometheus.p - Put it in the classpath, like in this example. - Set the environment variable `PROMETHEUS_CONFIG` to the file location. - Set the `prometheus.config` System property to the file location. + +[metrics-url]: http://localhost:9401/metrics?name[]=request_duration_seconds&name[]=request_size_bytes From 5d5ddf25c22c6db27652cd64e118542298568b1c Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Sat, 25 Apr 2026 13:16:47 +0000 Subject: [PATCH 09/15] chore: validate flint branch via cargo pre-release pin Signed-off-by: Gregor Zeitlinger --- .github/config/.yamllint.yml | 2 +- .github/renovate-tracked-deps.json | 8 ++++---- .gitleaksignore | 2 -- .prettierignore | 1 - examples/example-custom-buckets/README.md | 1 - mise.toml | 9 +++++---- 6 files changed, 10 insertions(+), 13 deletions(-) delete mode 100644 .gitleaksignore delete mode 100644 .prettierignore diff --git a/.github/config/.yamllint.yml b/.github/config/.yamllint.yml index 5a46209b1..0b3928e3c 100644 --- a/.github/config/.yamllint.yml +++ b/.github/config/.yamllint.yml @@ -3,4 +3,4 @@ extends: relaxed rules: document-start: disable line-length: disable - indentation: warning + indentation: enable diff --git a/.github/renovate-tracked-deps.json b/.github/renovate-tracked-deps.json index 0567c7437..a1ae79b74 100644 --- a/.github/renovate-tracked-deps.json +++ b/.github/renovate-tracked-deps.json @@ -67,12 +67,12 @@ "mise.toml": { "mise": [ "actionlint", + "aqua:owenlamont/ryl", "biome", - "cargo:xmloxide", - "cargo:yaml-lint", + "cargo:https://github.com/grafana/flint", "editorconfig-checker", "github:google/google-java-format", - "github:grafana/flint", + "github:jonwiggins/xmloxide", "go:github.com/gohugoio/hugo", "go:github.com/grafana/oats", "java", @@ -80,8 +80,8 @@ "node", "npm:renovate", "pipx:codespell", - "pipx:ruff", "protoc", + "ruff", "rumdl", "shellcheck", "shfmt" diff --git a/.gitleaksignore b/.gitleaksignore deleted file mode 100644 index 605fefa97..000000000 --- a/.gitleaksignore +++ /dev/null @@ -1,2 +0,0 @@ -/tmp/lint/integration-tests/it-pushgateway/src/test/resources/pushgateway-ssl.yaml:private-key:36 -/github/workspace/integration-tests/it-pushgateway/src/test/resources/pushgateway-ssl.yaml:private-key:36 diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 1cbfcb82e..000000000 --- a/.prettierignore +++ /dev/null @@ -1 +0,0 @@ -docs/themes/** diff --git a/examples/example-custom-buckets/README.md b/examples/example-custom-buckets/README.md index a7a6a8564..02b0c554a 100644 --- a/examples/example-custom-buckets/README.md +++ b/examples/example-custom-buckets/README.md @@ -163,7 +163,6 @@ docker-compose down ## Further Reading - - [Prometheus Native Histograms Specification](https://prometheus.io/docs/specs/native_histograms/) - [Prometheus Java Client Documentation](https://prometheus.github.io/client_java/) diff --git a/mise.toml b/mise.toml index c58899e80..3a4b3d2c2 100644 --- a/mise.toml +++ b/mise.toml @@ -3,11 +3,9 @@ # Linters actionlint = "1.7.12" biome = "2.4.12" -"cargo:xmloxide" = "0.4.1" -"cargo:yaml-lint" = "0.1.0" +"cargo:https://github.com/grafana/flint" = "rev:64fe0a654ca3257f3ce80e05c493caf38e52f47c" editorconfig-checker = "v3.6.1" "github:google/google-java-format" = "1.35.0" -"github:grafana/flint" = "0.20.4" "go:github.com/gohugoio/hugo" = "v0.160.1" "go:github.com/grafana/oats" = "0.6.1" java = "temurin-25.0.3+9.0.LTS" @@ -15,13 +13,16 @@ lychee = "0.23.0" node = "24.15.0" "npm:renovate" = "43.129.1" "pipx:codespell" = "2.4.2" -"pipx:ruff" = "0.15.11" protoc = "34.1" rumdl = "0.1.80" shellcheck = "v0.11.0" shfmt = "3.13.1" +"aqua:owenlamont/ryl" = "0.6.0" +ruff = "0.15.11" +"github:jonwiggins/xmloxide" = "v0.4.2" [env] +CARGO_NET_GIT_FETCH_WITH_CLI = "true" FLINT_CONFIG_DIR = ".github/config" # renovate: datasource=github-releases depName=grafana/docker-otel-lgtm LGTM_VERSION = "0.25.0" From 305410c24193987276626b25dcf5fb6a50db0507 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Sat, 25 Apr 2026 13:38:40 +0000 Subject: [PATCH 10/15] chore: align lint config with editorconfig carve-outs Signed-off-by: Gregor Zeitlinger --- .editorconfig | 8 ++++++++ .github/config/.editorconfig-checker.json | 5 +---- mise.toml | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.editorconfig b/.editorconfig index 9d16d10c2..aa77aa8ed 100644 --- a/.editorconfig +++ b/.editorconfig @@ -20,3 +20,11 @@ max_line_length = 120 [{.mise/tasks/build-release.sh,.github/workflows/*.yml}] max_line_length = 300 + +[*.java] +# Java line length is handled by google-java-format +max_line_length = off + +[*.md] +# Markdown line length is handled by rumdl +max_line_length = off diff --git a/.github/config/.editorconfig-checker.json b/.github/config/.editorconfig-checker.json index 5bcecc85d..0967ef424 100644 --- a/.github/config/.editorconfig-checker.json +++ b/.github/config/.editorconfig-checker.json @@ -1,4 +1 @@ -{ - "Exclude": [".*\\.java$", ".*\\.md$"], - "_comment": "Java files are handled by flint, so editorconfig-checker ignores them." -} +{} diff --git a/mise.toml b/mise.toml index 3a4b3d2c2..772af51c6 100644 --- a/mise.toml +++ b/mise.toml @@ -3,7 +3,7 @@ # Linters actionlint = "1.7.12" biome = "2.4.12" -"cargo:https://github.com/grafana/flint" = "rev:64fe0a654ca3257f3ce80e05c493caf38e52f47c" +"cargo:https://github.com/grafana/flint" = "rev:7034ab0ad72a34f9dd39388cf8c659f97517c744" editorconfig-checker = "v3.6.1" "github:google/google-java-format" = "1.35.0" "go:github.com/gohugoio/hugo" = "v0.160.1" From cf33f4ef95aeb7318fa6ab488797624312dbcee9 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Sat, 25 Apr 2026 13:41:06 +0000 Subject: [PATCH 11/15] chore: drop empty editorconfig-checker config Signed-off-by: Gregor Zeitlinger --- .github/config/.editorconfig-checker.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .github/config/.editorconfig-checker.json diff --git a/.github/config/.editorconfig-checker.json b/.github/config/.editorconfig-checker.json deleted file mode 100644 index 0967ef424..000000000 --- a/.github/config/.editorconfig-checker.json +++ /dev/null @@ -1 +0,0 @@ -{} From bbeb24708d199954e27aba50664622dd233e4731 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Sat, 25 Apr 2026 13:44:29 +0000 Subject: [PATCH 12/15] chore: drop redundant markdown suppression Signed-off-by: Gregor Zeitlinger --- examples/example-custom-buckets/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/example-custom-buckets/README.md b/examples/example-custom-buckets/README.md index 02b0c554a..a1d2c10bb 100644 --- a/examples/example-custom-buckets/README.md +++ b/examples/example-custom-buckets/README.md @@ -162,8 +162,6 @@ docker-compose down ## Further Reading - - - [Prometheus Native Histograms Specification](https://prometheus.io/docs/specs/native_histograms/) - [Prometheus Java Client Documentation](https://prometheus.github.io/client_java/) - [OpenTelemetry Exponential Histograms](https://opentelemetry.io/docs/specs/otel/metrics/data-model/#exponentialhistogram) From 9e847e37c2c4c3dbd8c684ed5a72996f5ea2e00c Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Sat, 25 Apr 2026 14:07:42 +0000 Subject: [PATCH 13/15] chore: normalize tools and drop stale markdown suppressions Signed-off-by: Gregor Zeitlinger --- benchmarks/README.md | 6 +-- docs/content/_index.md | 2 +- docs/content/config/config.md | 16 +----- docs/content/exporters/httpserver.md | 10 ++-- docs/content/exporters/pushgateway.md | 2 +- docs/content/exporters/servlet.md | 8 ++- docs/content/exporters/spring.md | 4 +- docs/content/exporters/unicode.md | 2 +- docs/content/getting-started/labels.md | 2 +- docs/content/getting-started/metric-types.md | 8 ++- docs/content/getting-started/multi-target.md | 2 - docs/content/getting-started/performance.md | 4 +- docs/content/getting-started/quickstart.md | 2 +- docs/content/instrumentation/caffeine.md | 2 +- docs/content/instrumentation/jvm.md | 52 +++++++------------ docs/content/internals/model.md | 2 +- docs/content/otel/jvm-runtime-metrics.md | 6 +-- docs/content/otel/names.md | 6 +-- docs/content/otel/otlp.md | 4 +- docs/content/otel/tracing.md | 6 +-- .../example-exemplars-tail-sampling/README.md | 8 ++- .../example-exporter-httpserver/README.md | 4 +- .../example-exporter-multi-target/README.md | 4 +- .../example-exporter-opentelemetry/README.md | 2 - .../example-exporter-servlet-tomcat/README.md | 8 +-- mise.toml | 18 +++---- 26 files changed, 77 insertions(+), 113 deletions(-) diff --git a/benchmarks/README.md b/benchmarks/README.md index b4c824d85..3859eddea 100644 --- a/benchmarks/README.md +++ b/benchmarks/README.md @@ -57,9 +57,9 @@ JMH parameter reference: See Javadoc of the benchmark classes: -- [CounterBenchmark](https://github.com/prometheus/client_java/blob/main/benchmarks/src/main/java/io/prometheus/metrics/benchmarks/CounterBenchmark.java) -- [HistogramBenchmark](https://github.com/prometheus/client_java/blob/main/benchmarks/src/main/java/io/prometheus/metrics/benchmarks/HistogramBenchmark.java) -- [TextFormatUtilBenchmark](https://github.com/prometheus/client_java/blob/main/benchmarks/src/main/java/io/prometheus/metrics/benchmarks/TextFormatUtilBenchmark.java) +- [CounterBenchmark](https://github.com/prometheus/client_java/blob/main/benchmarks/src/main/java/io/prometheus/metrics/benchmarks/CounterBenchmark.java) +- [HistogramBenchmark](https://github.com/prometheus/client_java/blob/main/benchmarks/src/main/java/io/prometheus/metrics/benchmarks/HistogramBenchmark.java) +- [TextFormatUtilBenchmark](https://github.com/prometheus/client_java/blob/main/benchmarks/src/main/java/io/prometheus/metrics/benchmarks/TextFormatUtilBenchmark.java) ## What Prometheus Java client optimizes for diff --git a/docs/content/_index.md b/docs/content/_index.md index 23799cbde..c449482f3 100644 --- a/docs/content/_index.md +++ b/docs/content/_index.md @@ -32,7 +32,7 @@ synchronization. See Javadoc comments in **More Info** The Grafana Labs Blog has a post -[Introducing the Prometheus Java Client 1.0.0](https://grafana.com/blog/2023/09/27/introducing-the-prometheus-java-client-1-0-0/) +[Introducing the Prometheus Java Client 1.0.0](https://grafana.com/blog/2023/09/27/introducing-the-prometheus-java-client-1-0-0/) with a good overview of the release. There will also be a presentation at the [PromCon](https://promcon.io) conference on 29 Sep 2023. diff --git a/docs/content/config/config.md b/docs/content/config/config.md index 4161ddb15..2db71c72e 100644 --- a/docs/content/config/config.md +++ b/docs/content/config/config.md @@ -72,7 +72,6 @@ When the same property is defined in multiple sources, the following precedence ## Metrics Properties - | Name | Javadoc | Note | | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | @@ -90,7 +89,6 @@ When the same property is defined in multiple sources, the following precedence | io.prometheus.metrics.summary_max_age_seconds | [Summary.Builder.maxAgeSeconds()]() | | | io.prometheus.metrics.summary_number_of_age_buckets | [Summary.Builder.numberOfAgeBuckets()]() | | - ### Notes @@ -126,7 +124,6 @@ This works for all Metrics properties. ## Exemplar Properties - | Name | Javadoc | Note | | ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- | @@ -134,24 +131,20 @@ This works for all Metrics properties. | io.prometheus.exemplars.max_retention_period_seconds | [ExemplarsProperties.getMaxRetentionPeriodSeconds()]() | | | io.prometheus.exemplars.sample_interval_milliseconds | [ExemplarsProperties.getSampleIntervalMilliseconds()]() | | - ## Exporter Properties - | Name | Javadoc | Note | | ---------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- | | io.prometheus.exporter.include_created_timestamps | [ExporterProperties.getIncludeCreatedTimestamps()]() | (1) | | io.prometheus.exporter.exemplars_on_all_metric_types | [ExporterProperties.getExemplarsOnAllMetricTypes()]() | (1) | - (1) Boolean value, `true` or `false`. Default see Javadoc. ## Exporter Filter Properties - | Name | Javadoc | Note | | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- | @@ -160,7 +153,6 @@ This works for all Metrics properties. | io.prometheus.exporter.filter.metric_name_must_start_with | [ExporterFilterProperties.getAllowedMetricNamePrefixes()]() | (3) | | io.prometheus.exporter.filter.metric_name_must_not_start_with | [ExporterFilterProperties.getExcludedMetricNamePrefixes()]() | (4) | - @@ -174,17 +166,14 @@ Only metrics starting with these prefixes will be exposed.
## Exporter HTTPServer Properties - | Name | Javadoc | Note | | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ---- | | io.prometheus.exporter.http_server.port | [HTTPServer.Builder.port()]() | | - ## Exporter OpenTelemetry Properties - | Name | Javadoc | Note | | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- | @@ -199,7 +188,6 @@ Only metrics starting with these prefixes will be exposed.
| io.prometheus.exporter.opentelemetry.service_version | [OpenTelemetryExporter.Builder.serviceVersion()]() | | | io.prometheus.exporter.opentelemetry.resource_attributes | [OpenTelemetryExporter.Builder.resourceAttributes()]() | (3) | - @@ -216,7 +204,6 @@ See Javadoc for details. ## Exporter PushGateway Properties - | Name | Javadoc | Note | | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---- | @@ -225,8 +212,7 @@ See Javadoc for details. | io.prometheus.exporter.pushgateway.job | [PushGateway.Builder.job()]() | | | io.prometheus.exporter.pushgateway.escaping_scheme | [PushGateway.Builder.escapingScheme()]() | (1) | - (1) Escaping scheme can be `allow-utf-8`, `underscores`, `dots`, or `values` as described in -[escaping schemes](https://github.com/prometheus/docs/blob/main/docs/instrumenting/escaping_schemes.md#escaping-schemes) +[escaping schemes](https://github.com/prometheus/docs/blob/main/docs/instrumenting/escaping_schemes.md#escaping-schemes) and in the [Unicode documentation]({{< relref "../exporters/unicode.md" >}}). diff --git a/docs/content/exporters/httpserver.md b/docs/content/exporters/httpserver.md index a9017b0de..c0db181c9 100644 --- a/docs/content/exporters/httpserver.md +++ b/docs/content/exporters/httpserver.md @@ -14,8 +14,8 @@ HTTPServer server = HTTPServer.builder() ``` By default, `HTTPServer` binds to any IP address, you can change this with -[hostname()]() -or [inetAddress()](). +[hostname()]() +or [inetAddress()](). `HTTPServer` is configured with three endpoints: @@ -24,13 +24,13 @@ or [inetAddress()](). +with [defaultHandler()](). ## Authentication and HTTPS -- [authenticator()]() +- [authenticator()]() is for configuring authentication. -- [httpsConfigurator()]() +- [httpsConfigurator()]() is for configuring HTTPS. You can find an example of authentication and SSL in the diff --git a/docs/content/exporters/pushgateway.md b/docs/content/exporters/pushgateway.md index 497aa9b57..d3713769d 100644 --- a/docs/content/exporters/pushgateway.md +++ b/docs/content/exporters/pushgateway.md @@ -115,7 +115,7 @@ PushGateway pushGateway = PushGateway.builder() However, this requires that the JVM can validate the server certificate. If you want to skip certificate verification, you need to provide your own -[HttpConnectionFactory](/client_java/api/io/prometheus/metrics/exporter/pushgateway/HttpConnectionFactory.html). +[HttpConnectionFactory](/client_java/api/io/prometheus/metrics/exporter/pushgateway/HttpConnectionFactory.html). The `PushGatewayTestApp` in `integration-tests/it-pushgateway` has a complete example of this. ## Configuration Properties diff --git a/docs/content/exporters/servlet.md b/docs/content/exporters/servlet.md index 2b0873b70..c93a1d4b3 100644 --- a/docs/content/exporters/servlet.md +++ b/docs/content/exporters/servlet.md @@ -4,14 +4,13 @@ weight: 5 --- The -[PrometheusMetricsServlet](/client_java/api/io/prometheus/metrics/exporter/servlet/jakarta/PrometheusMetricsServlet.html) +[PrometheusMetricsServlet](/client_java/api/io/prometheus/metrics/exporter/servlet/jakarta/PrometheusMetricsServlet.html) is a [Jakarta Servlet](https://jakarta.ee/specifications/servlet/) for exposing a metric endpoint. ## web.xml The old-school way of configuring a servlet is in a `web.xml` file: - ```xml @@ -30,7 +29,6 @@ The old-school way of configuring a servlet is in a `web.xml` file: ``` - ## Programmatic @@ -40,12 +38,12 @@ The API for that depends on the Servlet container. The [examples](https://github.com/prometheus/client_java/tree/1.0.x/examples) directory has an example of an embedded [Tomcat](https://tomcat.apache.org/) container with the -[PrometheusMetricsServlet](/client_java/api/io/prometheus/metrics/exporter/servlet/jakarta/PrometheusMetricsServlet.html) +[PrometheusMetricsServlet](/client_java/api/io/prometheus/metrics/exporter/servlet/jakarta/PrometheusMetricsServlet.html) configured. ## Spring You can use -the [PrometheusMetricsServlet](/client_java/api/io/prometheus/metrics/exporter/servlet/jakarta/PrometheusMetricsServlet.html) +the [PrometheusMetricsServlet](/client_java/api/io/prometheus/metrics/exporter/servlet/jakarta/PrometheusMetricsServlet.html) in Spring applications. See [our Spring doc]({{< relref "spring.md" >}}). diff --git a/docs/content/exporters/spring.md b/docs/content/exporters/spring.md index 45df21431..80a7739fa 100644 --- a/docs/content/exporters/spring.md +++ b/docs/content/exporters/spring.md @@ -26,7 +26,7 @@ Spring anyway. Maybe you want full support for all Prometheus metric types, or you want to use the new Prometheus native histograms. The easiest way to use the Prometheus metrics library in Spring is to configure the -[PrometheusMetricsServlet](/client_java/api/io/prometheus/metrics/exporter/servlet/jakarta/PrometheusMetricsServlet.html) +[PrometheusMetricsServlet](/client_java/api/io/prometheus/metrics/exporter/servlet/jakarta/PrometheusMetricsServlet.html) to expose metrics. Dependencies: @@ -76,7 +76,7 @@ public class DemoApplication { ``` The important part are the last three lines: They configure the -[PrometheusMetricsServlet](/client_java/api/io/prometheus/metrics/exporter/servlet/jakarta/PrometheusMetricsServlet.html) +[PrometheusMetricsServlet](/client_java/api/io/prometheus/metrics/exporter/servlet/jakarta/PrometheusMetricsServlet.html) to expose metrics on `/metrics`: ```java diff --git a/docs/content/exporters/unicode.md b/docs/content/exporters/unicode.md index 2a34e0400..026292c39 100644 --- a/docs/content/exporters/unicode.md +++ b/docs/content/exporters/unicode.md @@ -12,7 +12,7 @@ The Prometheus Java client library allows all Unicode characters, that can be en At scrape time, some characters are replaced based on the `encoding` header according to -the [Escaping scheme](https://github.com/prometheus/docs/blob/main/docs/instrumenting/escaping_schemes.md). +the [Escaping scheme](https://github.com/prometheus/docs/blob/main/docs/instrumenting/escaping_schemes.md). For example, if you use the `underscores` escaping scheme, dots in metric and label names are replaced with underscores, so that the metric name `http.server.duration` becomes diff --git a/docs/content/getting-started/labels.md b/docs/content/getting-started/labels.md index d056a6ce6..1cbae13d7 100644 --- a/docs/content/getting-started/labels.md +++ b/docs/content/getting-started/labels.md @@ -150,4 +150,4 @@ Counter counter = Counter.builder() However, most use cases for `constLabels()` are better covered by target labels set by the scraping Prometheus server, or by one specific metric (e.g. a `build_info` or a `machine_role` metric). See also -[target labels, not static scraped labels](https://prometheus.io/docs/instrumenting/writing_exporters/#target-labels-not-static-scraped-labels). +[target labels, not static scraped labels](https://prometheus.io/docs/instrumenting/writing_exporters/#target-labels-not-static-scraped-labels). diff --git a/docs/content/getting-started/metric-types.md b/docs/content/getting-started/metric-types.md index f1c2a2321..f5366859b 100644 --- a/docs/content/getting-started/metric-types.md +++ b/docs/content/getting-started/metric-types.md @@ -84,7 +84,7 @@ the Prometheus server. format and ingest both, the classic and the native flavor. This is great for migrating from classic histograms to native histograms. -See [examples/example-native-histogram](https://github.com/prometheus/client_java/tree/1.0.x/examples/example-native-histogram) +See [examples/example-native-histogram](https://github.com/prometheus/client_java/tree/1.0.x/examples/example-native-histogram) for an example. ```java @@ -210,7 +210,7 @@ NHCB is useful when: - Exponential bucketing from standard native histograms isn't a good fit for your distribution {{< /hint >}} -See [examples/example-custom-buckets](https://github.com/prometheus/client_java/tree/main/examples/example-custom-buckets) +See [examples/example-custom-buckets](https://github.com/prometheus/client_java/tree/main/examples/example-custom-buckets) for a complete example with Prometheus and Grafana. Histograms and summaries are both used for observing distributions. Therefore, the both implement @@ -292,7 +292,7 @@ be changed with `maxAgeSeconds()` and `numberOfAgeBuckets()`. Some options can be configured at runtime, see [config]({{< relref "../config/config.md" >}}). In general you should prefer histograms over summaries. The Prometheus query language has a -function [histogram_quantile()](https://prometheus.io/docs/prometheus/latest/querying/functions/#histogram_quantile) +function [histogram_quantile()](https://prometheus.io/docs/prometheus/latest/querying/functions/#histogram_quantile) for calculating quantiles from histograms. The advantage of query-time quantile calculation is that you can aggregate histograms before calculating the quantile. With summaries you must use the quantile with all its labels as it is. @@ -318,7 +318,6 @@ info.setLabelValues(version, vendor, runtime); The info above looks as follows in OpenMetrics text format: - ```text # TYPE jvm_runtime info @@ -326,7 +325,6 @@ The info above looks as follows in OpenMetrics text format: jvm_runtime_info{runtime="OpenJDK Runtime Environment",vendor="Oracle Corporation",version="1.8.0_382-b05"} 1 ``` - The example is taken from the `prometheus-metrics-instrumentation-jvm` module, so if you have `JvmMetrics` registered you should have a `jvm_runtime_info` metric out-of-the-box. diff --git a/docs/content/getting-started/multi-target.md b/docs/content/getting-started/multi-target.md index 16f85ac40..9227f732d 100644 --- a/docs/content/getting-started/multi-target.md +++ b/docs/content/getting-started/multi-target.md @@ -11,7 +11,6 @@ To support multi-target pattern you can create a custom collector overriding the method in ExtendedMultiCollector see SampleExtendedMultiCollector in io.prometheus.metrics.examples.httpserver - ```java public class SampleExtendedMultiCollector extends ExtendedMultiCollector { @@ -80,7 +79,6 @@ public class SampleExtendedMultiCollector extends ExtendedMultiCollector { ``` - `PrometheusScrapeRequest` provides methods to access http-related infos from the request originally received by the endpoint diff --git a/docs/content/getting-started/performance.md b/docs/content/getting-started/performance.md index 435f0d18a..42b2a0a48 100644 --- a/docs/content/getting-started/performance.md +++ b/docs/content/getting-started/performance.md @@ -53,8 +53,8 @@ In performance critical applications we recommend to use either the classic repr native representation, but not both. You can either configure this in code for each histogram by -calling [classicOnly()]() -or [nativeOnly()](), +calling [classicOnly()]() +or [nativeOnly()](), or you use the corresponding [config options]({{< relref "../config/config.md" >}}). One way to do this is with system properties in the command line when you start your application diff --git a/docs/content/getting-started/quickstart.md b/docs/content/getting-started/quickstart.md index 920d89b7f..635c63be0 100644 --- a/docs/content/getting-started/quickstart.md +++ b/docs/content/getting-started/quickstart.md @@ -63,7 +63,7 @@ it from the dependencies. ## Dependency management A Bill of Material -([BOM](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#bill-of-materials-bom-poms)) +([BOM](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#bill-of-materials-bom-poms)) ensures that versions of dependencies (including transitive ones) are aligned. This is especially important when using Spring Boot, which manages some of the dependencies of the project. diff --git a/docs/content/instrumentation/caffeine.md b/docs/content/instrumentation/caffeine.md index 104a9b9fa..90a88c05f 100644 --- a/docs/content/instrumentation/caffeine.md +++ b/docs/content/instrumentation/caffeine.md @@ -99,7 +99,7 @@ Two metrics exist for observability specifically of caches that define a `weighe ```text # TYPE caffeine_cache_eviction_weight counter -# HELP caffeine_cache_eviction_weight Weight of evicted cache entries, doesn't include manually removed entries // editorconfig-checker-disable-line +# HELP caffeine_cache_eviction_weight Weight of evicted cache entries, doesn't include manually removed entries caffeine_cache_eviction_weight_total{cache="mycache"} 5.0 # TYPE caffeine_cache_weighted_size gauge diff --git a/docs/content/instrumentation/jvm.md b/docs/content/instrumentation/jvm.md index a9a15341f..73be4d007 100644 --- a/docs/content/instrumentation/jvm.md +++ b/docs/content/instrumentation/jvm.md @@ -54,9 +54,9 @@ register all JVM metrics, you can register each of these classes individually ra ## JVM Buffer Pool Metrics JVM buffer pool metrics are provided by -the [JvmBufferPoolMetrics](/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmBufferPoolMetrics.html) +the [JvmBufferPoolMetrics](/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmBufferPoolMetrics.html) class. The data is coming from -the [BufferPoolMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/BufferPoolMXBean.html). +the [BufferPoolMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/BufferPoolMXBean.html). Example metrics: ```text @@ -77,12 +77,11 @@ jvm_buffer_pool_used_bytes{pool="mapped"} 0.0 ## JVM Class Loading Metrics JVM class loading metrics are provided by -the [JvmClassLoadingMetrics](/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmClassLoadingMetrics.html) +the [JvmClassLoadingMetrics](/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmClassLoadingMetrics.html) class. The data is coming from -the [ClassLoadingMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/ClassLoadingMXBean.html). +the [ClassLoadingMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/ClassLoadingMXBean.html). Example metrics: - ```text # HELP jvm_classes_currently_loaded The number of classes that are currently loaded in the JVM @@ -96,17 +95,15 @@ jvm_classes_loaded_total 1109.0 jvm_classes_unloaded_total 0.0 ``` - ## JVM Compilation Metrics JVM compilation metrics are provided by -the [JvmCompilationMetrics](/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmCompilationMetrics.html) +the [JvmCompilationMetrics](/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmCompilationMetrics.html) class. The data is coming from -the [CompilationMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/CompilationMXBean.html). +the [CompilationMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/CompilationMXBean.html). Example metrics: - ```text # HELP jvm_compilation_time_seconds_total The total time in seconds taken for HotSpot class compilation @@ -114,14 +111,13 @@ Example metrics: jvm_compilation_time_seconds_total 0.152 ``` - ## JVM Garbage Collector Metrics JVM garbage collector metrics are provided by -the [JvmGarbageCollectorMetric](/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmGarbageCollectorMetrics.html) +the [JvmGarbageCollectorMetric](/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmGarbageCollectorMetrics.html) class. The data is coming from -the [GarbageCollectorMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/GarbageCollectorMXBean.html). +the [GarbageCollectorMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/GarbageCollectorMXBean.html). Example metrics: ```text @@ -136,13 +132,12 @@ jvm_gc_collection_seconds_sum{gc="PS Scavenge"} 0.0 ## JVM Memory Metrics JVM memory metrics are provided by -the [JvmMemoryMetrics](/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmMemoryMetrics.html) +the [JvmMemoryMetrics](/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmMemoryMetrics.html) class. The data is coming from -the [MemoryMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/MemoryMXBean.html) -and the [MemoryPoolMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/MemoryPoolMXBean.html). +the [MemoryMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/MemoryMXBean.html) +and the [MemoryPoolMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/MemoryPoolMXBean.html). Example metrics: - ```text # HELP jvm_memory_committed_bytes Committed (bytes) of a given JVM memory area. @@ -218,18 +213,16 @@ jvm_memory_used_bytes{area="heap"} 9051232.0 jvm_memory_used_bytes{area="nonheap"} 1.1490688E7 ``` - ## JVM Memory Pool Allocation Metrics JVM memory pool allocation metrics are provided by -the [JvmMemoryPoolAllocationMetrics](/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmMemoryPoolAllocationMetrics.html) +the [JvmMemoryPoolAllocationMetrics](/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmMemoryPoolAllocationMetrics.html) class. The data is obtained by adding -a [NotificationListener](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/javax/management/NotificationListener.html) -to the [GarbageCollectorMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/GarbageCollectorMXBean.html). +a [NotificationListener](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/javax/management/NotificationListener.html) +to the [GarbageCollectorMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/GarbageCollectorMXBean.html). Example metrics: - ```text # HELP jvm_memory_pool_allocated_bytes_total Total bytes allocated in a given JVM memory pool. Only updated after GC, not continuously. @@ -242,16 +235,14 @@ jvm_memory_pool_allocated_bytes_total{pool="PS Old Gen"} 1428888.0 jvm_memory_pool_allocated_bytes_total{pool="PS Survivor Space"} 4115280.0 ``` - ## JVM Runtime Info Metric The JVM runtime info metric is provided by -the [JvmRuntimeInfoMetric](/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmRuntimeInfoMetric.html) +the [JvmRuntimeInfoMetric](/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmRuntimeInfoMetric.html) class. The data is obtained via system properties and will not change throughout the lifetime of the application. Example metric: - ```text # TYPE jvm_runtime info @@ -259,17 +250,15 @@ application. Example metric: jvm_runtime_info{runtime="OpenJDK Runtime Environment",vendor="Oracle Corporation",version="1.8.0_382-b05"} 1 ``` - ## JVM Thread Metrics JVM thread metrics are provided by -the [JvmThreadsMetrics](/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmThreadsMetrics.html) +the [JvmThreadsMetrics](/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmThreadsMetrics.html) class. The data is coming from -the [ThreadMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/ThreadMXBean.html). +the [ThreadMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/ThreadMXBean.html). Example metrics: - ```text # HELP jvm_threads_current Current thread count of a JVM @@ -301,20 +290,19 @@ jvm_threads_state{state="UNKNOWN"} 0.0 jvm_threads_state{state="WAITING"} 3.0 ``` - ## Process Metrics Process metrics are provided by the [ProcessMetrics](/client_java/api/io/prometheus/metrics/instrumentation/jvm/ProcessMetrics.html) class. The data is coming from -the [OperatingSystemMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/OperatingSystemMXBean.html), -the [RuntimeMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/RuntimeMXBean.html), +the [OperatingSystemMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/OperatingSystemMXBean.html), +the [RuntimeMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/RuntimeMXBean.html), and from the `/proc/self/status` file on Linux. The metrics with prefix `process_` are not specific to Java, but should be provided by every Prometheus client library, see [Process Metrics](https://prometheus.io/docs/instrumenting/writing_clientlibs/#process-metrics) in the -Prometheus [writing client libraries](https://prometheus.io/docs/instrumenting/writing_clientlibs/#process-metrics) +Prometheus [writing client libraries](https://prometheus.io/docs/instrumenting/writing_clientlibs/#process-metrics) documentation. Example metrics: ```text diff --git a/docs/content/internals/model.md b/docs/content/internals/model.md index e1b2af644..9d4061bcc 100644 --- a/docs/content/internals/model.md +++ b/docs/content/internals/model.md @@ -28,7 +28,7 @@ invalid. The model is an internal library, implementing read-only immutable snapshots. These snapshots are returned by -the [Collector.collect()]() +the [Collector.collect()]() method. There is no need for users to use `prometheus-metrics-model` directly. Users should use the API diff --git a/docs/content/otel/jvm-runtime-metrics.md b/docs/content/otel/jvm-runtime-metrics.md index d61da1861..f8206be15 100644 --- a/docs/content/otel/jvm-runtime-metrics.md +++ b/docs/content/otel/jvm-runtime-metrics.md @@ -4,7 +4,7 @@ weight: 4 --- OpenTelemetry's -[runtime-telemetry](https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/runtime-telemetry) +[runtime-telemetry](https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/runtime-telemetry) module is an alternative to [prometheus-metrics-instrumentation-jvm]({{< relref "../instrumentation/jvm.md" >}}) for users who want JVM metrics following OTel semantic conventions. @@ -12,7 +12,7 @@ for users who want JVM metrics following OTel semantic conventions. Key advantages: - Metric names follow - [OTel semantic conventions](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/) + [OTel semantic conventions](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/) - Java 17+ JFR support (context switches, network I/O, lock contention, memory allocation) - Alignment with the broader OTel ecosystem @@ -157,7 +157,7 @@ HTTPServer.builder() .buildAndStart(); ``` -The [examples/example-otel-jvm-runtime-metrics](https://github.com/prometheus/client_java/tree/main/examples/example-otel-jvm-runtime-metrics) +The [examples/example-otel-jvm-runtime-metrics](https://github.com/prometheus/client_java/tree/main/examples/example-otel-jvm-runtime-metrics) directory has a complete runnable example. ## Configuration diff --git a/docs/content/otel/names.md b/docs/content/otel/names.md index 236c3d629..04d7d5627 100644 --- a/docs/content/otel/names.md +++ b/docs/content/otel/names.md @@ -5,9 +5,9 @@ weight: 3 OpenTelemetry naming conventions are different from Prometheus naming conventions. The mapping from OpenTelemetry metric names to Prometheus metric names is well defined in -OpenTelemetry's [Prometheus and OpenMetrics Compatibility](https://opentelemetry.io/docs/specs/otel/compatibility/prometheus_and_openmetrics/) +OpenTelemetry's [Prometheus and OpenMetrics Compatibility](https://opentelemetry.io/docs/specs/otel/compatibility/prometheus_and_openmetrics/) spec, and -the [OpenTelemetryExporter](/client_java/api/io/prometheus/metrics/exporter/opentelemetry/OpenTelemetryExporter.html) +the [OpenTelemetryExporter](/client_java/api/io/prometheus/metrics/exporter/opentelemetry/OpenTelemetryExporter.html) implements that specification. The goal is, if you set up a pipeline as illustrated below, you will see the same @@ -26,7 +26,7 @@ The main steps when converting OpenTelemetry metric names to Prometheus metric n OpenTelemetry defines not only a line protocol, but also _semantic conventions_, i.e. standardized metric and label names. For example, -OpenTelemetry's [Semantic Conventions for HTTP Metrics](https://opentelemetry.io/docs/specs/otel/metrics/semantic_conventions/http-metrics/) +OpenTelemetry's [Semantic Conventions for HTTP Metrics](https://opentelemetry.io/docs/specs/otel/metrics/semantic_conventions/http-metrics/) say that if you instrument an HTTP server with OpenTelemetry, you must have a histogram named `http.server.duration`. diff --git a/docs/content/otel/otlp.md b/docs/content/otel/otlp.md index 184adaf0b..31aacfcbd 100644 --- a/docs/content/otel/otlp.md +++ b/docs/content/otel/otlp.md @@ -46,9 +46,9 @@ the [OpenTelemetryExporter.Builder][builder-javadoc], or at runtime via In addition to the Prometheus Java client configuration, the exporter also recognizes standard OpenTelemetry configuration. For example, you can set -the [OTEL_EXPORTER_OTLP_METRICS_ENDPOINT](https://opentelemetry.io/docs/concepts/sdk-configuration/otlp-exporter-configuration/#otel_exporter_otlp_metrics_endpoint) +the [OTEL_EXPORTER_OTLP_METRICS_ENDPOINT](https://opentelemetry.io/docs/concepts/sdk-configuration/otlp-exporter-configuration/#otel_exporter_otlp_metrics_endpoint) environment variable to configure the endpoint. The Javadoc -for [OpenTelemetryExporter.Builder](/client_java/api/io/prometheus/metrics/exporter/opentelemetry/OpenTelemetryExporter.Builder.html) +for [OpenTelemetryExporter.Builder](/client_java/api/io/prometheus/metrics/exporter/opentelemetry/OpenTelemetryExporter.Builder.html) shows which settings have corresponding OTel configuration. The intended use case is that if you attach the [OpenTelemetry Java agent](https://github.com/open-telemetry/opentelemetry-java-instrumentation/) diff --git a/docs/content/otel/tracing.md b/docs/content/otel/tracing.md index 33180d34a..f00af9afe 100644 --- a/docs/content/otel/tracing.md +++ b/docs/content/otel/tracing.md @@ -6,7 +6,7 @@ weight: 2 OpenTelemetry’s [vision statement](https://github.com/open-telemetry/community/blob/main/mission-vision-values.md) says that -[telemetry should be loosely coupled](https://github.com/open-telemetry/community/blob/main/mission-vision-values.md#telemetry-should-be-loosely-coupled), +[telemetry should be loosely coupled](https://github.com/open-telemetry/community/blob/main/mission-vision-values.md#telemetry-should-be-loosely-coupled), allowing end users to pick and choose from the pieces they want without having to bring in the rest of the project, too. In that spirit, you might choose to instrument your Java application with the Prometheus Java client library for metrics, and attach the @@ -56,7 +56,7 @@ Exemplars are only selected every [`minRetentionPeriodSeconds`]({{< relref "../config/config.md#exemplar-properties" >}}) seconds. Here's an example of how to configure OpenTelemetry's -[tail sampling processor](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/tailsamplingprocessor/) +[tail sampling processor](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/tailsamplingprocessor/) to sample all Spans marked with `exemplar="true"`, and then discard 90% of the traces: ```yaml @@ -71,7 +71,7 @@ policies: ] ``` -The [examples/example-exemplar-tail-sampling/](https://github.com/prometheus/client_java/tree/main/examples/example-exemplars-tail-sampling) +The [examples/example-exemplar-tail-sampling/](https://github.com/prometheus/client_java/tree/main/examples/example-exemplars-tail-sampling) directory has a complete end-to-end example, with a distributed Java application with two services, an OpenTelemetry collector, Prometheus, Tempo as a trace database, and Grafana dashboards. Use docker-compose as described in the example's readme to run the example and explore the results. diff --git a/examples/example-exemplars-tail-sampling/README.md b/examples/example-exemplars-tail-sampling/README.md index f12c43c95..9fca1ad36 100644 --- a/examples/example-exemplars-tail-sampling/README.md +++ b/examples/example-exemplars-tail-sampling/README.md @@ -9,7 +9,6 @@ Exemplars are often used to reference trace IDs when distributed tracing is used The following shows an example of a histogram in OpenMetrics text format where each non-empty bucket has an Exemplar: - ```text # TYPE request_duration_seconds histogram @@ -31,13 +30,12 @@ request_duration_seconds_count{http_status="200"} 11243 request_duration_seconds_sum{http_status="200"} 2843.3178731140015 ``` - In Grafana Exemplars can be visualized as little green dots. The following shows an example of the 95th [quantile](https://prometheus.io/docs/prometheus/latest/querying/functions/#histogram_quantile) for the histogram above. -![Screenshot of a Latency Graph with Exemplars](https://github.com/prometheus/client_java/assets/330535/68aada3d-f55b-4a7b-90be-222481f0ec79) +![Screenshot of a Latency Graph with Exemplars](https://github.com/prometheus/client_java/assets/330535/68aada3d-f55b-4a7b-90be-222481f0ec79) If you move the mouse over an Exemplar, an overlay pops up with a link to a tracing tool like [Tempo](https://github.com/grafana/tempo). @@ -125,11 +123,11 @@ password _admin_. The example dashboard shows 50 requests / second for the Java services: -![Screenshot showing the request rate on the Java services](https://github.com/prometheus/client_java/assets/330535/9f8dc92e-c9aa-40b6-8fda-a0f7e98560ba) +![Screenshot showing the request rate on the Java services](https://github.com/prometheus/client_java/assets/330535/9f8dc92e-c9aa-40b6-8fda-a0f7e98560ba) The Tempo metrics show that only ~5 traces / second are received: -![Screenshot showing the number of traces per second received by Tempo](https://github.com/prometheus/client_java/assets/330535/5e439ac5-3c5c-4d40-a4cd-6737c2c82dfd) +![Screenshot showing the number of traces per second received by Tempo](https://github.com/prometheus/client_java/assets/330535/5e439ac5-3c5c-4d40-a4cd-6737c2c82dfd) The reason is that the OpenTelemetry collector is configured to sample only 10% of the traces. Yet, all Exemplars in the diff --git a/examples/example-exporter-httpserver/README.md b/examples/example-exporter-httpserver/README.md index 341f8e2c3..ad7164aa7 100644 --- a/examples/example-exporter-httpserver/README.md +++ b/examples/example-exporter-httpserver/README.md @@ -32,7 +32,7 @@ The exporter supports a `debug` URL parameter to quickly view other formats in y - [http://localhost:9400/metrics?debug=text](http://localhost:9400/metrics?debug=text): Prometheus text format, same as without the `debug` option. -- [http://localhost:9400/metrics?debug=openmetrics](http://localhost:9400/metrics?debug=openmetrics): +- [http://localhost:9400/metrics?debug=openmetrics](http://localhost:9400/metrics?debug=openmetrics): OpenMetrics text format. -- [http://localhost:9400/metrics?debug=prometheus-protobuf](http://localhost:9400/metrics?debug=prometheus-protobuf): +- [http://localhost:9400/metrics?debug=prometheus-protobuf](http://localhost:9400/metrics?debug=prometheus-protobuf): Text representation of the Prometheus protobuf format. diff --git a/examples/example-exporter-multi-target/README.md b/examples/example-exporter-multi-target/README.md index 7b20217ac..b655e3244 100644 --- a/examples/example-exporter-multi-target/README.md +++ b/examples/example-exporter-multi-target/README.md @@ -34,8 +34,8 @@ The exporter supports a `debug` URL parameter to quickly view other formats in y - [http://localhost:9400/metrics?debug=text](http://localhost:9400/metrics?debug=text): Prometheus text format, same as without the `debug` option. -- [http://localhost:9400/metrics?debug=openmetrics](http://localhost:9400/metrics?debug=openmetrics): +- [http://localhost:9400/metrics?debug=openmetrics](http://localhost:9400/metrics?debug=openmetrics): OpenMetrics text format. -- [http://localhost:9400/metrics?debug=prometheus-protobuf](http://localhost:9400/metrics?debug=prometheus-protobuf): +- [http://localhost:9400/metrics?debug=prometheus-protobuf](http://localhost:9400/metrics?debug=prometheus-protobuf): Text representation of the Prometheus protobuf format. diff --git a/examples/example-exporter-opentelemetry/README.md b/examples/example-exporter-opentelemetry/README.md index 03dc39e45..1afa794dd 100644 --- a/examples/example-exporter-opentelemetry/README.md +++ b/examples/example-exporter-opentelemetry/README.md @@ -20,14 +20,12 @@ docker-compose up This will set up the following scenario: - ```mermaid flowchart LR A[example app] -->|OTLP|B[OpenTelemetry collector] -->|Prometheus remote write|C[Prometheus server] ``` - The OpenTelemetry collector is configured to log incoming metrics to the console. The Prometheus server is running on [http://localhost:9090](http://localhost:9090). diff --git a/examples/example-exporter-servlet-tomcat/README.md b/examples/example-exporter-servlet-tomcat/README.md index fa7dae805..5ca273896 100644 --- a/examples/example-exporter-servlet-tomcat/README.md +++ b/examples/example-exporter-servlet-tomcat/README.md @@ -54,16 +54,16 @@ browser: - [http://localhost:8080/metrics?debug=text](http://localhost:8080/metrics?debug=text): Prometheus text format, same as without the `debug` option. -- [http://localhost:8080/metrics?debug=openmetrics](http://localhost:8080/metrics?debug=openmetrics): +- [http://localhost:8080/metrics?debug=openmetrics](http://localhost:8080/metrics?debug=openmetrics): OpenMetrics text format. -- [http://localhost:8080/metrics?debug=prometheus-protobuf](http://localhost:8080/metrics?debug=prometheus-protobuf): +- [http://localhost:8080/metrics?debug=prometheus-protobuf](http://localhost:8080/metrics?debug=prometheus-protobuf): Text representation of the Prometheus protobuf format. ## Testing with the Prometheus Server 1. Download the latest Prometheus server release - from [https://github.com/prometheus/prometheus/releases](https://github.com/prometheus/prometheus/releases). + from [https://github.com/prometheus/prometheus/releases](https://github.com/prometheus/prometheus/releases). 2. Extract the archive 3. Edit `prometheus.yml` and append the following snippet at the end: @@ -86,7 +86,7 @@ Prometheus is now scraping metrics in Protobuf format. If you type the name `request_duration_seconds` you will see a non-human-readable representation of the histogram including the native buckets: -![Screenshot showing a Prometheus Native Histogram in Text Format](https://github.com/prometheus/client_java/assets/330535/863efe0b-a9eb-40ae-a078-72497abc6f04) +![Screenshot showing a Prometheus Native Histogram in Text Format](https://github.com/prometheus/client_java/assets/330535/863efe0b-a9eb-40ae-a078-72497abc6f04) Note: You have to run at least one GET request on the Hello World endpoint [http://localhost:8080](http://localhost:8080) before you see the metric. diff --git a/mise.toml b/mise.toml index 772af51c6..338d0149f 100644 --- a/mise.toml +++ b/mise.toml @@ -1,25 +1,25 @@ [tools] +"cargo:https://github.com/grafana/flint" = "rev:a23d568d6b6b542be07e39efd1641022bd2df9a8" +"go:github.com/gohugoio/hugo" = "v0.160.1" +"go:github.com/grafana/oats" = "0.6.1" +java = "temurin-25.0.3+9.0.LTS" +node = "24.15.0" +protoc = "34.1" # Linters actionlint = "1.7.12" +"aqua:owenlamont/ryl" = "0.6.0" biome = "2.4.12" -"cargo:https://github.com/grafana/flint" = "rev:7034ab0ad72a34f9dd39388cf8c659f97517c744" editorconfig-checker = "v3.6.1" "github:google/google-java-format" = "1.35.0" -"go:github.com/gohugoio/hugo" = "v0.160.1" -"go:github.com/grafana/oats" = "0.6.1" -java = "temurin-25.0.3+9.0.LTS" +"github:jonwiggins/xmloxide" = "v0.4.2" lychee = "0.23.0" -node = "24.15.0" "npm:renovate" = "43.129.1" "pipx:codespell" = "2.4.2" -protoc = "34.1" +ruff = "0.15.11" rumdl = "0.1.80" shellcheck = "v0.11.0" shfmt = "3.13.1" -"aqua:owenlamont/ryl" = "0.6.0" -ruff = "0.15.11" -"github:jonwiggins/xmloxide" = "v0.4.2" [env] CARGO_NET_GIT_FETCH_WITH_CLI = "true" From 34ff197a118f2d9208b9e0e060f48d72ba0d4068 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Sun, 26 Apr 2026 09:12:22 +0000 Subject: [PATCH 14/15] chore: rerun flint setup with current preflight Signed-off-by: Gregor Zeitlinger --- .github/config/.taplo.toml | 3 +++ .github/config/flint.toml | 1 + mise.toml | 6 +++--- 3 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 .github/config/.taplo.toml diff --git a/.github/config/.taplo.toml b/.github/config/.taplo.toml new file mode 100644 index 000000000..91983407c --- /dev/null +++ b/.github/config/.taplo.toml @@ -0,0 +1,3 @@ +[formatting] +column_width = 120 +indent_string = " " diff --git a/.github/config/flint.toml b/.github/config/flint.toml index 418612791..c60da9b78 100644 --- a/.github/config/flint.toml +++ b/.github/config/flint.toml @@ -7,6 +7,7 @@ exclude = [ "mvnw", "simpleclient-archive/**", ] +setup_migration_version = 2 [checks.renovate-deps] exclude_managers = ["github-actions", "github-runners", "maven"] diff --git a/mise.toml b/mise.toml index 338d0149f..776750424 100644 --- a/mise.toml +++ b/mise.toml @@ -1,5 +1,4 @@ [tools] -"cargo:https://github.com/grafana/flint" = "rev:a23d568d6b6b542be07e39efd1641022bd2df9a8" "go:github.com/gohugoio/hugo" = "v0.160.1" "go:github.com/grafana/oats" = "0.6.1" java = "temurin-25.0.3+9.0.LTS" @@ -10,19 +9,20 @@ protoc = "34.1" actionlint = "1.7.12" "aqua:owenlamont/ryl" = "0.6.0" biome = "2.4.12" +"cargo:https://github.com/grafana/flint" = "rev:9e738fec63ccf9c77f1255d46ba76e60481f6a14" editorconfig-checker = "v3.6.1" "github:google/google-java-format" = "1.35.0" "github:jonwiggins/xmloxide" = "v0.4.2" +"github:koalaman/shellcheck" = "v0.11.0" lychee = "0.23.0" "npm:renovate" = "43.129.1" "pipx:codespell" = "2.4.2" ruff = "0.15.11" rumdl = "0.1.80" -shellcheck = "v0.11.0" shfmt = "3.13.1" +taplo = "0.10.0" [env] -CARGO_NET_GIT_FETCH_WITH_CLI = "true" FLINT_CONFIG_DIR = ".github/config" # renovate: datasource=github-releases depName=grafana/docker-otel-lgtm LGTM_VERSION = "0.25.0" From 371085d499dc449d400f0c6c0104e4b9deb1f3f2 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Sun, 26 Apr 2026 09:22:29 +0000 Subject: [PATCH 15/15] chore: fix lint drift after flint rerun Signed-off-by: Gregor Zeitlinger --- .github/config/flint.toml | 8 +------ .github/renovate-tracked-deps.json | 5 +++-- .mise/envs/native/mise.toml | 1 - docs/content/config/config.md | 14 ------------ docs/content/exporters/servlet.md | 2 -- docs/content/getting-started/metric-types.md | 2 -- docs/content/getting-started/multi-target.md | 2 -- docs/content/instrumentation/jvm.md | 12 ---------- docs/hugo.toml | 22 +++++++++---------- .../example-exemplars-tail-sampling/README.md | 2 -- .../example-exporter-opentelemetry/README.md | 2 -- mise.toml | 7 ++---- 12 files changed, 17 insertions(+), 62 deletions(-) diff --git a/.github/config/flint.toml b/.github/config/flint.toml index c60da9b78..e11556a6a 100644 --- a/.github/config/flint.toml +++ b/.github/config/flint.toml @@ -1,12 +1,6 @@ [settings] # These paths are generated, vendored, or handled by other checks. -exclude = [ - "CHANGELOG.md", - "**/src/main/generated/**", - "docs/themes/**", - "mvnw", - "simpleclient-archive/**", -] +exclude = ["CHANGELOG.md", "**/src/main/generated/**", "docs/themes/**", "mvnw", "simpleclient-archive/**"] setup_migration_version = 2 [checks.renovate-deps] diff --git a/.github/renovate-tracked-deps.json b/.github/renovate-tracked-deps.json index a1ae79b74..1c1cb2f77 100644 --- a/.github/renovate-tracked-deps.json +++ b/.github/renovate-tracked-deps.json @@ -73,6 +73,7 @@ "editorconfig-checker", "github:google/google-java-format", "github:jonwiggins/xmloxide", + "github:koalaman/shellcheck", "go:github.com/gohugoio/hugo", "go:github.com/grafana/oats", "java", @@ -83,8 +84,8 @@ "protoc", "ruff", "rumdl", - "shellcheck", - "shfmt" + "shfmt", + "taplo" ] }, "mvnw": { diff --git a/.mise/envs/native/mise.toml b/.mise/envs/native/mise.toml index de9c06a68..594ec3d80 100644 --- a/.mise/envs/native/mise.toml +++ b/.mise/envs/native/mise.toml @@ -5,4 +5,3 @@ java = "oracle-graalvm-25.0.1" depends = "build" run = "../../mvnw test -PnativeTest" dir = "../../../integration-tests/it-spring-boot-smoke-test" - diff --git a/docs/content/config/config.md b/docs/content/config/config.md index 2db71c72e..fc2017df5 100644 --- a/docs/content/config/config.md +++ b/docs/content/config/config.md @@ -72,7 +72,6 @@ When the same property is defined in multiple sources, the following precedence ## Metrics Properties - | Name | Javadoc | Note | | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | | io.prometheus.metrics.exemplars_enabled | [Counter.Builder.withExemplars()]() | (1) (2) | @@ -89,7 +88,6 @@ When the same property is defined in multiple sources, the following precedence | io.prometheus.metrics.summary_max_age_seconds | [Summary.Builder.maxAgeSeconds()]() | | | io.prometheus.metrics.summary_number_of_age_buckets | [Summary.Builder.numberOfAgeBuckets()]() | | - ### Notes @@ -124,28 +122,23 @@ This works for all Metrics properties. ## Exemplar Properties - | Name | Javadoc | Note | | ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- | | io.prometheus.exemplars.min_retention_period_seconds | [ExemplarsProperties.getMinRetentionPeriodSeconds()]() | | | io.prometheus.exemplars.max_retention_period_seconds | [ExemplarsProperties.getMaxRetentionPeriodSeconds()]() | | | io.prometheus.exemplars.sample_interval_milliseconds | [ExemplarsProperties.getSampleIntervalMilliseconds()]() | | - ## Exporter Properties - | Name | Javadoc | Note | | ---------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- | | io.prometheus.exporter.include_created_timestamps | [ExporterProperties.getIncludeCreatedTimestamps()]() | (1) | | io.prometheus.exporter.exemplars_on_all_metric_types | [ExporterProperties.getExemplarsOnAllMetricTypes()]() | (1) | - (1) Boolean value, `true` or `false`. Default see Javadoc. ## Exporter Filter Properties - | Name | Javadoc | Note | | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- | | io.prometheus.exporter.filter.metric_name_must_be_equal_to | [ExporterFilterProperties.getAllowedMetricNames()]() | (1) | @@ -153,7 +146,6 @@ This works for all Metrics properties. | io.prometheus.exporter.filter.metric_name_must_start_with | [ExporterFilterProperties.getAllowedMetricNamePrefixes()]() | (3) | | io.prometheus.exporter.filter.metric_name_must_not_start_with | [ExporterFilterProperties.getExcludedMetricNamePrefixes()]() | (4) | - (1) Comma separated list of allowed metric names. Only these metrics will be exposed.
@@ -166,15 +158,12 @@ Only metrics starting with these prefixes will be exposed.
## Exporter HTTPServer Properties - | Name | Javadoc | Note | | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ---- | | io.prometheus.exporter.http_server.port | [HTTPServer.Builder.port()]() | | - ## Exporter OpenTelemetry Properties - | Name | Javadoc | Note | | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- | | io.prometheus.exporter.opentelemetry.protocol | [OpenTelemetryExporter.Builder.protocol()]() | (1) | @@ -188,7 +177,6 @@ Only metrics starting with these prefixes will be exposed.
| io.prometheus.exporter.opentelemetry.service_version | [OpenTelemetryExporter.Builder.serviceVersion()]() | | | io.prometheus.exporter.opentelemetry.resource_attributes | [OpenTelemetryExporter.Builder.resourceAttributes()]() | (3) | - (1) Protocol can be `grpc` or `http/protobuf`.
@@ -204,7 +192,6 @@ See Javadoc for details. ## Exporter PushGateway Properties - | Name | Javadoc | Note | | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---- | | io.prometheus.exporter.pushgateway.address | [PushGateway.Builder.address()]() | | @@ -212,7 +199,6 @@ See Javadoc for details. | io.prometheus.exporter.pushgateway.job | [PushGateway.Builder.job()]() | | | io.prometheus.exporter.pushgateway.escaping_scheme | [PushGateway.Builder.escapingScheme()]() | (1) | - (1) Escaping scheme can be `allow-utf-8`, `underscores`, `dots`, or `values` as described in [escaping schemes](https://github.com/prometheus/docs/blob/main/docs/instrumenting/escaping_schemes.md#escaping-schemes) and in the [Unicode documentation]({{< relref "../exporters/unicode.md" >}}). diff --git a/docs/content/exporters/servlet.md b/docs/content/exporters/servlet.md index c93a1d4b3..8ddf3c13e 100644 --- a/docs/content/exporters/servlet.md +++ b/docs/content/exporters/servlet.md @@ -11,7 +11,6 @@ is a [Jakarta Servlet](https://jakarta.ee/specifications/servlet/) for exposing The old-school way of configuring a servlet is in a `web.xml` file: - ```xml ``` - ## Programmatic Today, most Servlet applications use an embedded Servlet container and configure Servlets diff --git a/docs/content/getting-started/metric-types.md b/docs/content/getting-started/metric-types.md index f5366859b..c491ee978 100644 --- a/docs/content/getting-started/metric-types.md +++ b/docs/content/getting-started/metric-types.md @@ -318,14 +318,12 @@ info.setLabelValues(version, vendor, runtime); The info above looks as follows in OpenMetrics text format: - ```text # TYPE jvm_runtime info # HELP jvm_runtime JVM runtime info jvm_runtime_info{runtime="OpenJDK Runtime Environment",vendor="Oracle Corporation",version="1.8.0_382-b05"} 1 ``` - The example is taken from the `prometheus-metrics-instrumentation-jvm` module, so if you have `JvmMetrics` registered you should have a `jvm_runtime_info` metric out-of-the-box. diff --git a/docs/content/getting-started/multi-target.md b/docs/content/getting-started/multi-target.md index 9227f732d..cfa0b841f 100644 --- a/docs/content/getting-started/multi-target.md +++ b/docs/content/getting-started/multi-target.md @@ -11,7 +11,6 @@ To support multi-target pattern you can create a custom collector overriding the method in ExtendedMultiCollector see SampleExtendedMultiCollector in io.prometheus.metrics.examples.httpserver - ```java public class SampleExtendedMultiCollector extends ExtendedMultiCollector { @@ -79,7 +78,6 @@ public class SampleExtendedMultiCollector extends ExtendedMultiCollector { ``` - `PrometheusScrapeRequest` provides methods to access http-related infos from the request originally received by the endpoint diff --git a/docs/content/instrumentation/jvm.md b/docs/content/instrumentation/jvm.md index 73be4d007..3a658c05b 100644 --- a/docs/content/instrumentation/jvm.md +++ b/docs/content/instrumentation/jvm.md @@ -82,7 +82,6 @@ class. The data is coming from the [ClassLoadingMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/ClassLoadingMXBean.html). Example metrics: - ```text # HELP jvm_classes_currently_loaded The number of classes that are currently loaded in the JVM # TYPE jvm_classes_currently_loaded gauge @@ -95,7 +94,6 @@ jvm_classes_loaded_total 1109.0 jvm_classes_unloaded_total 0.0 ``` - ## JVM Compilation Metrics JVM compilation metrics are provided by @@ -104,14 +102,12 @@ class. The data is coming from the [CompilationMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/CompilationMXBean.html). Example metrics: - ```text # HELP jvm_compilation_time_seconds_total The total time in seconds taken for HotSpot class compilation # TYPE jvm_compilation_time_seconds_total counter jvm_compilation_time_seconds_total 0.152 ``` - ## JVM Garbage Collector Metrics JVM garbage collector metrics are provided by @@ -138,7 +134,6 @@ the [MemoryMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.manag and the [MemoryPoolMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/MemoryPoolMXBean.html). Example metrics: - ```text # HELP jvm_memory_committed_bytes Committed (bytes) of a given JVM memory area. # TYPE jvm_memory_committed_bytes gauge @@ -213,7 +208,6 @@ jvm_memory_used_bytes{area="heap"} 9051232.0 jvm_memory_used_bytes{area="nonheap"} 1.1490688E7 ``` - ## JVM Memory Pool Allocation Metrics JVM memory pool allocation metrics are provided by @@ -223,7 +217,6 @@ a [NotificationListener](https://docs.oracle.com/en/java/javase/21/docs/api/java to the [GarbageCollectorMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/GarbageCollectorMXBean.html). Example metrics: - ```text # HELP jvm_memory_pool_allocated_bytes_total Total bytes allocated in a given JVM memory pool. Only updated after GC, not continuously. # TYPE jvm_memory_pool_allocated_bytes_total counter @@ -235,7 +228,6 @@ jvm_memory_pool_allocated_bytes_total{pool="PS Old Gen"} 1428888.0 jvm_memory_pool_allocated_bytes_total{pool="PS Survivor Space"} 4115280.0 ``` - ## JVM Runtime Info Metric The JVM runtime info metric is provided by @@ -243,14 +235,12 @@ the [JvmRuntimeInfoMetric](/client_java/api/io/prometheus/metrics/instrumentatio class. The data is obtained via system properties and will not change throughout the lifetime of the application. Example metric: - ```text # TYPE jvm_runtime info # HELP jvm_runtime JVM runtime info jvm_runtime_info{runtime="OpenJDK Runtime Environment",vendor="Oracle Corporation",version="1.8.0_382-b05"} 1 ``` - ## JVM Thread Metrics JVM thread metrics are provided by @@ -259,7 +249,6 @@ class. The data is coming from the [ThreadMXBean](https://docs.oracle.com/en/java/javase/21/docs/api/java.management/java/lang/management/ThreadMXBean.html). Example metrics: - ```text # HELP jvm_threads_current Current thread count of a JVM # TYPE jvm_threads_current gauge @@ -290,7 +279,6 @@ jvm_threads_state{state="UNKNOWN"} 0.0 jvm_threads_state{state="WAITING"} 3.0 ``` - ## Process Metrics Process metrics are provided by diff --git a/docs/hugo.toml b/docs/hugo.toml index b558774ec..9223f49ef 100644 --- a/docs/hugo.toml +++ b/docs/hugo.toml @@ -17,18 +17,18 @@ enableRobotsTXT = true # Needed for mermaid shortcodes [markup] - [markup.goldmark.renderer] - # Needed for mermaid shortcode - unsafe = true - [markup.tableOfContents] - startLevel = 1 - endLevel = 9 - [markup.highlight] - style = 'solarized-dark' +[markup.goldmark.renderer] +# Needed for mermaid shortcode +unsafe = true +[markup.tableOfContents] +startLevel = 1 +endLevel = 9 +[markup.highlight] +style = 'solarized-dark' [taxonomies] - tag = "tags" +tag = "tags" [caches] - [caches.images] - dir = ':cacheDir/images' +[caches.images] +dir = ':cacheDir/images' diff --git a/examples/example-exemplars-tail-sampling/README.md b/examples/example-exemplars-tail-sampling/README.md index 9fca1ad36..4b005f745 100644 --- a/examples/example-exemplars-tail-sampling/README.md +++ b/examples/example-exemplars-tail-sampling/README.md @@ -9,7 +9,6 @@ Exemplars are often used to reference trace IDs when distributed tracing is used The following shows an example of a histogram in OpenMetrics text format where each non-empty bucket has an Exemplar: - ```text # TYPE request_duration_seconds histogram # UNIT request_duration_seconds seconds @@ -30,7 +29,6 @@ request_duration_seconds_count{http_status="200"} 11243 request_duration_seconds_sum{http_status="200"} 2843.3178731140015 ``` - In Grafana Exemplars can be visualized as little green dots. The following shows an example of the 95th [quantile](https://prometheus.io/docs/prometheus/latest/querying/functions/#histogram_quantile) for the histogram above. diff --git a/examples/example-exporter-opentelemetry/README.md b/examples/example-exporter-opentelemetry/README.md index 1afa794dd..5e0551ae5 100644 --- a/examples/example-exporter-opentelemetry/README.md +++ b/examples/example-exporter-opentelemetry/README.md @@ -20,12 +20,10 @@ docker-compose up This will set up the following scenario: - ```mermaid flowchart LR A[example app] -->|OTLP|B[OpenTelemetry collector] -->|Prometheus remote write|C[Prometheus server] ``` - The OpenTelemetry collector is configured to log incoming metrics to the console. The Prometheus server is running on [http://localhost:9090](http://localhost:9090). diff --git a/mise.toml b/mise.toml index 776750424..9e22542cc 100644 --- a/mise.toml +++ b/mise.toml @@ -77,7 +77,7 @@ description = "Generate Javadoc" run = [ "./mvnw -B clean compile javadoc:javadoc javadoc:aggregate -P 'javadoc,!default'", "rm -rf ./docs/static/api", - "mv ./target/reports/apidocs ./docs/static/api && echo && echo 'ls ./docs/static/api' && ls ./docs/static/api" + "mv ./target/reports/apidocs ./docs/static/api && echo && echo 'ls ./docs/static/api' && ls ./docs/static/api", ] [tasks.gh-pages-dev] @@ -91,10 +91,7 @@ depends = ["javadoc", "set-release-version-github-pages"] # For maximum backward compatibility with Hugo modules env = { HUGO_ENVIRONMENT = "production", HUGO_ENV = "production" } dir = "docs" -run = [ - "hugo --gc --minify --baseURL ${BASE_URL}/", - "echo 'ls ./public/api' && ls ./public/api" -] +run = ["hugo --gc --minify --baseURL ${BASE_URL}/", "echo 'ls ./public/api' && ls ./public/api"] [tasks."benchmark:quick"] description = "Run benchmarks with reduced iterations (quick smoke test, ~10 min)"