diff --git a/Documentation/api.md b/Documentation/api.md
index 8dcdb0e73..425e6fb97 100644
--- a/Documentation/api.md
+++ b/Documentation/api.md
@@ -2360,6 +2360,86 @@ breaking way.
Condition
@@ -9991,6 +10151,86 @@ breaking way.
+bodySizeLimit
+
+
+ByteSize
+
+
+ |
+
+(Optional)
+ BodySizeLimit defines per-scrape on response body size.
+Only valid in Prometheus versions 2.45.0 and newer.
+ |
+
+
+
+sampleLimit
+
+uint64
+
+ |
+
+(Optional)
+ SampleLimit defines per-scrape limit on number of scraped samples that will be accepted.
+Only valid in Prometheus versions 2.45.0 and newer.
+ |
+
+
+
+targetLimit
+
+uint64
+
+ |
+
+(Optional)
+ TargetLimit defines a limit on the number of scraped targets that will be accepted.
+Only valid in Prometheus versions 2.45.0 and newer.
+ |
+
+
+
+labelLimit
+
+uint64
+
+ |
+
+(Optional)
+ Per-scrape limit on number of labels that will be accepted for a sample.
+Only valid in Prometheus versions 2.45.0 and newer.
+ |
+
+
+
+labelNameLengthLimit
+
+uint64
+
+ |
+
+(Optional)
+ Per-scrape limit on length of labels name that will be accepted for a sample.
+Only valid in Prometheus versions 2.45.0 and newer.
+ |
+
+
+
+labelValueLengthLimit
+
+uint64
+
+ |
+
+(Optional)
+ Per-scrape limit on length of labels value that will be accepted for a sample.
+Only valid in Prometheus versions 2.45.0 and newer.
+ |
+
+
+
baseImage
string
@@ -15156,6 +15396,86 @@ experimental feature, it may change in any upcoming release in a
breaking way.
|
+
+
+bodySizeLimit
+
+
+ByteSize
+
+
+ |
+
+(Optional)
+ BodySizeLimit defines per-scrape on response body size.
+Only valid in Prometheus versions 2.45.0 and newer.
+ |
+
+
+
+sampleLimit
+
+uint64
+
+ |
+
+(Optional)
+ SampleLimit defines per-scrape limit on number of scraped samples that will be accepted.
+Only valid in Prometheus versions 2.45.0 and newer.
+ |
+
+
+
+targetLimit
+
+uint64
+
+ |
+
+(Optional)
+ TargetLimit defines a limit on the number of scraped targets that will be accepted.
+Only valid in Prometheus versions 2.45.0 and newer.
+ |
+
+
+
+labelLimit
+
+uint64
+
+ |
+
+(Optional)
+ Per-scrape limit on number of labels that will be accepted for a sample.
+Only valid in Prometheus versions 2.45.0 and newer.
+ |
+
+
+
+labelNameLengthLimit
+
+uint64
+
+ |
+
+(Optional)
+ Per-scrape limit on length of labels name that will be accepted for a sample.
+Only valid in Prometheus versions 2.45.0 and newer.
+ |
+
+
+
+labelValueLengthLimit
+
+uint64
+
+ |
+
+(Optional)
+ Per-scrape limit on length of labels value that will be accepted for a sample.
+Only valid in Prometheus versions 2.45.0 and newer.
+ |
+
@@ -18458,6 +18778,86 @@ experimental feature, it may change in any upcoming release in a
breaking way.
+
+
+bodySizeLimit
+
+
+ByteSize
+
+
+ |
+
+(Optional)
+ BodySizeLimit defines per-scrape on response body size.
+Only valid in Prometheus versions 2.45.0 and newer.
+ |
+
+
+
+sampleLimit
+
+uint64
+
+ |
+
+(Optional)
+ SampleLimit defines per-scrape limit on number of scraped samples that will be accepted.
+Only valid in Prometheus versions 2.45.0 and newer.
+ |
+
+
+
+targetLimit
+
+uint64
+
+ |
+
+(Optional)
+ TargetLimit defines a limit on the number of scraped targets that will be accepted.
+Only valid in Prometheus versions 2.45.0 and newer.
+ |
+
+
+
+labelLimit
+
+uint64
+
+ |
+
+(Optional)
+ Per-scrape limit on number of labels that will be accepted for a sample.
+Only valid in Prometheus versions 2.45.0 and newer.
+ |
+
+
+
+labelNameLengthLimit
+
+uint64
+
+ |
+
+(Optional)
+ Per-scrape limit on length of labels name that will be accepted for a sample.
+Only valid in Prometheus versions 2.45.0 and newer.
+ |
+
+
+
+labelValueLengthLimit
+
+uint64
+
+ |
+
+(Optional)
+ Per-scrape limit on length of labels value that will be accepted for a sample.
+Only valid in Prometheus versions 2.45.0 and newer.
+ |
+
PushoverConfig
diff --git a/Documentation/compatibility.md b/Documentation/compatibility.md
index c31f70359..657bf36a8 100644
--- a/Documentation/compatibility.md
+++ b/Documentation/compatibility.md
@@ -56,12 +56,13 @@ Prometheus Operator supports all Prometheus versions >= v2.0.0. The operator's e
* v2.43.0
* v2.43.1
* v2.44.0
+* v2.45.0
```
The end-to-end tests are mostly tested against
```$ mdox-exec="go run ./cmd/po-docgen/. compatibility defaultPrometheusVersion"
-* v2.44.0
+* v2.45.0
```
## Alertmanager
diff --git a/bundle.yaml b/bundle.yaml
index da091cb02..2e04f6bba 100644
--- a/bundle.yaml
+++ b/bundle.yaml
@@ -14828,6 +14828,11 @@ spec:
deny:
type: boolean
type: object
+ bodySizeLimit:
+ description: BodySizeLimit defines per-scrape on response body size.
+ Only valid in Prometheus versions 2.45.0 and newer.
+ pattern: (^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$
+ type: string
configMaps:
description: ConfigMaps is a list of ConfigMaps in the same namespace
as the Prometheus object, which shall be mounted into the Prometheus
@@ -17598,6 +17603,23 @@ spec:
- name
type: object
type: array
+ labelLimit:
+ description: Per-scrape limit on number of labels that will be accepted
+ for a sample. Only valid in Prometheus versions 2.45.0 and newer.
+ format: int64
+ type: integer
+ labelNameLengthLimit:
+ description: Per-scrape limit on length of labels name that will be
+ accepted for a sample. Only valid in Prometheus versions 2.45.0
+ and newer.
+ format: int64
+ type: integer
+ labelValueLengthLimit:
+ description: Per-scrape limit on length of labels value that will
+ be accepted for a sample. Only valid in Prometheus versions 2.45.0
+ and newer.
+ format: int64
+ type: integer
listenLocal:
description: When true, the Prometheus server listens on the loopback
address instead of the Pod IP's address.
@@ -18509,6 +18531,12 @@ spec:
is still true, but the server serves requests under a different
route prefix. For example for use with `kubectl proxy`."
type: string
+ sampleLimit:
+ description: SampleLimit defines per-scrape limit on number of scraped
+ samples that will be accepted. Only valid in Prometheus versions
+ 2.45.0 and newer.
+ format: int64
+ type: integer
scrapeConfigNamespaceSelector:
description: Namespaces to match for ScrapeConfig discovery. An empty
label selector matches all namespaces. A null label selector matches
@@ -19567,6 +19595,12 @@ spec:
type: object
type: object
type: object
+ targetLimit:
+ description: TargetLimit defines a limit on the number of scraped
+ targets that will be accepted. Only valid in Prometheus versions
+ 2.45.0 and newer.
+ format: int64
+ type: integer
tolerations:
description: Defines the Pods' tolerations if specified.
items:
@@ -23443,6 +23477,11 @@ spec:
baseImage:
description: '*Deprecated: use ''spec.image'' instead.*'
type: string
+ bodySizeLimit:
+ description: BodySizeLimit defines per-scrape on response body size.
+ Only valid in Prometheus versions 2.45.0 and newer.
+ pattern: (^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$
+ type: string
configMaps:
description: ConfigMaps is a list of ConfigMaps in the same namespace
as the Prometheus object, which shall be mounted into the Prometheus
@@ -26243,6 +26282,23 @@ spec:
- name
type: object
type: array
+ labelLimit:
+ description: Per-scrape limit on number of labels that will be accepted
+ for a sample. Only valid in Prometheus versions 2.45.0 and newer.
+ format: int64
+ type: integer
+ labelNameLengthLimit:
+ description: Per-scrape limit on length of labels name that will be
+ accepted for a sample. Only valid in Prometheus versions 2.45.0
+ and newer.
+ format: int64
+ type: integer
+ labelValueLengthLimit:
+ description: Per-scrape limit on length of labels value that will
+ be accepted for a sample. Only valid in Prometheus versions 2.45.0
+ and newer.
+ format: int64
+ type: integer
listenLocal:
description: When true, the Prometheus server listens on the loopback
address instead of the Pod IP's address.
@@ -27699,6 +27755,12 @@ spec:
type: string
type: object
type: object
+ sampleLimit:
+ description: SampleLimit defines per-scrape limit on number of scraped
+ samples that will be accepted. Only valid in Prometheus versions
+ 2.45.0 and newer.
+ format: int64
+ type: integer
scrapeConfigNamespaceSelector:
description: Namespaces to match for ScrapeConfig discovery. An empty
label selector matches all namespaces. A null label selector matches
@@ -28765,6 +28827,12 @@ spec:
description: '*Deprecated: use ''spec.image'' instead. The image''s
tag can be specified as part of the image name.*'
type: string
+ targetLimit:
+ description: TargetLimit defines a limit on the number of scraped
+ targets that will be accepted. Only valid in Prometheus versions
+ 2.45.0 and newer.
+ format: int64
+ type: integer
thanos:
description: "Defines the configuration of the optional Thanos sidecar.
\n This section is experimental, it may change significantly without
diff --git a/example/prometheus-operator-crd-full/monitoring.coreos.com_prometheusagents.yaml b/example/prometheus-operator-crd-full/monitoring.coreos.com_prometheusagents.yaml
index 4fe189d8d..f0b64dcfd 100644
--- a/example/prometheus-operator-crd-full/monitoring.coreos.com_prometheusagents.yaml
+++ b/example/prometheus-operator-crd-full/monitoring.coreos.com_prometheusagents.yaml
@@ -1196,6 +1196,11 @@ spec:
deny:
type: boolean
type: object
+ bodySizeLimit:
+ description: BodySizeLimit defines per-scrape on response body size.
+ Only valid in Prometheus versions 2.45.0 and newer.
+ pattern: (^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$
+ type: string
configMaps:
description: ConfigMaps is a list of ConfigMaps in the same namespace
as the Prometheus object, which shall be mounted into the Prometheus
@@ -3966,6 +3971,23 @@ spec:
- name
type: object
type: array
+ labelLimit:
+ description: Per-scrape limit on number of labels that will be accepted
+ for a sample. Only valid in Prometheus versions 2.45.0 and newer.
+ format: int64
+ type: integer
+ labelNameLengthLimit:
+ description: Per-scrape limit on length of labels name that will be
+ accepted for a sample. Only valid in Prometheus versions 2.45.0
+ and newer.
+ format: int64
+ type: integer
+ labelValueLengthLimit:
+ description: Per-scrape limit on length of labels value that will
+ be accepted for a sample. Only valid in Prometheus versions 2.45.0
+ and newer.
+ format: int64
+ type: integer
listenLocal:
description: When true, the Prometheus server listens on the loopback
address instead of the Pod IP's address.
@@ -4877,6 +4899,12 @@ spec:
is still true, but the server serves requests under a different
route prefix. For example for use with `kubectl proxy`."
type: string
+ sampleLimit:
+ description: SampleLimit defines per-scrape limit on number of scraped
+ samples that will be accepted. Only valid in Prometheus versions
+ 2.45.0 and newer.
+ format: int64
+ type: integer
scrapeConfigNamespaceSelector:
description: Namespaces to match for ScrapeConfig discovery. An empty
label selector matches all namespaces. A null label selector matches
@@ -5935,6 +5963,12 @@ spec:
type: object
type: object
type: object
+ targetLimit:
+ description: TargetLimit defines a limit on the number of scraped
+ targets that will be accepted. Only valid in Prometheus versions
+ 2.45.0 and newer.
+ format: int64
+ type: integer
tolerations:
description: Defines the Pods' tolerations if specified.
items:
diff --git a/example/prometheus-operator-crd-full/monitoring.coreos.com_prometheuses.yaml b/example/prometheus-operator-crd-full/monitoring.coreos.com_prometheuses.yaml
index 78ba012d9..a3fa5adc0 100644
--- a/example/prometheus-operator-crd-full/monitoring.coreos.com_prometheuses.yaml
+++ b/example/prometheus-operator-crd-full/monitoring.coreos.com_prometheuses.yaml
@@ -1534,6 +1534,11 @@ spec:
baseImage:
description: '*Deprecated: use ''spec.image'' instead.*'
type: string
+ bodySizeLimit:
+ description: BodySizeLimit defines per-scrape on response body size.
+ Only valid in Prometheus versions 2.45.0 and newer.
+ pattern: (^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$
+ type: string
configMaps:
description: ConfigMaps is a list of ConfigMaps in the same namespace
as the Prometheus object, which shall be mounted into the Prometheus
@@ -4334,6 +4339,23 @@ spec:
- name
type: object
type: array
+ labelLimit:
+ description: Per-scrape limit on number of labels that will be accepted
+ for a sample. Only valid in Prometheus versions 2.45.0 and newer.
+ format: int64
+ type: integer
+ labelNameLengthLimit:
+ description: Per-scrape limit on length of labels name that will be
+ accepted for a sample. Only valid in Prometheus versions 2.45.0
+ and newer.
+ format: int64
+ type: integer
+ labelValueLengthLimit:
+ description: Per-scrape limit on length of labels value that will
+ be accepted for a sample. Only valid in Prometheus versions 2.45.0
+ and newer.
+ format: int64
+ type: integer
listenLocal:
description: When true, the Prometheus server listens on the loopback
address instead of the Pod IP's address.
@@ -5790,6 +5812,12 @@ spec:
type: string
type: object
type: object
+ sampleLimit:
+ description: SampleLimit defines per-scrape limit on number of scraped
+ samples that will be accepted. Only valid in Prometheus versions
+ 2.45.0 and newer.
+ format: int64
+ type: integer
scrapeConfigNamespaceSelector:
description: Namespaces to match for ScrapeConfig discovery. An empty
label selector matches all namespaces. A null label selector matches
@@ -6856,6 +6884,12 @@ spec:
description: '*Deprecated: use ''spec.image'' instead. The image''s
tag can be specified as part of the image name.*'
type: string
+ targetLimit:
+ description: TargetLimit defines a limit on the number of scraped
+ targets that will be accepted. Only valid in Prometheus versions
+ 2.45.0 and newer.
+ format: int64
+ type: integer
thanos:
description: "Defines the configuration of the optional Thanos sidecar.
\n This section is experimental, it may change significantly without
diff --git a/example/prometheus-operator-crd/monitoring.coreos.com_prometheusagents.yaml b/example/prometheus-operator-crd/monitoring.coreos.com_prometheusagents.yaml
index 4fe189d8d..f0b64dcfd 100644
--- a/example/prometheus-operator-crd/monitoring.coreos.com_prometheusagents.yaml
+++ b/example/prometheus-operator-crd/monitoring.coreos.com_prometheusagents.yaml
@@ -1196,6 +1196,11 @@ spec:
deny:
type: boolean
type: object
+ bodySizeLimit:
+ description: BodySizeLimit defines per-scrape on response body size.
+ Only valid in Prometheus versions 2.45.0 and newer.
+ pattern: (^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$
+ type: string
configMaps:
description: ConfigMaps is a list of ConfigMaps in the same namespace
as the Prometheus object, which shall be mounted into the Prometheus
@@ -3966,6 +3971,23 @@ spec:
- name
type: object
type: array
+ labelLimit:
+ description: Per-scrape limit on number of labels that will be accepted
+ for a sample. Only valid in Prometheus versions 2.45.0 and newer.
+ format: int64
+ type: integer
+ labelNameLengthLimit:
+ description: Per-scrape limit on length of labels name that will be
+ accepted for a sample. Only valid in Prometheus versions 2.45.0
+ and newer.
+ format: int64
+ type: integer
+ labelValueLengthLimit:
+ description: Per-scrape limit on length of labels value that will
+ be accepted for a sample. Only valid in Prometheus versions 2.45.0
+ and newer.
+ format: int64
+ type: integer
listenLocal:
description: When true, the Prometheus server listens on the loopback
address instead of the Pod IP's address.
@@ -4877,6 +4899,12 @@ spec:
is still true, but the server serves requests under a different
route prefix. For example for use with `kubectl proxy`."
type: string
+ sampleLimit:
+ description: SampleLimit defines per-scrape limit on number of scraped
+ samples that will be accepted. Only valid in Prometheus versions
+ 2.45.0 and newer.
+ format: int64
+ type: integer
scrapeConfigNamespaceSelector:
description: Namespaces to match for ScrapeConfig discovery. An empty
label selector matches all namespaces. A null label selector matches
@@ -5935,6 +5963,12 @@ spec:
type: object
type: object
type: object
+ targetLimit:
+ description: TargetLimit defines a limit on the number of scraped
+ targets that will be accepted. Only valid in Prometheus versions
+ 2.45.0 and newer.
+ format: int64
+ type: integer
tolerations:
description: Defines the Pods' tolerations if specified.
items:
diff --git a/example/prometheus-operator-crd/monitoring.coreos.com_prometheuses.yaml b/example/prometheus-operator-crd/monitoring.coreos.com_prometheuses.yaml
index 78ba012d9..a3fa5adc0 100644
--- a/example/prometheus-operator-crd/monitoring.coreos.com_prometheuses.yaml
+++ b/example/prometheus-operator-crd/monitoring.coreos.com_prometheuses.yaml
@@ -1534,6 +1534,11 @@ spec:
baseImage:
description: '*Deprecated: use ''spec.image'' instead.*'
type: string
+ bodySizeLimit:
+ description: BodySizeLimit defines per-scrape on response body size.
+ Only valid in Prometheus versions 2.45.0 and newer.
+ pattern: (^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$
+ type: string
configMaps:
description: ConfigMaps is a list of ConfigMaps in the same namespace
as the Prometheus object, which shall be mounted into the Prometheus
@@ -4334,6 +4339,23 @@ spec:
- name
type: object
type: array
+ labelLimit:
+ description: Per-scrape limit on number of labels that will be accepted
+ for a sample. Only valid in Prometheus versions 2.45.0 and newer.
+ format: int64
+ type: integer
+ labelNameLengthLimit:
+ description: Per-scrape limit on length of labels name that will be
+ accepted for a sample. Only valid in Prometheus versions 2.45.0
+ and newer.
+ format: int64
+ type: integer
+ labelValueLengthLimit:
+ description: Per-scrape limit on length of labels value that will
+ be accepted for a sample. Only valid in Prometheus versions 2.45.0
+ and newer.
+ format: int64
+ type: integer
listenLocal:
description: When true, the Prometheus server listens on the loopback
address instead of the Pod IP's address.
@@ -5790,6 +5812,12 @@ spec:
type: string
type: object
type: object
+ sampleLimit:
+ description: SampleLimit defines per-scrape limit on number of scraped
+ samples that will be accepted. Only valid in Prometheus versions
+ 2.45.0 and newer.
+ format: int64
+ type: integer
scrapeConfigNamespaceSelector:
description: Namespaces to match for ScrapeConfig discovery. An empty
label selector matches all namespaces. A null label selector matches
@@ -6856,6 +6884,12 @@ spec:
description: '*Deprecated: use ''spec.image'' instead. The image''s
tag can be specified as part of the image name.*'
type: string
+ targetLimit:
+ description: TargetLimit defines a limit on the number of scraped
+ targets that will be accepted. Only valid in Prometheus versions
+ 2.45.0 and newer.
+ format: int64
+ type: integer
thanos:
description: "Defines the configuration of the optional Thanos sidecar.
\n This section is experimental, it may change significantly without
diff --git a/jsonnet/prometheus-operator/prometheusagents-crd.json b/jsonnet/prometheus-operator/prometheusagents-crd.json
index 58fcb73fb..4d1a849a6 100644
--- a/jsonnet/prometheus-operator/prometheusagents-crd.json
+++ b/jsonnet/prometheus-operator/prometheusagents-crd.json
@@ -1051,6 +1051,11 @@
},
"type": "object"
},
+ "bodySizeLimit": {
+ "description": "BodySizeLimit defines per-scrape on response body size. Only valid in Prometheus versions 2.45.0 and newer.",
+ "pattern": "(^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$",
+ "type": "string"
+ },
"configMaps": {
"description": "ConfigMaps is a list of ConfigMaps in the same namespace as the Prometheus object, which shall be mounted into the Prometheus Pods. Each ConfigMap is added to the StatefulSet definition as a volume named `configmap-`. The ConfigMaps are mounted into /etc/prometheus/configmaps/ in the 'prometheus' container.",
"items": {
@@ -3569,6 +3574,21 @@
},
"type": "array"
},
+ "labelLimit": {
+ "description": "Per-scrape limit on number of labels that will be accepted for a sample. Only valid in Prometheus versions 2.45.0 and newer.",
+ "format": "int64",
+ "type": "integer"
+ },
+ "labelNameLengthLimit": {
+ "description": "Per-scrape limit on length of labels name that will be accepted for a sample. Only valid in Prometheus versions 2.45.0 and newer.",
+ "format": "int64",
+ "type": "integer"
+ },
+ "labelValueLengthLimit": {
+ "description": "Per-scrape limit on length of labels value that will be accepted for a sample. Only valid in Prometheus versions 2.45.0 and newer.",
+ "format": "int64",
+ "type": "integer"
+ },
"listenLocal": {
"description": "When true, the Prometheus server listens on the loopback address instead of the Pod IP's address.",
"type": "boolean"
@@ -4482,6 +4502,11 @@
"description": "The route prefix Prometheus registers HTTP handlers for. \n This is useful when using `spec.externalURL`, and a proxy is rewriting HTTP routes of a request, and the actual ExternalURL is still true, but the server serves requests under a different route prefix. For example for use with `kubectl proxy`.",
"type": "string"
},
+ "sampleLimit": {
+ "description": "SampleLimit defines per-scrape limit on number of scraped samples that will be accepted. Only valid in Prometheus versions 2.45.0 and newer.",
+ "format": "int64",
+ "type": "integer"
+ },
"scrapeConfigNamespaceSelector": {
"description": "Namespaces to match for ScrapeConfig discovery. An empty label selector matches all namespaces. A null label selector matches the current current namespace only.",
"properties": {
@@ -5335,6 +5360,11 @@
},
"type": "object"
},
+ "targetLimit": {
+ "description": "TargetLimit defines a limit on the number of scraped targets that will be accepted. Only valid in Prometheus versions 2.45.0 and newer.",
+ "format": "int64",
+ "type": "integer"
+ },
"tolerations": {
"description": "Defines the Pods' tolerations if specified.",
"items": {
diff --git a/jsonnet/prometheus-operator/prometheuses-crd.json b/jsonnet/prometheus-operator/prometheuses-crd.json
index 323ee85c4..439854854 100644
--- a/jsonnet/prometheus-operator/prometheuses-crd.json
+++ b/jsonnet/prometheus-operator/prometheuses-crd.json
@@ -1402,6 +1402,11 @@
"description": "*Deprecated: use 'spec.image' instead.*",
"type": "string"
},
+ "bodySizeLimit": {
+ "description": "BodySizeLimit defines per-scrape on response body size. Only valid in Prometheus versions 2.45.0 and newer.",
+ "pattern": "(^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$",
+ "type": "string"
+ },
"configMaps": {
"description": "ConfigMaps is a list of ConfigMaps in the same namespace as the Prometheus object, which shall be mounted into the Prometheus Pods. Each ConfigMap is added to the StatefulSet definition as a volume named `configmap-`. The ConfigMaps are mounted into /etc/prometheus/configmaps/ in the 'prometheus' container.",
"items": {
@@ -3945,6 +3950,21 @@
},
"type": "array"
},
+ "labelLimit": {
+ "description": "Per-scrape limit on number of labels that will be accepted for a sample. Only valid in Prometheus versions 2.45.0 and newer.",
+ "format": "int64",
+ "type": "integer"
+ },
+ "labelNameLengthLimit": {
+ "description": "Per-scrape limit on length of labels name that will be accepted for a sample. Only valid in Prometheus versions 2.45.0 and newer.",
+ "format": "int64",
+ "type": "integer"
+ },
+ "labelValueLengthLimit": {
+ "description": "Per-scrape limit on length of labels value that will be accepted for a sample. Only valid in Prometheus versions 2.45.0 and newer.",
+ "format": "int64",
+ "type": "integer"
+ },
"listenLocal": {
"description": "When true, the Prometheus server listens on the loopback address instead of the Pod IP's address.",
"type": "boolean"
@@ -5430,6 +5450,11 @@
},
"type": "object"
},
+ "sampleLimit": {
+ "description": "SampleLimit defines per-scrape limit on number of scraped samples that will be accepted. Only valid in Prometheus versions 2.45.0 and newer.",
+ "format": "int64",
+ "type": "integer"
+ },
"scrapeConfigNamespaceSelector": {
"description": "Namespaces to match for ScrapeConfig discovery. An empty label selector matches all namespaces. A null label selector matches the current current namespace only.",
"properties": {
@@ -6291,6 +6316,11 @@
"description": "*Deprecated: use 'spec.image' instead. The image's tag can be specified as part of the image name.*",
"type": "string"
},
+ "targetLimit": {
+ "description": "TargetLimit defines a limit on the number of scraped targets that will be accepted. Only valid in Prometheus versions 2.45.0 and newer.",
+ "format": "int64",
+ "type": "integer"
+ },
"thanos": {
"description": "Defines the configuration of the optional Thanos sidecar. \n This section is experimental, it may change significantly without deprecation notice in any release.",
"properties": {
diff --git a/pkg/apis/monitoring/v1/prometheus_types.go b/pkg/apis/monitoring/v1/prometheus_types.go
index af458cd27..a01c48954 100644
--- a/pkg/apis/monitoring/v1/prometheus_types.go
+++ b/pkg/apis/monitoring/v1/prometheus_types.go
@@ -550,6 +550,36 @@ type CommonPrometheusFields struct {
//
// +optional
TracingConfig *PrometheusTracingConfig `json:"tracingConfig,omitempty"`
+ // BodySizeLimit defines per-scrape on response body size.
+ // Only valid in Prometheus versions 2.45.0 and newer.
+ //
+ // +optional
+ BodySizeLimit *ByteSize `json:"bodySizeLimit,omitempty"`
+ // SampleLimit defines per-scrape limit on number of scraped samples that will be accepted.
+ // Only valid in Prometheus versions 2.45.0 and newer.
+ //
+ // +optional
+ SampleLimit *uint64 `json:"sampleLimit,omitempty"`
+ // TargetLimit defines a limit on the number of scraped targets that will be accepted.
+ // Only valid in Prometheus versions 2.45.0 and newer.
+ //
+ // +optional
+ TargetLimit *uint64 `json:"targetLimit,omitempty"`
+ // Per-scrape limit on number of labels that will be accepted for a sample.
+ // Only valid in Prometheus versions 2.45.0 and newer.
+ //
+ // +optional
+ LabelLimit *uint64 `json:"labelLimit,omitempty"`
+ // Per-scrape limit on length of labels name that will be accepted for a sample.
+ // Only valid in Prometheus versions 2.45.0 and newer.
+ //
+ // +optional
+ LabelNameLengthLimit *uint64 `json:"labelNameLengthLimit,omitempty"`
+ // Per-scrape limit on length of labels value that will be accepted for a sample.
+ // Only valid in Prometheus versions 2.45.0 and newer.
+ //
+ // +optional
+ LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"`
}
// +genclient
diff --git a/pkg/apis/monitoring/v1/zz_generated.deepcopy.go b/pkg/apis/monitoring/v1/zz_generated.deepcopy.go
index c39ba4bbb..3d3e485da 100644
--- a/pkg/apis/monitoring/v1/zz_generated.deepcopy.go
+++ b/pkg/apis/monitoring/v1/zz_generated.deepcopy.go
@@ -792,6 +792,36 @@ func (in *CommonPrometheusFields) DeepCopyInto(out *CommonPrometheusFields) {
*out = new(PrometheusTracingConfig)
(*in).DeepCopyInto(*out)
}
+ if in.BodySizeLimit != nil {
+ in, out := &in.BodySizeLimit, &out.BodySizeLimit
+ *out = new(ByteSize)
+ **out = **in
+ }
+ if in.SampleLimit != nil {
+ in, out := &in.SampleLimit, &out.SampleLimit
+ *out = new(uint64)
+ **out = **in
+ }
+ if in.TargetLimit != nil {
+ in, out := &in.TargetLimit, &out.TargetLimit
+ *out = new(uint64)
+ **out = **in
+ }
+ if in.LabelLimit != nil {
+ in, out := &in.LabelLimit, &out.LabelLimit
+ *out = new(uint64)
+ **out = **in
+ }
+ if in.LabelNameLengthLimit != nil {
+ in, out := &in.LabelNameLengthLimit, &out.LabelNameLengthLimit
+ *out = new(uint64)
+ **out = **in
+ }
+ if in.LabelValueLengthLimit != nil {
+ in, out := &in.LabelValueLengthLimit, &out.LabelValueLengthLimit
+ *out = new(uint64)
+ **out = **in
+ }
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonPrometheusFields.
diff --git a/pkg/client/applyconfiguration/monitoring/v1/commonprometheusfields.go b/pkg/client/applyconfiguration/monitoring/v1/commonprometheusfields.go
index f5565d812..01a305c5a 100644
--- a/pkg/client/applyconfiguration/monitoring/v1/commonprometheusfields.go
+++ b/pkg/client/applyconfiguration/monitoring/v1/commonprometheusfields.go
@@ -92,6 +92,12 @@ type CommonPrometheusFieldsApplyConfiguration struct {
HostNetwork *bool `json:"hostNetwork,omitempty"`
PodTargetLabels []string `json:"podTargetLabels,omitempty"`
TracingConfig *PrometheusTracingConfigApplyConfiguration `json:"tracingConfig,omitempty"`
+ BodySizeLimit *monitoringv1.ByteSize `json:"bodySizeLimit,omitempty"`
+ SampleLimit *uint64 `json:"sampleLimit,omitempty"`
+ TargetLimit *uint64 `json:"targetLimit,omitempty"`
+ LabelLimit *uint64 `json:"labelLimit,omitempty"`
+ LabelNameLengthLimit *uint64 `json:"labelNameLengthLimit,omitempty"`
+ LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"`
}
// CommonPrometheusFieldsApplyConfiguration constructs an declarative configuration of the CommonPrometheusFields type for use with
@@ -689,3 +695,51 @@ func (b *CommonPrometheusFieldsApplyConfiguration) WithTracingConfig(value *Prom
b.TracingConfig = value
return b
}
+
+// WithBodySizeLimit sets the BodySizeLimit field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the BodySizeLimit field is set to the value of the last call.
+func (b *CommonPrometheusFieldsApplyConfiguration) WithBodySizeLimit(value monitoringv1.ByteSize) *CommonPrometheusFieldsApplyConfiguration {
+ b.BodySizeLimit = &value
+ return b
+}
+
+// WithSampleLimit sets the SampleLimit field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the SampleLimit field is set to the value of the last call.
+func (b *CommonPrometheusFieldsApplyConfiguration) WithSampleLimit(value uint64) *CommonPrometheusFieldsApplyConfiguration {
+ b.SampleLimit = &value
+ return b
+}
+
+// WithTargetLimit sets the TargetLimit field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the TargetLimit field is set to the value of the last call.
+func (b *CommonPrometheusFieldsApplyConfiguration) WithTargetLimit(value uint64) *CommonPrometheusFieldsApplyConfiguration {
+ b.TargetLimit = &value
+ return b
+}
+
+// WithLabelLimit sets the LabelLimit field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the LabelLimit field is set to the value of the last call.
+func (b *CommonPrometheusFieldsApplyConfiguration) WithLabelLimit(value uint64) *CommonPrometheusFieldsApplyConfiguration {
+ b.LabelLimit = &value
+ return b
+}
+
+// WithLabelNameLengthLimit sets the LabelNameLengthLimit field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the LabelNameLengthLimit field is set to the value of the last call.
+func (b *CommonPrometheusFieldsApplyConfiguration) WithLabelNameLengthLimit(value uint64) *CommonPrometheusFieldsApplyConfiguration {
+ b.LabelNameLengthLimit = &value
+ return b
+}
+
+// WithLabelValueLengthLimit sets the LabelValueLengthLimit field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the LabelValueLengthLimit field is set to the value of the last call.
+func (b *CommonPrometheusFieldsApplyConfiguration) WithLabelValueLengthLimit(value uint64) *CommonPrometheusFieldsApplyConfiguration {
+ b.LabelValueLengthLimit = &value
+ return b
+}
diff --git a/pkg/client/applyconfiguration/monitoring/v1/prometheusspec.go b/pkg/client/applyconfiguration/monitoring/v1/prometheusspec.go
index 1edc20464..807a21e6b 100644
--- a/pkg/client/applyconfiguration/monitoring/v1/prometheusspec.go
+++ b/pkg/client/applyconfiguration/monitoring/v1/prometheusspec.go
@@ -646,6 +646,54 @@ func (b *PrometheusSpecApplyConfiguration) WithTracingConfig(value *PrometheusTr
return b
}
+// WithBodySizeLimit sets the BodySizeLimit field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the BodySizeLimit field is set to the value of the last call.
+func (b *PrometheusSpecApplyConfiguration) WithBodySizeLimit(value monitoringv1.ByteSize) *PrometheusSpecApplyConfiguration {
+ b.BodySizeLimit = &value
+ return b
+}
+
+// WithSampleLimit sets the SampleLimit field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the SampleLimit field is set to the value of the last call.
+func (b *PrometheusSpecApplyConfiguration) WithSampleLimit(value uint64) *PrometheusSpecApplyConfiguration {
+ b.SampleLimit = &value
+ return b
+}
+
+// WithTargetLimit sets the TargetLimit field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the TargetLimit field is set to the value of the last call.
+func (b *PrometheusSpecApplyConfiguration) WithTargetLimit(value uint64) *PrometheusSpecApplyConfiguration {
+ b.TargetLimit = &value
+ return b
+}
+
+// WithLabelLimit sets the LabelLimit field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the LabelLimit field is set to the value of the last call.
+func (b *PrometheusSpecApplyConfiguration) WithLabelLimit(value uint64) *PrometheusSpecApplyConfiguration {
+ b.LabelLimit = &value
+ return b
+}
+
+// WithLabelNameLengthLimit sets the LabelNameLengthLimit field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the LabelNameLengthLimit field is set to the value of the last call.
+func (b *PrometheusSpecApplyConfiguration) WithLabelNameLengthLimit(value uint64) *PrometheusSpecApplyConfiguration {
+ b.LabelNameLengthLimit = &value
+ return b
+}
+
+// WithLabelValueLengthLimit sets the LabelValueLengthLimit field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the LabelValueLengthLimit field is set to the value of the last call.
+func (b *PrometheusSpecApplyConfiguration) WithLabelValueLengthLimit(value uint64) *PrometheusSpecApplyConfiguration {
+ b.LabelValueLengthLimit = &value
+ return b
+}
+
// WithBaseImage sets the BaseImage field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the BaseImage field is set to the value of the last call.
diff --git a/pkg/client/applyconfiguration/monitoring/v1alpha1/prometheusagentspec.go b/pkg/client/applyconfiguration/monitoring/v1alpha1/prometheusagentspec.go
index b10dcd2cc..792a1698e 100644
--- a/pkg/client/applyconfiguration/monitoring/v1alpha1/prometheusagentspec.go
+++ b/pkg/client/applyconfiguration/monitoring/v1alpha1/prometheusagentspec.go
@@ -624,3 +624,51 @@ func (b *PrometheusAgentSpecApplyConfiguration) WithTracingConfig(value *v1.Prom
b.TracingConfig = value
return b
}
+
+// WithBodySizeLimit sets the BodySizeLimit field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the BodySizeLimit field is set to the value of the last call.
+func (b *PrometheusAgentSpecApplyConfiguration) WithBodySizeLimit(value monitoringv1.ByteSize) *PrometheusAgentSpecApplyConfiguration {
+ b.BodySizeLimit = &value
+ return b
+}
+
+// WithSampleLimit sets the SampleLimit field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the SampleLimit field is set to the value of the last call.
+func (b *PrometheusAgentSpecApplyConfiguration) WithSampleLimit(value uint64) *PrometheusAgentSpecApplyConfiguration {
+ b.SampleLimit = &value
+ return b
+}
+
+// WithTargetLimit sets the TargetLimit field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the TargetLimit field is set to the value of the last call.
+func (b *PrometheusAgentSpecApplyConfiguration) WithTargetLimit(value uint64) *PrometheusAgentSpecApplyConfiguration {
+ b.TargetLimit = &value
+ return b
+}
+
+// WithLabelLimit sets the LabelLimit field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the LabelLimit field is set to the value of the last call.
+func (b *PrometheusAgentSpecApplyConfiguration) WithLabelLimit(value uint64) *PrometheusAgentSpecApplyConfiguration {
+ b.LabelLimit = &value
+ return b
+}
+
+// WithLabelNameLengthLimit sets the LabelNameLengthLimit field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the LabelNameLengthLimit field is set to the value of the last call.
+func (b *PrometheusAgentSpecApplyConfiguration) WithLabelNameLengthLimit(value uint64) *PrometheusAgentSpecApplyConfiguration {
+ b.LabelNameLengthLimit = &value
+ return b
+}
+
+// WithLabelValueLengthLimit sets the LabelValueLengthLimit field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the LabelValueLengthLimit field is set to the value of the last call.
+func (b *PrometheusAgentSpecApplyConfiguration) WithLabelValueLengthLimit(value uint64) *PrometheusAgentSpecApplyConfiguration {
+ b.LabelValueLengthLimit = &value
+ return b
+}
diff --git a/pkg/operator/defaults.go b/pkg/operator/defaults.go
index 5269e3889..970e81d00 100644
--- a/pkg/operator/defaults.go
+++ b/pkg/operator/defaults.go
@@ -75,5 +75,6 @@ var (
"v2.43.0",
"v2.43.1",
"v2.44.0",
+ "v2.45.0",
}
)
diff --git a/pkg/prometheus/promcfg.go b/pkg/prometheus/promcfg.go
index 2d5c9116d..192b3a076 100644
--- a/pkg/prometheus/promcfg.go
+++ b/pkg/prometheus/promcfg.go
@@ -488,6 +488,7 @@ func (cg *ConfigGenerator) GenerateServerConfiguration(
globalItems = cg.appendScrapeIntervals(globalItems)
globalItems = cg.appendExternalLabels(globalItems)
globalItems = cg.appendQueryLogFile(globalItems, queryLogFile)
+ globalItems = cg.appendScrapeLimits(globalItems)
cfg = append(cfg, yaml.MapItem{Key: "global", Value: globalItems})
// Rule Files config
@@ -1954,6 +1955,30 @@ func (cg *ConfigGenerator) appendEvaluationInterval(slice yaml.MapSlice, evaluat
return append(slice, yaml.MapItem{Key: "evaluation_interval", Value: evaluationInterval})
}
+func (cg *ConfigGenerator) appendScrapeLimits(slice yaml.MapSlice) yaml.MapSlice {
+ cpf := cg.prom.GetCommonPrometheusFields()
+ if cpf.BodySizeLimit != nil {
+ slice = cg.WithMinimumVersion("2.45.0").AppendMapItem(slice, "body_size_limit", cpf.BodySizeLimit)
+ }
+ if cpf.SampleLimit != nil {
+ slice = cg.WithMinimumVersion("2.45.0").AppendMapItem(slice, "sample_limit", *cpf.SampleLimit)
+ }
+ if cpf.TargetLimit != nil {
+ slice = cg.WithMinimumVersion("2.45.0").AppendMapItem(slice, "target_limit", *cpf.TargetLimit)
+ }
+ if cpf.LabelLimit != nil {
+ slice = cg.WithMinimumVersion("2.45.0").AppendMapItem(slice, "label_limit", *cpf.LabelLimit)
+ }
+ if cpf.LabelNameLengthLimit != nil {
+ slice = cg.WithMinimumVersion("2.45.0").AppendMapItem(slice, "label_name_length_limit", *cpf.LabelNameLengthLimit)
+ }
+ if cpf.LabelValueLengthLimit != nil {
+ slice = cg.WithMinimumVersion("2.45.0").AppendMapItem(slice, "label_value_length_limit", *cpf.LabelValueLengthLimit)
+ }
+
+ return slice
+}
+
func (cg *ConfigGenerator) appendExternalLabels(slice yaml.MapSlice) yaml.MapSlice {
slice = append(slice, yaml.MapItem{
Key: "external_labels",
@@ -2114,6 +2139,7 @@ func (cg *ConfigGenerator) GenerateAgentConfiguration(
globalItems := yaml.MapSlice{}
globalItems = cg.appendScrapeIntervals(globalItems)
globalItems = cg.appendExternalLabels(globalItems)
+ globalItems = cg.appendScrapeLimits(globalItems)
cfg = append(cfg, yaml.MapItem{Key: "global", Value: globalItems})
// Scrape config
diff --git a/pkg/prometheus/promcfg_test.go b/pkg/prometheus/promcfg_test.go
index c0d5f3f14..cda491f1b 100644
--- a/pkg/prometheus/promcfg_test.go
+++ b/pkg/prometheus/promcfg_test.go
@@ -99,16 +99,31 @@ func TestConfigGeneration(t *testing.T) {
}
func TestGlobalSettings(t *testing.T) {
+ var (
+ expectedBodySizeLimit monitoringv1.ByteSize = "1000MB"
+ expectedSampleLimit uint64 = 10000
+ expectedTargetLimit uint64 = 1000
+ expectedLabelLimit uint64 = 50
+ expectedLabelNameLengthLimit uint64 = 40
+ expectedLabelValueLengthLimit uint64 = 30
+ )
+
for _, tc := range []struct {
- Scenario string
- EvaluationInterval monitoringv1.Duration
- ScrapeInterval monitoringv1.Duration
- ScrapeTimeout monitoringv1.Duration
- ExternalLabels map[string]string
- QueryLogFile string
- Version string
- Expected string
- ExpectError bool
+ Scenario string
+ EvaluationInterval monitoringv1.Duration
+ ScrapeInterval monitoringv1.Duration
+ ScrapeTimeout monitoringv1.Duration
+ ExternalLabels map[string]string
+ QueryLogFile string
+ Version string
+ BodySizeLimit *monitoringv1.ByteSize
+ SampleLimit *uint64
+ TargetLimit *uint64
+ LabelLimit *uint64
+ LabelNameLengthLimit *uint64
+ LabelValueLengthLimit *uint64
+ Expected string
+ ExpectError bool
}{
{
Scenario: "valid config",
@@ -181,6 +196,52 @@ scrape_configs: []
prometheus_replica: $(POD_NAME)
query_log_file: /var/log/prometheus/test.log
scrape_configs: []
+`,
+ },
+ {
+ Scenario: "valid global limits",
+ Version: "v2.45.0",
+ ScrapeInterval: "30s",
+ EvaluationInterval: "30s",
+ BodySizeLimit: &expectedBodySizeLimit,
+ SampleLimit: &expectedSampleLimit,
+ TargetLimit: &expectedTargetLimit,
+ Expected: `global:
+ evaluation_interval: 30s
+ scrape_interval: 30s
+ external_labels:
+ prometheus: /
+ prometheus_replica: $(POD_NAME)
+ body_size_limit: 1000MB
+ sample_limit: 10000
+ target_limit: 1000
+scrape_configs: []
+`,
+ },
+ {
+ Scenario: "valid global config with label limits",
+ Version: "v2.45.0",
+ ScrapeInterval: "30s",
+ EvaluationInterval: "30s",
+ BodySizeLimit: &expectedBodySizeLimit,
+ SampleLimit: &expectedSampleLimit,
+ TargetLimit: &expectedTargetLimit,
+ LabelLimit: &expectedLabelLimit,
+ LabelNameLengthLimit: &expectedLabelNameLengthLimit,
+ LabelValueLengthLimit: &expectedLabelValueLengthLimit,
+ Expected: `global:
+ evaluation_interval: 30s
+ scrape_interval: 30s
+ external_labels:
+ prometheus: /
+ prometheus_replica: $(POD_NAME)
+ body_size_limit: 1000MB
+ sample_limit: 10000
+ target_limit: 1000
+ label_limit: 50
+ label_name_length_limit: 40
+ label_value_length_limit: 30
+scrape_configs: []
`,
},
} {
@@ -189,11 +250,17 @@ scrape_configs: []
ObjectMeta: metav1.ObjectMeta{},
Spec: monitoringv1.PrometheusSpec{
CommonPrometheusFields: monitoringv1.CommonPrometheusFields{
- ScrapeInterval: tc.ScrapeInterval,
- ScrapeTimeout: tc.ScrapeTimeout,
- ExternalLabels: tc.ExternalLabels,
- Version: tc.Version,
- TracingConfig: nil,
+ ScrapeInterval: tc.ScrapeInterval,
+ ScrapeTimeout: tc.ScrapeTimeout,
+ ExternalLabels: tc.ExternalLabels,
+ Version: tc.Version,
+ TracingConfig: nil,
+ BodySizeLimit: tc.BodySizeLimit,
+ SampleLimit: tc.SampleLimit,
+ TargetLimit: tc.TargetLimit,
+ LabelLimit: tc.LabelLimit,
+ LabelNameLengthLimit: tc.LabelNameLengthLimit,
+ LabelValueLengthLimit: tc.LabelValueLengthLimit,
},
EvaluationInterval: tc.EvaluationInterval,
QueryLogFile: tc.QueryLogFile,