diff --git a/docs/content/exporters/filter.md b/docs/content/exporters/filter.md index eb893733a..7d3e71d0e 100644 --- a/docs/content/exporters/filter.md +++ b/docs/content/exporters/filter.md @@ -23,7 +23,8 @@ params: For safety, exporters limit the query string to 65,536 characters and accept at most 1,024 query parameters. The parameter limit counts every `&`-separated pair, including repeated -parameters and empty pairs. +parameters and empty pairs. These are fixed implementation limits and cannot be changed through +runtime configuration. If a request exceeds either limit or contains invalid percent-encoding, the `/metrics` endpoint returns HTTP `400 Bad Request` with the plain-text response `Invalid query parameters`. diff --git a/prometheus-metrics-exporter-common/src/main/java/io/prometheus/metrics/exporter/common/PrometheusHttpRequest.java b/prometheus-metrics-exporter-common/src/main/java/io/prometheus/metrics/exporter/common/PrometheusHttpRequest.java index 31ce2cc73..a0a8311f6 100644 --- a/prometheus-metrics-exporter-common/src/main/java/io/prometheus/metrics/exporter/common/PrometheusHttpRequest.java +++ b/prometheus-metrics-exporter-common/src/main/java/io/prometheus/metrics/exporter/common/PrometheusHttpRequest.java @@ -41,7 +41,15 @@ default String getParameter(String name) { } } - /** See {@code jakarta.servlet.ServletRequest.getParameterValues(String)} */ + /** + * See {@code jakarta.servlet.ServletRequest.getParameterValues(String)}. + * + *

For safety, the default implementation applies two fixed limits: {@code maxQueryStringLength + * = 64 * 1024} (65,536 characters) and {@code maxQueryParameterCount = 1024} ({@code &}-separated + * parameter pairs). These implementation values are not exposed as runtime configuration. + * Requests that exceed either limit or contain invalid percent-encoding are rejected by the + * scrape handler with HTTP {@code 400 Bad Request}. + */ @Override @Nullable // decode with Charset is only available in Java 10+, but we want to support Java 8