diff --git a/Documentation/api.md b/Documentation/api.md index 2dc5666d2..1fa80f0b8 100644 --- a/Documentation/api.md +++ b/Documentation/api.md @@ -1039,6 +1039,47 @@ uint64 +scrapeClassicHistograms
+ +bool + + + +(Optional) +

Whether to scrape a classic histogram that is also exposed as a native histogram. +It requires Prometheus >= v2.45.0.

+ + + + +nativeHistogramBucketLimit
+ +uint64 + + + +(Optional) +

If there are more than this many buckets in a native histogram, +buckets will be merged to stay within the limit. +It requires Prometheus >= v2.45.0.

+ + + + +nativeHistogramMinBucketFactor
+ +k8s.io/apimachinery/pkg/api/resource.Quantity + + + +(Optional) +

If the growth factor of one bucket to the next is smaller than this, +buckets will be merged to increase the factor sufficiently. +It requires Prometheus >= v2.50.0.

+ + + + keepDroppedTargets
uint64 @@ -1404,6 +1445,47 @@ Only valid in Prometheus versions 2.27.0 and newer.

+scrapeClassicHistograms
+ +bool + + + +(Optional) +

Whether to scrape a classic histogram that is also exposed as a native histogram. +It requires Prometheus >= v2.45.0.

+ + + + +nativeHistogramBucketLimit
+ +uint64 + + + +(Optional) +

If there are more than this many buckets in a native histogram, +buckets will be merged to stay within the limit. +It requires Prometheus >= v2.45.0.

+ + + + +nativeHistogramMinBucketFactor
+ +k8s.io/apimachinery/pkg/api/resource.Quantity + + + +(Optional) +

If the growth factor of one bucket to the next is smaller than this, +buckets will be merged to increase the factor sufficiently. +It requires Prometheus >= v2.50.0.

+ + + + keepDroppedTargets
uint64 @@ -3573,6 +3655,47 @@ uint64 +scrapeClassicHistograms
+ +bool + + + +(Optional) +

Whether to scrape a classic histogram that is also exposed as a native histogram. +It requires Prometheus >= v2.45.0.

+ + + + +nativeHistogramBucketLimit
+ +uint64 + + + +(Optional) +

If there are more than this many buckets in a native histogram, +buckets will be merged to stay within the limit. +It requires Prometheus >= v2.45.0.

+ + + + +nativeHistogramMinBucketFactor
+ +k8s.io/apimachinery/pkg/api/resource.Quantity + + + +(Optional) +

If the growth factor of one bucket to the next is smaller than this, +buckets will be merged to increase the factor sufficiently. +It requires Prometheus >= v2.50.0.

+ + + + keepDroppedTargets
uint64 @@ -9327,6 +9450,65 @@ list restricting them.

+

NativeHistogramConfig +

+

+(Appears on:PodMonitorSpec, ProbeSpec, ServiceMonitorSpec, ScrapeConfigSpec) +

+
+

NativeHistogramConfig extends the native histogram configuration settings.

+
+ + + + + + + + + + + + + + + + + + + + + +
FieldDescription
+scrapeClassicHistograms
+ +bool + +
+(Optional) +

Whether to scrape a classic histogram that is also exposed as a native histogram. +It requires Prometheus >= v2.45.0.

+
+nativeHistogramBucketLimit
+ +uint64 + +
+(Optional) +

If there are more than this many buckets in a native histogram, +buckets will be merged to stay within the limit. +It requires Prometheus >= v2.45.0.

+
+nativeHistogramMinBucketFactor
+ +k8s.io/apimachinery/pkg/api/resource.Quantity + +
+(Optional) +

If the growth factor of one bucket to the next is smaller than this, +buckets will be merged to increase the factor sufficiently. +It requires Prometheus >= v2.50.0.

+

NonEmptyDuration (string alias)

@@ -10196,6 +10378,47 @@ uint64 +scrapeClassicHistograms
+ +bool + + + +(Optional) +

Whether to scrape a classic histogram that is also exposed as a native histogram. +It requires Prometheus >= v2.45.0.

+ + + + +nativeHistogramBucketLimit
+ +uint64 + + + +(Optional) +

If there are more than this many buckets in a native histogram, +buckets will be merged to stay within the limit. +It requires Prometheus >= v2.45.0.

+ + + + +nativeHistogramMinBucketFactor
+ +k8s.io/apimachinery/pkg/api/resource.Quantity + + + +(Optional) +

If the growth factor of one bucket to the next is smaller than this, +buckets will be merged to increase the factor sufficiently. +It requires Prometheus >= v2.50.0.

+ + + + keepDroppedTargets
uint64 @@ -10512,6 +10735,47 @@ Only valid in Prometheus versions 2.27.0 and newer.

+scrapeClassicHistograms
+ +bool + + + +(Optional) +

Whether to scrape a classic histogram that is also exposed as a native histogram. +It requires Prometheus >= v2.45.0.

+ + + + +nativeHistogramBucketLimit
+ +uint64 + + + +(Optional) +

If there are more than this many buckets in a native histogram, +buckets will be merged to stay within the limit. +It requires Prometheus >= v2.45.0.

+ + + + +nativeHistogramMinBucketFactor
+ +k8s.io/apimachinery/pkg/api/resource.Quantity + + + +(Optional) +

If the growth factor of one bucket to the next is smaller than this, +buckets will be merged to increase the factor sufficiently. +It requires Prometheus >= v2.50.0.

+ + + + keepDroppedTargets
uint64 @@ -14832,6 +15096,47 @@ uint64 +scrapeClassicHistograms
+ +bool + + + +(Optional) +

Whether to scrape a classic histogram that is also exposed as a native histogram. +It requires Prometheus >= v2.45.0.

+ + + + +nativeHistogramBucketLimit
+ +uint64 + + + +(Optional) +

If there are more than this many buckets in a native histogram, +buckets will be merged to stay within the limit. +It requires Prometheus >= v2.45.0.

+ + + + +nativeHistogramMinBucketFactor
+ +k8s.io/apimachinery/pkg/api/resource.Quantity + + + +(Optional) +

If the growth factor of one bucket to the next is smaller than this, +buckets will be merged to increase the factor sufficiently. +It requires Prometheus >= v2.50.0.

+ + + + keepDroppedTargets
uint64 @@ -19409,6 +19714,47 @@ Only valid in Prometheus versions 2.27.0 and newer.

+scrapeClassicHistograms
+ +bool + + + +(Optional) +

Whether to scrape a classic histogram that is also exposed as a native histogram. +It requires Prometheus >= v2.45.0.

+ + + + +nativeHistogramBucketLimit
+ +uint64 + + + +(Optional) +

If there are more than this many buckets in a native histogram, +buckets will be merged to stay within the limit. +It requires Prometheus >= v2.45.0.

+ + + + +nativeHistogramMinBucketFactor
+ +k8s.io/apimachinery/pkg/api/resource.Quantity + + + +(Optional) +

If the growth factor of one bucket to the next is smaller than this, +buckets will be merged to increase the factor sufficiently. +It requires Prometheus >= v2.50.0.

+ + + + keepDroppedTargets
uint64 @@ -28340,6 +28686,47 @@ Only valid in Prometheus versions 2.27.0 and newer.

+scrapeClassicHistograms
+ +bool + + + +(Optional) +

Whether to scrape a classic histogram that is also exposed as a native histogram. +It requires Prometheus >= v2.45.0.

+ + + + +nativeHistogramBucketLimit
+ +uint64 + + + +(Optional) +

If there are more than this many buckets in a native histogram, +buckets will be merged to stay within the limit. +It requires Prometheus >= v2.45.0.

+ + + + +nativeHistogramMinBucketFactor
+ +k8s.io/apimachinery/pkg/api/resource.Quantity + + + +(Optional) +

If the growth factor of one bucket to the next is smaller than this, +buckets will be merged to increase the factor sufficiently. +It requires Prometheus >= v2.50.0.

+ + + + keepDroppedTargets
uint64 diff --git a/Makefile b/Makefile index 43daf1181..98ea31564 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,8 @@ TAG?=$(shell git rev-parse --short HEAD) VERSION?=$(shell cat VERSION | tr -d " \t\n\r") GO_VERSION?=$(shell grep golang-version .github/env | sed "s/golang-version=//") +CRD_OPTIONS ?= "crd:crdVersions=v1" + KIND_CONTEXT ?= e2e TYPES_V1_TARGET := pkg/apis/monitoring/v1/types.go @@ -238,10 +240,10 @@ generate: k8s-gen generate-crds bundle.yaml example/mixin/alerts.yaml example/th # be used to patch the "default" jsonnet CRD. .PHONY: generate-crds generate-crds: $(CONTROLLER_GEN_BINARY) $(GOJSONTOYAML_BINARY) $(TYPES_V1_TARGET) $(TYPES_V1ALPHA1_TARGET) $(TYPES_V1BETA1_TARGET) - cd pkg/apis/monitoring && $(CONTROLLER_GEN_BINARY) crd:crdVersions=v1 paths=./v1/. paths=./v1alpha1/. output:crd:dir=$(PWD)/example/prometheus-operator-crd/ + cd pkg/apis/monitoring && $(CONTROLLER_GEN_BINARY) $(CRD_OPTIONS) paths=./v1/. paths=./v1alpha1/. output:crd:dir=$(PWD)/example/prometheus-operator-crd/ VERSION=$(VERSION) ./scripts/generate/append-operator-version.sh find example/prometheus-operator-crd/ -name '*.yaml' -print0 | xargs -0 -I{} sh -c '$(GOJSONTOYAML_BINARY) -yamltojson < "$$1" | jq > "$(PWD)/jsonnet/prometheus-operator/$$(basename $$1 | cut -d'_' -f2 | cut -d. -f1)-crd.json"' -- {} - cd pkg/apis/monitoring && $(CONTROLLER_GEN_BINARY) crd:crdVersions=v1 paths=./... output:crd:dir=$(PWD)/example/prometheus-operator-crd-full + cd pkg/apis/monitoring && $(CONTROLLER_GEN_BINARY) $(CRD_OPTIONS) paths=./... output:crd:dir=$(PWD)/example/prometheus-operator-crd-full echo "// Code generated using 'make generate-crds'. DO NOT EDIT." > $(PWD)/jsonnet/prometheus-operator/alertmanagerconfigs-v1beta1-crd.libsonnet echo "{spec+: {versions+: $$($(GOJSONTOYAML_BINARY) -yamltojson < example/prometheus-operator-crd-full/monitoring.coreos.com_alertmanagerconfigs.yaml | jq '.spec.versions | map(select(.name == "v1beta1"))')}}" | $(JSONNETFMT_BINARY) - >> $(PWD)/jsonnet/prometheus-operator/alertmanagerconfigs-v1beta1-crd.libsonnet @@ -297,7 +299,7 @@ Documentation/compatibility.md: pkg/operator/defaults.go $(MDOX_BINARY) fmt $@ Documentation/api.md: $(TYPES_V1_TARGET) $(TYPES_V1ALPHA1_TARGET) $(TYPES_V1BETA1_TARGET) - $(API_DOC_GEN_BINARY) -api-dir "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/" -config "$(PWD)/scripts/docs/config.json" -template-dir "$(PWD)/scripts/docs/templates" -out-file "$(PWD)/Documentation/api.md" + GODEBUG=$(GODEBUG) $(API_DOC_GEN_BINARY) -api-dir "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/" -config "$(PWD)/scripts/docs/config.json" -template-dir "$(PWD)/scripts/docs/templates" -out-file "$(PWD)/Documentation/api.md" ############## # Formatting # diff --git a/bundle.yaml b/bundle.yaml index 87614dbc2..c6613ce0c 100644 --- a/bundle.yaml +++ b/bundle.yaml @@ -18730,6 +18730,23 @@ spec: type: string type: array type: object + nativeHistogramBucketLimit: + description: |- + If there are more than this many buckets in a native histogram, + buckets will be merged to stay within the limit. + It requires Prometheus >= v2.45.0. + format: int64 + type: integer + nativeHistogramMinBucketFactor: + anyOf: + - type: integer + - type: string + description: |- + If the growth factor of one bucket to the next is smaller than this, + buckets will be merged to increase the factor sufficiently. + It requires Prometheus >= v2.50.0. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true podMetricsEndpoints: description: Defines how to scrape metrics from the selected pods. items: @@ -19660,6 +19677,11 @@ spec: description: The scrape class to apply. minLength: 1 type: string + scrapeClassicHistograms: + description: |- + Whether to scrape a classic histogram that is also exposed as a native histogram. + It requires Prometheus >= v2.45.0. + type: boolean scrapeProtocols: description: |- `scrapeProtocols` defines the protocols to negotiate during a scrape. It tells clients the @@ -20048,6 +20070,23 @@ spec: Example module configuring in the blackbox exporter: https://github.com/prometheus/blackbox_exporter/blob/master/example.yml type: string + nativeHistogramBucketLimit: + description: |- + If there are more than this many buckets in a native histogram, + buckets will be merged to stay within the limit. + It requires Prometheus >= v2.45.0. + format: int64 + type: integer + nativeHistogramMinBucketFactor: + anyOf: + - type: integer + - type: string + description: |- + If the growth factor of one bucket to the next is smaller than this, + buckets will be merged to increase the factor sufficiently. + It requires Prometheus >= v2.50.0. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true oauth2: description: OAuth2 for the URL. Only valid in Prometheus versions 2.27.0 and newer. @@ -20408,6 +20447,11 @@ spec: description: The scrape class to apply. minLength: 1 type: string + scrapeClassicHistograms: + description: |- + Whether to scrape a classic histogram that is also exposed as a native histogram. + It requires Prometheus >= v2.45.0. + type: boolean scrapeProtocols: description: |- `scrapeProtocols` defines the protocols to negotiate during a scrape. It tells clients the @@ -53011,6 +53055,23 @@ spec: Prometheus uses the default value (e.g. /metrics). minLength: 1 type: string + nativeHistogramBucketLimit: + description: |- + If there are more than this many buckets in a native histogram, + buckets will be merged to stay within the limit. + It requires Prometheus >= v2.45.0. + format: int64 + type: integer + nativeHistogramMinBucketFactor: + anyOf: + - type: integer + - type: string + description: |- + If the growth factor of one bucket to the next is smaller than this, + buckets will be merged to increase the factor sufficiently. + It requires Prometheus >= v2.50.0. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true noProxy: description: |- `noProxy` is a comma-separated string that can contain IPs, CIDR notation, domain names @@ -55562,6 +55623,11 @@ spec: description: The scrape class to apply. minLength: 1 type: string + scrapeClassicHistograms: + description: |- + Whether to scrape a classic histogram that is also exposed as a native histogram. + It requires Prometheus >= v2.45.0. + type: boolean scrapeInterval: description: ScrapeInterval is the interval between consecutive scrapes. pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$ @@ -56873,6 +56939,23 @@ spec: type: string type: array type: object + nativeHistogramBucketLimit: + description: |- + If there are more than this many buckets in a native histogram, + buckets will be merged to stay within the limit. + It requires Prometheus >= v2.45.0. + format: int64 + type: integer + nativeHistogramMinBucketFactor: + anyOf: + - type: integer + - type: string + description: |- + If the growth factor of one bucket to the next is smaller than this, + buckets will be merged to increase the factor sufficiently. + It requires Prometheus >= v2.50.0. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true podTargetLabels: description: |- `podTargetLabels` defines the labels which are transferred from the @@ -56890,6 +56973,11 @@ spec: description: The scrape class to apply. minLength: 1 type: string + scrapeClassicHistograms: + description: |- + Whether to scrape a classic histogram that is also exposed as a native histogram. + It requires Prometheus >= v2.45.0. + type: boolean scrapeProtocols: description: |- `scrapeProtocols` defines the protocols to negotiate during a scrape. It tells clients the diff --git a/example/prometheus-operator-crd-full/monitoring.coreos.com_podmonitors.yaml b/example/prometheus-operator-crd-full/monitoring.coreos.com_podmonitors.yaml index 04ecb516d..9340b2c5d 100644 --- a/example/prometheus-operator-crd-full/monitoring.coreos.com_podmonitors.yaml +++ b/example/prometheus-operator-crd-full/monitoring.coreos.com_podmonitors.yaml @@ -134,6 +134,23 @@ spec: type: string type: array type: object + nativeHistogramBucketLimit: + description: |- + If there are more than this many buckets in a native histogram, + buckets will be merged to stay within the limit. + It requires Prometheus >= v2.45.0. + format: int64 + type: integer + nativeHistogramMinBucketFactor: + anyOf: + - type: integer + - type: string + description: |- + If the growth factor of one bucket to the next is smaller than this, + buckets will be merged to increase the factor sufficiently. + It requires Prometheus >= v2.50.0. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true podMetricsEndpoints: description: Defines how to scrape metrics from the selected pods. items: @@ -1064,6 +1081,11 @@ spec: description: The scrape class to apply. minLength: 1 type: string + scrapeClassicHistograms: + description: |- + Whether to scrape a classic histogram that is also exposed as a native histogram. + It requires Prometheus >= v2.45.0. + type: boolean scrapeProtocols: description: |- `scrapeProtocols` defines the protocols to negotiate during a scrape. It tells clients the diff --git a/example/prometheus-operator-crd-full/monitoring.coreos.com_probes.yaml b/example/prometheus-operator-crd-full/monitoring.coreos.com_probes.yaml index bdbfb8f94..d52ead5fd 100644 --- a/example/prometheus-operator-crd-full/monitoring.coreos.com_probes.yaml +++ b/example/prometheus-operator-crd-full/monitoring.coreos.com_probes.yaml @@ -299,6 +299,23 @@ spec: Example module configuring in the blackbox exporter: https://github.com/prometheus/blackbox_exporter/blob/master/example.yml type: string + nativeHistogramBucketLimit: + description: |- + If there are more than this many buckets in a native histogram, + buckets will be merged to stay within the limit. + It requires Prometheus >= v2.45.0. + format: int64 + type: integer + nativeHistogramMinBucketFactor: + anyOf: + - type: integer + - type: string + description: |- + If the growth factor of one bucket to the next is smaller than this, + buckets will be merged to increase the factor sufficiently. + It requires Prometheus >= v2.50.0. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true oauth2: description: OAuth2 for the URL. Only valid in Prometheus versions 2.27.0 and newer. @@ -659,6 +676,11 @@ spec: description: The scrape class to apply. minLength: 1 type: string + scrapeClassicHistograms: + description: |- + Whether to scrape a classic histogram that is also exposed as a native histogram. + It requires Prometheus >= v2.45.0. + type: boolean scrapeProtocols: description: |- `scrapeProtocols` defines the protocols to negotiate during a scrape. It tells clients the diff --git a/example/prometheus-operator-crd-full/monitoring.coreos.com_scrapeconfigs.yaml b/example/prometheus-operator-crd-full/monitoring.coreos.com_scrapeconfigs.yaml index f890530c5..b1fa65a57 100644 --- a/example/prometheus-operator-crd-full/monitoring.coreos.com_scrapeconfigs.yaml +++ b/example/prometheus-operator-crd-full/monitoring.coreos.com_scrapeconfigs.yaml @@ -8651,6 +8651,23 @@ spec: Prometheus uses the default value (e.g. /metrics). minLength: 1 type: string + nativeHistogramBucketLimit: + description: |- + If there are more than this many buckets in a native histogram, + buckets will be merged to stay within the limit. + It requires Prometheus >= v2.45.0. + format: int64 + type: integer + nativeHistogramMinBucketFactor: + anyOf: + - type: integer + - type: string + description: |- + If the growth factor of one bucket to the next is smaller than this, + buckets will be merged to increase the factor sufficiently. + It requires Prometheus >= v2.50.0. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true noProxy: description: |- `noProxy` is a comma-separated string that can contain IPs, CIDR notation, domain names @@ -11202,6 +11219,11 @@ spec: description: The scrape class to apply. minLength: 1 type: string + scrapeClassicHistograms: + description: |- + Whether to scrape a classic histogram that is also exposed as a native histogram. + It requires Prometheus >= v2.45.0. + type: boolean scrapeInterval: description: ScrapeInterval is the interval between consecutive scrapes. pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$ diff --git a/example/prometheus-operator-crd-full/monitoring.coreos.com_servicemonitors.yaml b/example/prometheus-operator-crd-full/monitoring.coreos.com_servicemonitors.yaml index d6e51ef19..1e38a8068 100644 --- a/example/prometheus-operator-crd-full/monitoring.coreos.com_servicemonitors.yaml +++ b/example/prometheus-operator-crd-full/monitoring.coreos.com_servicemonitors.yaml @@ -1067,6 +1067,23 @@ spec: type: string type: array type: object + nativeHistogramBucketLimit: + description: |- + If there are more than this many buckets in a native histogram, + buckets will be merged to stay within the limit. + It requires Prometheus >= v2.45.0. + format: int64 + type: integer + nativeHistogramMinBucketFactor: + anyOf: + - type: integer + - type: string + description: |- + If the growth factor of one bucket to the next is smaller than this, + buckets will be merged to increase the factor sufficiently. + It requires Prometheus >= v2.50.0. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true podTargetLabels: description: |- `podTargetLabels` defines the labels which are transferred from the @@ -1084,6 +1101,11 @@ spec: description: The scrape class to apply. minLength: 1 type: string + scrapeClassicHistograms: + description: |- + Whether to scrape a classic histogram that is also exposed as a native histogram. + It requires Prometheus >= v2.45.0. + type: boolean scrapeProtocols: description: |- `scrapeProtocols` defines the protocols to negotiate during a scrape. It tells clients the diff --git a/example/prometheus-operator-crd/monitoring.coreos.com_podmonitors.yaml b/example/prometheus-operator-crd/monitoring.coreos.com_podmonitors.yaml index ba09dbbc8..d492d639c 100644 --- a/example/prometheus-operator-crd/monitoring.coreos.com_podmonitors.yaml +++ b/example/prometheus-operator-crd/monitoring.coreos.com_podmonitors.yaml @@ -135,6 +135,23 @@ spec: type: string type: array type: object + nativeHistogramBucketLimit: + description: |- + If there are more than this many buckets in a native histogram, + buckets will be merged to stay within the limit. + It requires Prometheus >= v2.45.0. + format: int64 + type: integer + nativeHistogramMinBucketFactor: + anyOf: + - type: integer + - type: string + description: |- + If the growth factor of one bucket to the next is smaller than this, + buckets will be merged to increase the factor sufficiently. + It requires Prometheus >= v2.50.0. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true podMetricsEndpoints: description: Defines how to scrape metrics from the selected pods. items: @@ -1065,6 +1082,11 @@ spec: description: The scrape class to apply. minLength: 1 type: string + scrapeClassicHistograms: + description: |- + Whether to scrape a classic histogram that is also exposed as a native histogram. + It requires Prometheus >= v2.45.0. + type: boolean scrapeProtocols: description: |- `scrapeProtocols` defines the protocols to negotiate during a scrape. It tells clients the diff --git a/example/prometheus-operator-crd/monitoring.coreos.com_probes.yaml b/example/prometheus-operator-crd/monitoring.coreos.com_probes.yaml index 1a44e3e54..1536a4435 100644 --- a/example/prometheus-operator-crd/monitoring.coreos.com_probes.yaml +++ b/example/prometheus-operator-crd/monitoring.coreos.com_probes.yaml @@ -300,6 +300,23 @@ spec: Example module configuring in the blackbox exporter: https://github.com/prometheus/blackbox_exporter/blob/master/example.yml type: string + nativeHistogramBucketLimit: + description: |- + If there are more than this many buckets in a native histogram, + buckets will be merged to stay within the limit. + It requires Prometheus >= v2.45.0. + format: int64 + type: integer + nativeHistogramMinBucketFactor: + anyOf: + - type: integer + - type: string + description: |- + If the growth factor of one bucket to the next is smaller than this, + buckets will be merged to increase the factor sufficiently. + It requires Prometheus >= v2.50.0. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true oauth2: description: OAuth2 for the URL. Only valid in Prometheus versions 2.27.0 and newer. @@ -660,6 +677,11 @@ spec: description: The scrape class to apply. minLength: 1 type: string + scrapeClassicHistograms: + description: |- + Whether to scrape a classic histogram that is also exposed as a native histogram. + It requires Prometheus >= v2.45.0. + type: boolean scrapeProtocols: description: |- `scrapeProtocols` defines the protocols to negotiate during a scrape. It tells clients the diff --git a/example/prometheus-operator-crd/monitoring.coreos.com_scrapeconfigs.yaml b/example/prometheus-operator-crd/monitoring.coreos.com_scrapeconfigs.yaml index 72b47a757..7032f824a 100644 --- a/example/prometheus-operator-crd/monitoring.coreos.com_scrapeconfigs.yaml +++ b/example/prometheus-operator-crd/monitoring.coreos.com_scrapeconfigs.yaml @@ -8652,6 +8652,23 @@ spec: Prometheus uses the default value (e.g. /metrics). minLength: 1 type: string + nativeHistogramBucketLimit: + description: |- + If there are more than this many buckets in a native histogram, + buckets will be merged to stay within the limit. + It requires Prometheus >= v2.45.0. + format: int64 + type: integer + nativeHistogramMinBucketFactor: + anyOf: + - type: integer + - type: string + description: |- + If the growth factor of one bucket to the next is smaller than this, + buckets will be merged to increase the factor sufficiently. + It requires Prometheus >= v2.50.0. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true noProxy: description: |- `noProxy` is a comma-separated string that can contain IPs, CIDR notation, domain names @@ -11203,6 +11220,11 @@ spec: description: The scrape class to apply. minLength: 1 type: string + scrapeClassicHistograms: + description: |- + Whether to scrape a classic histogram that is also exposed as a native histogram. + It requires Prometheus >= v2.45.0. + type: boolean scrapeInterval: description: ScrapeInterval is the interval between consecutive scrapes. pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$ diff --git a/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml b/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml index bf6f83136..2c3961381 100644 --- a/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml +++ b/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml @@ -1068,6 +1068,23 @@ spec: type: string type: array type: object + nativeHistogramBucketLimit: + description: |- + If there are more than this many buckets in a native histogram, + buckets will be merged to stay within the limit. + It requires Prometheus >= v2.45.0. + format: int64 + type: integer + nativeHistogramMinBucketFactor: + anyOf: + - type: integer + - type: string + description: |- + If the growth factor of one bucket to the next is smaller than this, + buckets will be merged to increase the factor sufficiently. + It requires Prometheus >= v2.50.0. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true podTargetLabels: description: |- `podTargetLabels` defines the labels which are transferred from the @@ -1085,6 +1102,11 @@ spec: description: The scrape class to apply. minLength: 1 type: string + scrapeClassicHistograms: + description: |- + Whether to scrape a classic histogram that is also exposed as a native histogram. + It requires Prometheus >= v2.45.0. + type: boolean scrapeProtocols: description: |- `scrapeProtocols` defines the protocols to negotiate during a scrape. It tells clients the diff --git a/jsonnet/prometheus-operator/podmonitors-crd.json b/jsonnet/prometheus-operator/podmonitors-crd.json index 5c94f5b93..b645f4b10 100644 --- a/jsonnet/prometheus-operator/podmonitors-crd.json +++ b/jsonnet/prometheus-operator/podmonitors-crd.json @@ -100,6 +100,24 @@ }, "type": "object" }, + "nativeHistogramBucketLimit": { + "description": "If there are more than this many buckets in a native histogram,\nbuckets will be merged to stay within the limit.\nIt requires Prometheus >= v2.45.0.", + "format": "int64", + "type": "integer" + }, + "nativeHistogramMinBucketFactor": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ], + "description": "If the growth factor of one bucket to the next is smaller than this,\nbuckets will be merged to increase the factor sufficiently.\nIt requires Prometheus >= v2.50.0.", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + }, "podMetricsEndpoints": { "description": "Defines how to scrape metrics from the selected pods.", "items": { @@ -920,6 +938,10 @@ "minLength": 1, "type": "string" }, + "scrapeClassicHistograms": { + "description": "Whether to scrape a classic histogram that is also exposed as a native histogram.\nIt requires Prometheus >= v2.45.0.", + "type": "boolean" + }, "scrapeProtocols": { "description": "`scrapeProtocols` defines the protocols to negotiate during a scrape. It tells clients the\nprotocols supported by Prometheus in order of preference (from most to least preferred).\n\nIf unset, Prometheus uses its default value.\n\nIt requires Prometheus >= v2.49.0.", "items": { diff --git a/jsonnet/prometheus-operator/probes-crd.json b/jsonnet/prometheus-operator/probes-crd.json index 9c8c2f968..b47a5af72 100644 --- a/jsonnet/prometheus-operator/probes-crd.json +++ b/jsonnet/prometheus-operator/probes-crd.json @@ -254,6 +254,24 @@ "description": "The module to use for probing specifying how to probe the target.\nExample module configuring in the blackbox exporter:\nhttps://github.com/prometheus/blackbox_exporter/blob/master/example.yml", "type": "string" }, + "nativeHistogramBucketLimit": { + "description": "If there are more than this many buckets in a native histogram,\nbuckets will be merged to stay within the limit.\nIt requires Prometheus >= v2.45.0.", + "format": "int64", + "type": "integer" + }, + "nativeHistogramMinBucketFactor": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ], + "description": "If the growth factor of one bucket to the next is smaller than this,\nbuckets will be merged to increase the factor sufficiently.\nIt requires Prometheus >= v2.50.0.", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + }, "oauth2": { "description": "OAuth2 for the URL. Only valid in Prometheus versions 2.27.0 and newer.", "properties": { @@ -604,6 +622,10 @@ "minLength": 1, "type": "string" }, + "scrapeClassicHistograms": { + "description": "Whether to scrape a classic histogram that is also exposed as a native histogram.\nIt requires Prometheus >= v2.45.0.", + "type": "boolean" + }, "scrapeProtocols": { "description": "`scrapeProtocols` defines the protocols to negotiate during a scrape. It tells clients the\nprotocols supported by Prometheus in order of preference (from most to least preferred).\n\nIf unset, Prometheus uses its default value.\n\nIt requires Prometheus >= v2.49.0.", "items": { diff --git a/jsonnet/prometheus-operator/scrapeconfigs-crd.json b/jsonnet/prometheus-operator/scrapeconfigs-crd.json index 161c836e0..0c4d88cdf 100644 --- a/jsonnet/prometheus-operator/scrapeconfigs-crd.json +++ b/jsonnet/prometheus-operator/scrapeconfigs-crd.json @@ -8193,6 +8193,24 @@ "minLength": 1, "type": "string" }, + "nativeHistogramBucketLimit": { + "description": "If there are more than this many buckets in a native histogram,\nbuckets will be merged to stay within the limit.\nIt requires Prometheus >= v2.45.0.", + "format": "int64", + "type": "integer" + }, + "nativeHistogramMinBucketFactor": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ], + "description": "If the growth factor of one bucket to the next is smaller than this,\nbuckets will be merged to increase the factor sufficiently.\nIt requires Prometheus >= v2.50.0.", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + }, "noProxy": { "description": "`noProxy` is a comma-separated string that can contain IPs, CIDR notation, domain names\nthat should be excluded from proxying. IP and domain names can\ncontain port numbers.\n\nIt requires Prometheus >= v2.43.0 or Alertmanager >= 0.25.0.", "type": "string" @@ -10637,6 +10655,10 @@ "minLength": 1, "type": "string" }, + "scrapeClassicHistograms": { + "description": "Whether to scrape a classic histogram that is also exposed as a native histogram.\nIt requires Prometheus >= v2.45.0.", + "type": "boolean" + }, "scrapeInterval": { "description": "ScrapeInterval is the interval between consecutive scrapes.", "pattern": "^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$", diff --git a/jsonnet/prometheus-operator/servicemonitors-crd.json b/jsonnet/prometheus-operator/servicemonitors-crd.json index 32515de94..62de436dc 100644 --- a/jsonnet/prometheus-operator/servicemonitors-crd.json +++ b/jsonnet/prometheus-operator/servicemonitors-crd.json @@ -919,6 +919,24 @@ }, "type": "object" }, + "nativeHistogramBucketLimit": { + "description": "If there are more than this many buckets in a native histogram,\nbuckets will be merged to stay within the limit.\nIt requires Prometheus >= v2.45.0.", + "format": "int64", + "type": "integer" + }, + "nativeHistogramMinBucketFactor": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ], + "description": "If the growth factor of one bucket to the next is smaller than this,\nbuckets will be merged to increase the factor sufficiently.\nIt requires Prometheus >= v2.50.0.", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + }, "podTargetLabels": { "description": "`podTargetLabels` defines the labels which are transferred from the\nassociated Kubernetes `Pod` object onto the ingested metrics.", "items": { @@ -936,6 +954,10 @@ "minLength": 1, "type": "string" }, + "scrapeClassicHistograms": { + "description": "Whether to scrape a classic histogram that is also exposed as a native histogram.\nIt requires Prometheus >= v2.45.0.", + "type": "boolean" + }, "scrapeProtocols": { "description": "`scrapeProtocols` defines the protocols to negotiate during a scrape. It tells clients the\nprotocols supported by Prometheus in order of preference (from most to least preferred).\n\nIf unset, Prometheus uses its default value.\n\nIt requires Prometheus >= v2.49.0.", "items": { diff --git a/pkg/apis/monitoring/v1/podmonitor_types.go b/pkg/apis/monitoring/v1/podmonitor_types.go index 5a3ced2f9..a6e2c1605 100644 --- a/pkg/apis/monitoring/v1/podmonitor_types.go +++ b/pkg/apis/monitoring/v1/podmonitor_types.go @@ -123,6 +123,9 @@ type PodMonitorSpec struct { // // +optional LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"` + + NativeHistogramConfig `json:",inline"` + // Per-scrape limit on the number of targets dropped by relabeling // that will be kept in memory. 0 means no limit. // diff --git a/pkg/apis/monitoring/v1/probe_types.go b/pkg/apis/monitoring/v1/probe_types.go index 203f72075..16c927ad6 100644 --- a/pkg/apis/monitoring/v1/probe_types.go +++ b/pkg/apis/monitoring/v1/probe_types.go @@ -112,6 +112,8 @@ type ProbeSpec struct { // Only valid in Prometheus versions 2.27.0 and newer. // +optional LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"` + + NativeHistogramConfig `json:",inline"` // Per-scrape limit on the number of targets dropped by relabeling // that will be kept in memory. 0 means no limit. // diff --git a/pkg/apis/monitoring/v1/servicemonitor_types.go b/pkg/apis/monitoring/v1/servicemonitor_types.go index 2b977a33e..0b40e4a9e 100644 --- a/pkg/apis/monitoring/v1/servicemonitor_types.go +++ b/pkg/apis/monitoring/v1/servicemonitor_types.go @@ -128,6 +128,9 @@ type ServiceMonitorSpec struct { // // +optional LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"` + + NativeHistogramConfig `json:",inline"` + // Per-scrape limit on the number of targets dropped by relabeling // that will be kept in memory. 0 means no limit. // diff --git a/pkg/apis/monitoring/v1/types.go b/pkg/apis/monitoring/v1/types.go index b2b4d4fd0..8b041a936 100644 --- a/pkg/apis/monitoring/v1/types.go +++ b/pkg/apis/monitoring/v1/types.go @@ -20,6 +20,7 @@ import ( "strings" v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/intstr" @@ -880,3 +881,27 @@ const ( RoleEndpointSlice = "endpointslice" RoleIngress = "ingress" ) + +// NativeHistogramConfig extends the native histogram configuration settings. +// +k8s:openapi-gen=true +type NativeHistogramConfig struct { + // Whether to scrape a classic histogram that is also exposed as a native histogram. + // It requires Prometheus >= v2.45.0. + // + // +optional + ScrapeClassicHistograms *bool `json:"scrapeClassicHistograms,omitempty"` + + // If there are more than this many buckets in a native histogram, + // buckets will be merged to stay within the limit. + // It requires Prometheus >= v2.45.0. + // + // +optional + NativeHistogramBucketLimit *uint64 `json:"nativeHistogramBucketLimit,omitempty"` + + // If the growth factor of one bucket to the next is smaller than this, + // buckets will be merged to increase the factor sufficiently. + // It requires Prometheus >= v2.50.0. + // + // +optional + NativeHistogramMinBucketFactor *resource.Quantity `json:"nativeHistogramMinBucketFactor,omitempty"` +} diff --git a/pkg/apis/monitoring/v1/zz_generated.deepcopy.go b/pkg/apis/monitoring/v1/zz_generated.deepcopy.go index a91e496c1..9f345c69a 100644 --- a/pkg/apis/monitoring/v1/zz_generated.deepcopy.go +++ b/pkg/apis/monitoring/v1/zz_generated.deepcopy.go @@ -1436,6 +1436,36 @@ func (in *NamespaceSelector) DeepCopy() *NamespaceSelector { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NativeHistogramConfig) DeepCopyInto(out *NativeHistogramConfig) { + *out = *in + if in.ScrapeClassicHistograms != nil { + in, out := &in.ScrapeClassicHistograms, &out.ScrapeClassicHistograms + *out = new(bool) + **out = **in + } + if in.NativeHistogramBucketLimit != nil { + in, out := &in.NativeHistogramBucketLimit, &out.NativeHistogramBucketLimit + *out = new(uint64) + **out = **in + } + if in.NativeHistogramMinBucketFactor != nil { + in, out := &in.NativeHistogramMinBucketFactor, &out.NativeHistogramMinBucketFactor + x := (*in).DeepCopy() + *out = &x + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NativeHistogramConfig. +func (in *NativeHistogramConfig) DeepCopy() *NativeHistogramConfig { + if in == nil { + return nil + } + out := new(NativeHistogramConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *OAuth2) DeepCopyInto(out *OAuth2) { *out = *in @@ -1767,6 +1797,7 @@ func (in *PodMonitorSpec) DeepCopyInto(out *PodMonitorSpec) { *out = new(uint64) **out = **in } + in.NativeHistogramConfig.DeepCopyInto(&out.NativeHistogramConfig) if in.KeepDroppedTargets != nil { in, out := &in.KeepDroppedTargets, &out.KeepDroppedTargets *out = new(uint64) @@ -1908,6 +1939,7 @@ func (in *ProbeSpec) DeepCopyInto(out *ProbeSpec) { *out = new(uint64) **out = **in } + in.NativeHistogramConfig.DeepCopyInto(&out.NativeHistogramConfig) if in.KeepDroppedTargets != nil { in, out := &in.KeepDroppedTargets, &out.KeepDroppedTargets *out = new(uint64) @@ -3012,6 +3044,7 @@ func (in *ServiceMonitorSpec) DeepCopyInto(out *ServiceMonitorSpec) { *out = new(uint64) **out = **in } + in.NativeHistogramConfig.DeepCopyInto(&out.NativeHistogramConfig) if in.KeepDroppedTargets != nil { in, out := &in.KeepDroppedTargets, &out.KeepDroppedTargets *out = new(uint64) diff --git a/pkg/apis/monitoring/v1alpha1/scrapeconfig_types.go b/pkg/apis/monitoring/v1alpha1/scrapeconfig_types.go index 4e299521d..845c9a6cd 100644 --- a/pkg/apis/monitoring/v1alpha1/scrapeconfig_types.go +++ b/pkg/apis/monitoring/v1alpha1/scrapeconfig_types.go @@ -310,6 +310,8 @@ type ScrapeConfigSpec struct { // Only valid in Prometheus versions 2.27.0 and newer. // +optional LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"` + + v1.NativeHistogramConfig `json:",inline"` // Per-scrape limit on the number of targets dropped by relabeling // that will be kept in memory. 0 means no limit. // diff --git a/pkg/apis/monitoring/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/monitoring/v1alpha1/zz_generated.deepcopy.go index 9f7a35f58..06fef77d7 100644 --- a/pkg/apis/monitoring/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/monitoring/v1alpha1/zz_generated.deepcopy.go @@ -2573,6 +2573,7 @@ func (in *ScrapeConfigSpec) DeepCopyInto(out *ScrapeConfigSpec) { *out = new(uint64) **out = **in } + in.NativeHistogramConfig.DeepCopyInto(&out.NativeHistogramConfig) if in.KeepDroppedTargets != nil { in, out := &in.KeepDroppedTargets, &out.KeepDroppedTargets *out = new(uint64) diff --git a/pkg/client/applyconfiguration/monitoring/v1/nativehistogramconfig.go b/pkg/client/applyconfiguration/monitoring/v1/nativehistogramconfig.go new file mode 100644 index 000000000..15df68b96 --- /dev/null +++ b/pkg/client/applyconfiguration/monitoring/v1/nativehistogramconfig.go @@ -0,0 +1,59 @@ +// Copyright The prometheus-operator Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// NativeHistogramConfigApplyConfiguration represents a declarative configuration of the NativeHistogramConfig type for use +// with apply. +type NativeHistogramConfigApplyConfiguration struct { + ScrapeClassicHistograms *bool `json:"scrapeClassicHistograms,omitempty"` + NativeHistogramBucketLimit *uint64 `json:"nativeHistogramBucketLimit,omitempty"` + NativeHistogramMinBucketFactor *resource.Quantity `json:"nativeHistogramMinBucketFactor,omitempty"` +} + +// NativeHistogramConfigApplyConfiguration constructs a declarative configuration of the NativeHistogramConfig type for use with +// apply. +func NativeHistogramConfig() *NativeHistogramConfigApplyConfiguration { + return &NativeHistogramConfigApplyConfiguration{} +} + +// WithScrapeClassicHistograms sets the ScrapeClassicHistograms 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 ScrapeClassicHistograms field is set to the value of the last call. +func (b *NativeHistogramConfigApplyConfiguration) WithScrapeClassicHistograms(value bool) *NativeHistogramConfigApplyConfiguration { + b.ScrapeClassicHistograms = &value + return b +} + +// WithNativeHistogramBucketLimit sets the NativeHistogramBucketLimit 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 NativeHistogramBucketLimit field is set to the value of the last call. +func (b *NativeHistogramConfigApplyConfiguration) WithNativeHistogramBucketLimit(value uint64) *NativeHistogramConfigApplyConfiguration { + b.NativeHistogramBucketLimit = &value + return b +} + +// WithNativeHistogramMinBucketFactor sets the NativeHistogramMinBucketFactor 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 NativeHistogramMinBucketFactor field is set to the value of the last call. +func (b *NativeHistogramConfigApplyConfiguration) WithNativeHistogramMinBucketFactor(value resource.Quantity) *NativeHistogramConfigApplyConfiguration { + b.NativeHistogramMinBucketFactor = &value + return b +} diff --git a/pkg/client/applyconfiguration/monitoring/v1/podmonitorspec.go b/pkg/client/applyconfiguration/monitoring/v1/podmonitorspec.go index ef05121bd..d2e0a5cc6 100644 --- a/pkg/client/applyconfiguration/monitoring/v1/podmonitorspec.go +++ b/pkg/client/applyconfiguration/monitoring/v1/podmonitorspec.go @@ -18,27 +18,29 @@ package v1 import ( monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" + resource "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/client-go/applyconfigurations/meta/v1" ) // PodMonitorSpecApplyConfiguration represents a declarative configuration of the PodMonitorSpec type for use // with apply. type PodMonitorSpecApplyConfiguration struct { - JobLabel *string `json:"jobLabel,omitempty"` - PodTargetLabels []string `json:"podTargetLabels,omitempty"` - PodMetricsEndpoints []PodMetricsEndpointApplyConfiguration `json:"podMetricsEndpoints,omitempty"` - Selector *metav1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` - NamespaceSelector *NamespaceSelectorApplyConfiguration `json:"namespaceSelector,omitempty"` - SampleLimit *uint64 `json:"sampleLimit,omitempty"` - TargetLimit *uint64 `json:"targetLimit,omitempty"` - ScrapeProtocols []monitoringv1.ScrapeProtocol `json:"scrapeProtocols,omitempty"` - LabelLimit *uint64 `json:"labelLimit,omitempty"` - LabelNameLengthLimit *uint64 `json:"labelNameLengthLimit,omitempty"` - LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"` - KeepDroppedTargets *uint64 `json:"keepDroppedTargets,omitempty"` - AttachMetadata *AttachMetadataApplyConfiguration `json:"attachMetadata,omitempty"` - ScrapeClassName *string `json:"scrapeClass,omitempty"` - BodySizeLimit *monitoringv1.ByteSize `json:"bodySizeLimit,omitempty"` + JobLabel *string `json:"jobLabel,omitempty"` + PodTargetLabels []string `json:"podTargetLabels,omitempty"` + PodMetricsEndpoints []PodMetricsEndpointApplyConfiguration `json:"podMetricsEndpoints,omitempty"` + Selector *metav1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` + NamespaceSelector *NamespaceSelectorApplyConfiguration `json:"namespaceSelector,omitempty"` + SampleLimit *uint64 `json:"sampleLimit,omitempty"` + TargetLimit *uint64 `json:"targetLimit,omitempty"` + ScrapeProtocols []monitoringv1.ScrapeProtocol `json:"scrapeProtocols,omitempty"` + LabelLimit *uint64 `json:"labelLimit,omitempty"` + LabelNameLengthLimit *uint64 `json:"labelNameLengthLimit,omitempty"` + LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"` + NativeHistogramConfigApplyConfiguration `json:",inline"` + KeepDroppedTargets *uint64 `json:"keepDroppedTargets,omitempty"` + AttachMetadata *AttachMetadataApplyConfiguration `json:"attachMetadata,omitempty"` + ScrapeClassName *string `json:"scrapeClass,omitempty"` + BodySizeLimit *monitoringv1.ByteSize `json:"bodySizeLimit,omitempty"` } // PodMonitorSpecApplyConfiguration constructs a declarative configuration of the PodMonitorSpec type for use with @@ -144,6 +146,30 @@ func (b *PodMonitorSpecApplyConfiguration) WithLabelValueLengthLimit(value uint6 return b } +// WithScrapeClassicHistograms sets the ScrapeClassicHistograms 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 ScrapeClassicHistograms field is set to the value of the last call. +func (b *PodMonitorSpecApplyConfiguration) WithScrapeClassicHistograms(value bool) *PodMonitorSpecApplyConfiguration { + b.ScrapeClassicHistograms = &value + return b +} + +// WithNativeHistogramBucketLimit sets the NativeHistogramBucketLimit 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 NativeHistogramBucketLimit field is set to the value of the last call. +func (b *PodMonitorSpecApplyConfiguration) WithNativeHistogramBucketLimit(value uint64) *PodMonitorSpecApplyConfiguration { + b.NativeHistogramBucketLimit = &value + return b +} + +// WithNativeHistogramMinBucketFactor sets the NativeHistogramMinBucketFactor 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 NativeHistogramMinBucketFactor field is set to the value of the last call. +func (b *PodMonitorSpecApplyConfiguration) WithNativeHistogramMinBucketFactor(value resource.Quantity) *PodMonitorSpecApplyConfiguration { + b.NativeHistogramMinBucketFactor = &value + return b +} + // WithKeepDroppedTargets sets the KeepDroppedTargets 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 KeepDroppedTargets field is set to the value of the last call. diff --git a/pkg/client/applyconfiguration/monitoring/v1/probespec.go b/pkg/client/applyconfiguration/monitoring/v1/probespec.go index 33fffd9af..cd65bf29b 100644 --- a/pkg/client/applyconfiguration/monitoring/v1/probespec.go +++ b/pkg/client/applyconfiguration/monitoring/v1/probespec.go @@ -19,31 +19,33 @@ package v1 import ( monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" corev1 "k8s.io/api/core/v1" + resource "k8s.io/apimachinery/pkg/api/resource" ) // ProbeSpecApplyConfiguration represents a declarative configuration of the ProbeSpec type for use // with apply. type ProbeSpecApplyConfiguration struct { - JobName *string `json:"jobName,omitempty"` - ProberSpec *ProberSpecApplyConfiguration `json:"prober,omitempty"` - Module *string `json:"module,omitempty"` - Targets *ProbeTargetsApplyConfiguration `json:"targets,omitempty"` - Interval *monitoringv1.Duration `json:"interval,omitempty"` - ScrapeTimeout *monitoringv1.Duration `json:"scrapeTimeout,omitempty"` - TLSConfig *SafeTLSConfigApplyConfiguration `json:"tlsConfig,omitempty"` - BearerTokenSecret *corev1.SecretKeySelector `json:"bearerTokenSecret,omitempty"` - BasicAuth *BasicAuthApplyConfiguration `json:"basicAuth,omitempty"` - OAuth2 *OAuth2ApplyConfiguration `json:"oauth2,omitempty"` - MetricRelabelConfigs []RelabelConfigApplyConfiguration `json:"metricRelabelings,omitempty"` - Authorization *SafeAuthorizationApplyConfiguration `json:"authorization,omitempty"` - SampleLimit *uint64 `json:"sampleLimit,omitempty"` - TargetLimit *uint64 `json:"targetLimit,omitempty"` - ScrapeProtocols []monitoringv1.ScrapeProtocol `json:"scrapeProtocols,omitempty"` - LabelLimit *uint64 `json:"labelLimit,omitempty"` - LabelNameLengthLimit *uint64 `json:"labelNameLengthLimit,omitempty"` - LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"` - KeepDroppedTargets *uint64 `json:"keepDroppedTargets,omitempty"` - ScrapeClassName *string `json:"scrapeClass,omitempty"` + JobName *string `json:"jobName,omitempty"` + ProberSpec *ProberSpecApplyConfiguration `json:"prober,omitempty"` + Module *string `json:"module,omitempty"` + Targets *ProbeTargetsApplyConfiguration `json:"targets,omitempty"` + Interval *monitoringv1.Duration `json:"interval,omitempty"` + ScrapeTimeout *monitoringv1.Duration `json:"scrapeTimeout,omitempty"` + TLSConfig *SafeTLSConfigApplyConfiguration `json:"tlsConfig,omitempty"` + BearerTokenSecret *corev1.SecretKeySelector `json:"bearerTokenSecret,omitempty"` + BasicAuth *BasicAuthApplyConfiguration `json:"basicAuth,omitempty"` + OAuth2 *OAuth2ApplyConfiguration `json:"oauth2,omitempty"` + MetricRelabelConfigs []RelabelConfigApplyConfiguration `json:"metricRelabelings,omitempty"` + Authorization *SafeAuthorizationApplyConfiguration `json:"authorization,omitempty"` + SampleLimit *uint64 `json:"sampleLimit,omitempty"` + TargetLimit *uint64 `json:"targetLimit,omitempty"` + ScrapeProtocols []monitoringv1.ScrapeProtocol `json:"scrapeProtocols,omitempty"` + LabelLimit *uint64 `json:"labelLimit,omitempty"` + LabelNameLengthLimit *uint64 `json:"labelNameLengthLimit,omitempty"` + LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"` + NativeHistogramConfigApplyConfiguration `json:",inline"` + KeepDroppedTargets *uint64 `json:"keepDroppedTargets,omitempty"` + ScrapeClassName *string `json:"scrapeClass,omitempty"` } // ProbeSpecApplyConfiguration constructs a declarative configuration of the ProbeSpec type for use with @@ -203,6 +205,30 @@ func (b *ProbeSpecApplyConfiguration) WithLabelValueLengthLimit(value uint64) *P return b } +// WithScrapeClassicHistograms sets the ScrapeClassicHistograms 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 ScrapeClassicHistograms field is set to the value of the last call. +func (b *ProbeSpecApplyConfiguration) WithScrapeClassicHistograms(value bool) *ProbeSpecApplyConfiguration { + b.ScrapeClassicHistograms = &value + return b +} + +// WithNativeHistogramBucketLimit sets the NativeHistogramBucketLimit 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 NativeHistogramBucketLimit field is set to the value of the last call. +func (b *ProbeSpecApplyConfiguration) WithNativeHistogramBucketLimit(value uint64) *ProbeSpecApplyConfiguration { + b.NativeHistogramBucketLimit = &value + return b +} + +// WithNativeHistogramMinBucketFactor sets the NativeHistogramMinBucketFactor 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 NativeHistogramMinBucketFactor field is set to the value of the last call. +func (b *ProbeSpecApplyConfiguration) WithNativeHistogramMinBucketFactor(value resource.Quantity) *ProbeSpecApplyConfiguration { + b.NativeHistogramMinBucketFactor = &value + return b +} + // WithKeepDroppedTargets sets the KeepDroppedTargets 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 KeepDroppedTargets field is set to the value of the last call. diff --git a/pkg/client/applyconfiguration/monitoring/v1/servicemonitorspec.go b/pkg/client/applyconfiguration/monitoring/v1/servicemonitorspec.go index 88fad3457..9c3cf14d6 100644 --- a/pkg/client/applyconfiguration/monitoring/v1/servicemonitorspec.go +++ b/pkg/client/applyconfiguration/monitoring/v1/servicemonitorspec.go @@ -18,28 +18,30 @@ package v1 import ( monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" + resource "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/client-go/applyconfigurations/meta/v1" ) // ServiceMonitorSpecApplyConfiguration represents a declarative configuration of the ServiceMonitorSpec type for use // with apply. type ServiceMonitorSpecApplyConfiguration struct { - JobLabel *string `json:"jobLabel,omitempty"` - TargetLabels []string `json:"targetLabels,omitempty"` - PodTargetLabels []string `json:"podTargetLabels,omitempty"` - Endpoints []EndpointApplyConfiguration `json:"endpoints,omitempty"` - Selector *metav1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` - NamespaceSelector *NamespaceSelectorApplyConfiguration `json:"namespaceSelector,omitempty"` - SampleLimit *uint64 `json:"sampleLimit,omitempty"` - ScrapeProtocols []monitoringv1.ScrapeProtocol `json:"scrapeProtocols,omitempty"` - TargetLimit *uint64 `json:"targetLimit,omitempty"` - LabelLimit *uint64 `json:"labelLimit,omitempty"` - LabelNameLengthLimit *uint64 `json:"labelNameLengthLimit,omitempty"` - LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"` - KeepDroppedTargets *uint64 `json:"keepDroppedTargets,omitempty"` - AttachMetadata *AttachMetadataApplyConfiguration `json:"attachMetadata,omitempty"` - ScrapeClassName *string `json:"scrapeClass,omitempty"` - BodySizeLimit *monitoringv1.ByteSize `json:"bodySizeLimit,omitempty"` + JobLabel *string `json:"jobLabel,omitempty"` + TargetLabels []string `json:"targetLabels,omitempty"` + PodTargetLabels []string `json:"podTargetLabels,omitempty"` + Endpoints []EndpointApplyConfiguration `json:"endpoints,omitempty"` + Selector *metav1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` + NamespaceSelector *NamespaceSelectorApplyConfiguration `json:"namespaceSelector,omitempty"` + SampleLimit *uint64 `json:"sampleLimit,omitempty"` + ScrapeProtocols []monitoringv1.ScrapeProtocol `json:"scrapeProtocols,omitempty"` + TargetLimit *uint64 `json:"targetLimit,omitempty"` + LabelLimit *uint64 `json:"labelLimit,omitempty"` + LabelNameLengthLimit *uint64 `json:"labelNameLengthLimit,omitempty"` + LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"` + NativeHistogramConfigApplyConfiguration `json:",inline"` + KeepDroppedTargets *uint64 `json:"keepDroppedTargets,omitempty"` + AttachMetadata *AttachMetadataApplyConfiguration `json:"attachMetadata,omitempty"` + ScrapeClassName *string `json:"scrapeClass,omitempty"` + BodySizeLimit *monitoringv1.ByteSize `json:"bodySizeLimit,omitempty"` } // ServiceMonitorSpecApplyConfiguration constructs a declarative configuration of the ServiceMonitorSpec type for use with @@ -155,6 +157,30 @@ func (b *ServiceMonitorSpecApplyConfiguration) WithLabelValueLengthLimit(value u return b } +// WithScrapeClassicHistograms sets the ScrapeClassicHistograms 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 ScrapeClassicHistograms field is set to the value of the last call. +func (b *ServiceMonitorSpecApplyConfiguration) WithScrapeClassicHistograms(value bool) *ServiceMonitorSpecApplyConfiguration { + b.ScrapeClassicHistograms = &value + return b +} + +// WithNativeHistogramBucketLimit sets the NativeHistogramBucketLimit 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 NativeHistogramBucketLimit field is set to the value of the last call. +func (b *ServiceMonitorSpecApplyConfiguration) WithNativeHistogramBucketLimit(value uint64) *ServiceMonitorSpecApplyConfiguration { + b.NativeHistogramBucketLimit = &value + return b +} + +// WithNativeHistogramMinBucketFactor sets the NativeHistogramMinBucketFactor 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 NativeHistogramMinBucketFactor field is set to the value of the last call. +func (b *ServiceMonitorSpecApplyConfiguration) WithNativeHistogramMinBucketFactor(value resource.Quantity) *ServiceMonitorSpecApplyConfiguration { + b.NativeHistogramMinBucketFactor = &value + return b +} + // WithKeepDroppedTargets sets the KeepDroppedTargets 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 KeepDroppedTargets field is set to the value of the last call. diff --git a/pkg/client/applyconfiguration/monitoring/v1alpha1/scrapeconfigspec.go b/pkg/client/applyconfiguration/monitoring/v1alpha1/scrapeconfigspec.go index d4cc904c6..f0407a247 100644 --- a/pkg/client/applyconfiguration/monitoring/v1alpha1/scrapeconfigspec.go +++ b/pkg/client/applyconfiguration/monitoring/v1alpha1/scrapeconfigspec.go @@ -20,59 +20,61 @@ import ( monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" v1 "github.com/prometheus-operator/prometheus-operator/pkg/client/applyconfiguration/monitoring/v1" corev1 "k8s.io/api/core/v1" + resource "k8s.io/apimachinery/pkg/api/resource" ) // ScrapeConfigSpecApplyConfiguration represents a declarative configuration of the ScrapeConfigSpec type for use // with apply. type ScrapeConfigSpecApplyConfiguration struct { - JobName *string `json:"jobName,omitempty"` - StaticConfigs []StaticConfigApplyConfiguration `json:"staticConfigs,omitempty"` - FileSDConfigs []FileSDConfigApplyConfiguration `json:"fileSDConfigs,omitempty"` - HTTPSDConfigs []HTTPSDConfigApplyConfiguration `json:"httpSDConfigs,omitempty"` - KubernetesSDConfigs []KubernetesSDConfigApplyConfiguration `json:"kubernetesSDConfigs,omitempty"` - ConsulSDConfigs []ConsulSDConfigApplyConfiguration `json:"consulSDConfigs,omitempty"` - DNSSDConfigs []DNSSDConfigApplyConfiguration `json:"dnsSDConfigs,omitempty"` - EC2SDConfigs []EC2SDConfigApplyConfiguration `json:"ec2SDConfigs,omitempty"` - AzureSDConfigs []AzureSDConfigApplyConfiguration `json:"azureSDConfigs,omitempty"` - GCESDConfigs []GCESDConfigApplyConfiguration `json:"gceSDConfigs,omitempty"` - OpenStackSDConfigs []OpenStackSDConfigApplyConfiguration `json:"openstackSDConfigs,omitempty"` - DigitalOceanSDConfigs []DigitalOceanSDConfigApplyConfiguration `json:"digitalOceanSDConfigs,omitempty"` - KumaSDConfigs []KumaSDConfigApplyConfiguration `json:"kumaSDConfigs,omitempty"` - EurekaSDConfigs []EurekaSDConfigApplyConfiguration `json:"eurekaSDConfigs,omitempty"` - DockerSDConfigs []DockerSDConfigApplyConfiguration `json:"dockerSDConfigs,omitempty"` - LinodeSDConfigs []LinodeSDConfigApplyConfiguration `json:"linodeSDConfigs,omitempty"` - HetznerSDConfigs []HetznerSDConfigApplyConfiguration `json:"hetznerSDConfigs,omitempty"` - NomadSDConfigs []NomadSDConfigApplyConfiguration `json:"nomadSDConfigs,omitempty"` - DockerSwarmSDConfigs []DockerSwarmSDConfigApplyConfiguration `json:"dockerSwarmSDConfigs,omitempty"` - PuppetDBSDConfigs []PuppetDBSDConfigApplyConfiguration `json:"puppetDBSDConfigs,omitempty"` - LightSailSDConfigs []LightSailSDConfigApplyConfiguration `json:"lightSailSDConfigs,omitempty"` - OVHCloudSDConfigs []OVHCloudSDConfigApplyConfiguration `json:"ovhcloudSDConfigs,omitempty"` - ScalewaySDConfigs []ScalewaySDConfigApplyConfiguration `json:"scalewaySDConfigs,omitempty"` - IonosSDConfigs []IonosSDConfigApplyConfiguration `json:"ionosSDConfigs,omitempty"` - RelabelConfigs []v1.RelabelConfigApplyConfiguration `json:"relabelings,omitempty"` - MetricsPath *string `json:"metricsPath,omitempty"` - ScrapeInterval *monitoringv1.Duration `json:"scrapeInterval,omitempty"` - ScrapeTimeout *monitoringv1.Duration `json:"scrapeTimeout,omitempty"` - ScrapeProtocols []monitoringv1.ScrapeProtocol `json:"scrapeProtocols,omitempty"` - HonorTimestamps *bool `json:"honorTimestamps,omitempty"` - TrackTimestampsStaleness *bool `json:"trackTimestampsStaleness,omitempty"` - HonorLabels *bool `json:"honorLabels,omitempty"` - Params map[string][]string `json:"params,omitempty"` - Scheme *string `json:"scheme,omitempty"` - EnableCompression *bool `json:"enableCompression,omitempty"` - BasicAuth *v1.BasicAuthApplyConfiguration `json:"basicAuth,omitempty"` - Authorization *v1.SafeAuthorizationApplyConfiguration `json:"authorization,omitempty"` - OAuth2 *v1.OAuth2ApplyConfiguration `json:"oauth2,omitempty"` - TLSConfig *v1.SafeTLSConfigApplyConfiguration `json:"tlsConfig,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"` - KeepDroppedTargets *uint64 `json:"keepDroppedTargets,omitempty"` - MetricRelabelConfigs []v1.RelabelConfigApplyConfiguration `json:"metricRelabelings,omitempty"` - v1.ProxyConfigApplyConfiguration `json:",inline"` - ScrapeClassName *string `json:"scrapeClass,omitempty"` + JobName *string `json:"jobName,omitempty"` + StaticConfigs []StaticConfigApplyConfiguration `json:"staticConfigs,omitempty"` + FileSDConfigs []FileSDConfigApplyConfiguration `json:"fileSDConfigs,omitempty"` + HTTPSDConfigs []HTTPSDConfigApplyConfiguration `json:"httpSDConfigs,omitempty"` + KubernetesSDConfigs []KubernetesSDConfigApplyConfiguration `json:"kubernetesSDConfigs,omitempty"` + ConsulSDConfigs []ConsulSDConfigApplyConfiguration `json:"consulSDConfigs,omitempty"` + DNSSDConfigs []DNSSDConfigApplyConfiguration `json:"dnsSDConfigs,omitempty"` + EC2SDConfigs []EC2SDConfigApplyConfiguration `json:"ec2SDConfigs,omitempty"` + AzureSDConfigs []AzureSDConfigApplyConfiguration `json:"azureSDConfigs,omitempty"` + GCESDConfigs []GCESDConfigApplyConfiguration `json:"gceSDConfigs,omitempty"` + OpenStackSDConfigs []OpenStackSDConfigApplyConfiguration `json:"openstackSDConfigs,omitempty"` + DigitalOceanSDConfigs []DigitalOceanSDConfigApplyConfiguration `json:"digitalOceanSDConfigs,omitempty"` + KumaSDConfigs []KumaSDConfigApplyConfiguration `json:"kumaSDConfigs,omitempty"` + EurekaSDConfigs []EurekaSDConfigApplyConfiguration `json:"eurekaSDConfigs,omitempty"` + DockerSDConfigs []DockerSDConfigApplyConfiguration `json:"dockerSDConfigs,omitempty"` + LinodeSDConfigs []LinodeSDConfigApplyConfiguration `json:"linodeSDConfigs,omitempty"` + HetznerSDConfigs []HetznerSDConfigApplyConfiguration `json:"hetznerSDConfigs,omitempty"` + NomadSDConfigs []NomadSDConfigApplyConfiguration `json:"nomadSDConfigs,omitempty"` + DockerSwarmSDConfigs []DockerSwarmSDConfigApplyConfiguration `json:"dockerSwarmSDConfigs,omitempty"` + PuppetDBSDConfigs []PuppetDBSDConfigApplyConfiguration `json:"puppetDBSDConfigs,omitempty"` + LightSailSDConfigs []LightSailSDConfigApplyConfiguration `json:"lightSailSDConfigs,omitempty"` + OVHCloudSDConfigs []OVHCloudSDConfigApplyConfiguration `json:"ovhcloudSDConfigs,omitempty"` + ScalewaySDConfigs []ScalewaySDConfigApplyConfiguration `json:"scalewaySDConfigs,omitempty"` + IonosSDConfigs []IonosSDConfigApplyConfiguration `json:"ionosSDConfigs,omitempty"` + RelabelConfigs []v1.RelabelConfigApplyConfiguration `json:"relabelings,omitempty"` + MetricsPath *string `json:"metricsPath,omitempty"` + ScrapeInterval *monitoringv1.Duration `json:"scrapeInterval,omitempty"` + ScrapeTimeout *monitoringv1.Duration `json:"scrapeTimeout,omitempty"` + ScrapeProtocols []monitoringv1.ScrapeProtocol `json:"scrapeProtocols,omitempty"` + HonorTimestamps *bool `json:"honorTimestamps,omitempty"` + TrackTimestampsStaleness *bool `json:"trackTimestampsStaleness,omitempty"` + HonorLabels *bool `json:"honorLabels,omitempty"` + Params map[string][]string `json:"params,omitempty"` + Scheme *string `json:"scheme,omitempty"` + EnableCompression *bool `json:"enableCompression,omitempty"` + BasicAuth *v1.BasicAuthApplyConfiguration `json:"basicAuth,omitempty"` + Authorization *v1.SafeAuthorizationApplyConfiguration `json:"authorization,omitempty"` + OAuth2 *v1.OAuth2ApplyConfiguration `json:"oauth2,omitempty"` + TLSConfig *v1.SafeTLSConfigApplyConfiguration `json:"tlsConfig,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"` + v1.NativeHistogramConfigApplyConfiguration `json:",inline"` + KeepDroppedTargets *uint64 `json:"keepDroppedTargets,omitempty"` + MetricRelabelConfigs []v1.RelabelConfigApplyConfiguration `json:"metricRelabelings,omitempty"` + v1.ProxyConfigApplyConfiguration `json:",inline"` + ScrapeClassName *string `json:"scrapeClass,omitempty"` } // ScrapeConfigSpecApplyConfiguration constructs a declarative configuration of the ScrapeConfigSpec type for use with @@ -561,6 +563,30 @@ func (b *ScrapeConfigSpecApplyConfiguration) WithLabelValueLengthLimit(value uin return b } +// WithScrapeClassicHistograms sets the ScrapeClassicHistograms 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 ScrapeClassicHistograms field is set to the value of the last call. +func (b *ScrapeConfigSpecApplyConfiguration) WithScrapeClassicHistograms(value bool) *ScrapeConfigSpecApplyConfiguration { + b.ScrapeClassicHistograms = &value + return b +} + +// WithNativeHistogramBucketLimit sets the NativeHistogramBucketLimit 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 NativeHistogramBucketLimit field is set to the value of the last call. +func (b *ScrapeConfigSpecApplyConfiguration) WithNativeHistogramBucketLimit(value uint64) *ScrapeConfigSpecApplyConfiguration { + b.NativeHistogramBucketLimit = &value + return b +} + +// WithNativeHistogramMinBucketFactor sets the NativeHistogramMinBucketFactor 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 NativeHistogramMinBucketFactor field is set to the value of the last call. +func (b *ScrapeConfigSpecApplyConfiguration) WithNativeHistogramMinBucketFactor(value resource.Quantity) *ScrapeConfigSpecApplyConfiguration { + b.NativeHistogramMinBucketFactor = &value + return b +} + // WithKeepDroppedTargets sets the KeepDroppedTargets 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 KeepDroppedTargets field is set to the value of the last call. diff --git a/pkg/client/applyconfiguration/utils.go b/pkg/client/applyconfiguration/utils.go index f82b321fe..759c1a67c 100644 --- a/pkg/client/applyconfiguration/utils.go +++ b/pkg/client/applyconfiguration/utils.go @@ -98,6 +98,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &monitoringv1.MetadataConfigApplyConfiguration{} case v1.SchemeGroupVersion.WithKind("NamespaceSelector"): return &monitoringv1.NamespaceSelectorApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("NativeHistogramConfig"): + return &monitoringv1.NativeHistogramConfigApplyConfiguration{} case v1.SchemeGroupVersion.WithKind("OAuth2"): return &monitoringv1.OAuth2ApplyConfiguration{} case v1.SchemeGroupVersion.WithKind("ObjectReference"): diff --git a/pkg/prometheus/promcfg.go b/pkg/prometheus/promcfg.go index 27936b354..d00cd1f9c 100644 --- a/pkg/prometheus/promcfg.go +++ b/pkg/prometheus/promcfg.go @@ -383,6 +383,27 @@ func (cg *ConfigGenerator) AddHonorLabels(cfg yaml.MapSlice, honorLabels bool) y return cg.AppendMapItem(cfg, "honor_labels", honorLabels) } +// addNativeHistogramConfig adds the native histogram field into scrape configurations. +func (cg *ConfigGenerator) addNativeHistogramConfig(cfg yaml.MapSlice, nhc monitoringv1.NativeHistogramConfig) yaml.MapSlice { + if reflect.ValueOf(nhc).IsZero() { + return cfg + } + + if nhc.NativeHistogramBucketLimit != nil { + cfg = cg.WithMinimumVersion("2.45.0").AppendMapItem(cfg, "native_histogram_bucket_limit", nhc.NativeHistogramBucketLimit) + } + + if nhc.NativeHistogramMinBucketFactor != nil { + cfg = cg.WithMinimumVersion("2.50.0").AppendMapItem(cfg, "native_histogram_min_bucket_factor", nhc.NativeHistogramMinBucketFactor.AsApproximateFloat64()) + } + + if nhc.ScrapeClassicHistograms != nil { + cfg = cg.WithMinimumVersion("2.45.0").AppendMapItem(cfg, "scrape_classic_histograms", nhc.ScrapeClassicHistograms) + } + + return cfg +} + // stringMapToMapSlice returns a yaml.MapSlice from a string map to ensure that // the output is deterministic. func stringMapToMapSlice[V any](m map[string]V) yaml.MapSlice { @@ -1150,6 +1171,7 @@ func (cg *ConfigGenerator) generatePodMonitorConfig( cfg = cg.AddLimitsToYAML(cfg, labelNameLengthLimitKey, m.Spec.LabelNameLengthLimit, cpf.EnforcedLabelNameLengthLimit) cfg = cg.AddLimitsToYAML(cfg, labelValueLengthLimitKey, m.Spec.LabelValueLengthLimit, cpf.EnforcedLabelValueLengthLimit) cfg = cg.AddLimitsToYAML(cfg, keepDroppedTargetsKey, m.Spec.KeepDroppedTargets, cpf.EnforcedKeepDroppedTargets) + cfg = cg.addNativeHistogramConfig(cfg, m.Spec.NativeHistogramConfig) cfg = cg.AddScrapeProtocols(cfg, m.Spec.ScrapeProtocols) if bodySizeLimit := getLowerByteSize(m.Spec.BodySizeLimit, &cpf); !isByteSizeEmpty(bodySizeLimit) { @@ -1217,6 +1239,7 @@ func (cg *ConfigGenerator) generateProbeConfig( cfg = cg.AddLimitsToYAML(cfg, labelNameLengthLimitKey, m.Spec.LabelNameLengthLimit, cpf.EnforcedLabelNameLengthLimit) cfg = cg.AddLimitsToYAML(cfg, labelValueLengthLimitKey, m.Spec.LabelValueLengthLimit, cpf.EnforcedLabelValueLengthLimit) cfg = cg.AddLimitsToYAML(cfg, keepDroppedTargetsKey, m.Spec.KeepDroppedTargets, cpf.EnforcedKeepDroppedTargets) + cfg = cg.addNativeHistogramConfig(cfg, m.Spec.NativeHistogramConfig) cfg = cg.AddScrapeProtocols(cfg, m.Spec.ScrapeProtocols) if cpf.EnforcedBodySizeLimit != "" { @@ -1665,6 +1688,7 @@ func (cg *ConfigGenerator) generateServiceMonitorConfig( cfg = cg.AddLimitsToYAML(cfg, labelNameLengthLimitKey, m.Spec.LabelNameLengthLimit, cpf.EnforcedLabelNameLengthLimit) cfg = cg.AddLimitsToYAML(cfg, labelValueLengthLimitKey, m.Spec.LabelValueLengthLimit, cpf.EnforcedLabelValueLengthLimit) cfg = cg.AddLimitsToYAML(cfg, keepDroppedTargetsKey, m.Spec.KeepDroppedTargets, cpf.EnforcedKeepDroppedTargets) + cfg = cg.addNativeHistogramConfig(cfg, m.Spec.NativeHistogramConfig) cfg = cg.AddScrapeProtocols(cfg, m.Spec.ScrapeProtocols) if bodySizeLimit := getLowerByteSize(m.Spec.BodySizeLimit, &cpf); !isByteSizeEmpty(bodySizeLimit) { @@ -2426,7 +2450,6 @@ func (cg *ConfigGenerator) appendScrapeLimits(slice yaml.MapSlice) yaml.MapSlice slice = cg.WithMinimumVersion("2.45.0").appendGlobalLimits(slice, "label_name_length_limit", cpf.LabelNameLengthLimit, cpf.EnforcedLabelNameLengthLimit) slice = cg.WithMinimumVersion("2.45.0").appendGlobalLimits(slice, "label_value_length_limit", cpf.LabelValueLengthLimit, cpf.EnforcedLabelValueLengthLimit) slice = cg.WithMinimumVersion("2.47.0").appendGlobalLimits(slice, "keep_dropped_targets", cpf.KeepDroppedTargets, cpf.EnforcedKeepDroppedTargets) - return slice } @@ -2746,6 +2769,7 @@ func (cg *ConfigGenerator) generateScrapeConfig( cfg = cg.AddLimitsToYAML(cfg, labelNameLengthLimitKey, sc.Spec.LabelNameLengthLimit, cpf.EnforcedLabelNameLengthLimit) cfg = cg.AddLimitsToYAML(cfg, labelValueLengthLimitKey, sc.Spec.LabelValueLengthLimit, cpf.EnforcedLabelValueLengthLimit) cfg = cg.AddLimitsToYAML(cfg, keepDroppedTargetsKey, sc.Spec.KeepDroppedTargets, cpf.EnforcedKeepDroppedTargets) + cfg = cg.addNativeHistogramConfig(cfg, sc.Spec.NativeHistogramConfig) if cpf.EnforcedBodySizeLimit != "" { cfg = cg.WithMinimumVersion("2.28.0").AppendMapItem(cfg, "body_size_limit", cpf.EnforcedBodySizeLimit) diff --git a/pkg/prometheus/promcfg_test.go b/pkg/prometheus/promcfg_test.go index 628f24a5f..49f79f5b7 100644 --- a/pkg/prometheus/promcfg_test.go +++ b/pkg/prometheus/promcfg_test.go @@ -4538,6 +4538,85 @@ func TestKeepDroppedTargets(t *testing.T) { } } +func TestNativeHistogramConfig(t *testing.T) { + for _, tc := range []struct { + version string + nativeHistogramConfig monitoringv1.NativeHistogramConfig + golden string + }{ + { + version: "v2.54.0", + nativeHistogramConfig: monitoringv1.NativeHistogramConfig{ + NativeHistogramBucketLimit: ptr.To(uint64(10)), + ScrapeClassicHistograms: ptr.To(true), + NativeHistogramMinBucketFactor: ptr.To(resource.MustParse("12.124")), + }, + golden: "NativeHistogramConfig.golden", + }, + { + version: "v2.46.0", + nativeHistogramConfig: monitoringv1.NativeHistogramConfig{ + NativeHistogramBucketLimit: ptr.To(uint64(10)), + ScrapeClassicHistograms: ptr.To(true), + NativeHistogramMinBucketFactor: ptr.To(resource.MustParse("12.124")), + }, + golden: "NativeHistogramConfigWithMissNativeHistogramMinBucketFactor.golden", + }, + { + version: "v2.44.0", + nativeHistogramConfig: monitoringv1.NativeHistogramConfig{ + NativeHistogramBucketLimit: ptr.To(uint64(10)), + ScrapeClassicHistograms: ptr.To(true), + NativeHistogramMinBucketFactor: ptr.To(resource.MustParse("12.124")), + }, + golden: "NativeHistogramConfigWithMissALL.golden", + }, + } { + t.Run(fmt.Sprintf("version=%s", tc.version), func(t *testing.T) { + p := defaultPrometheus() + p.Spec.CommonPrometheusFields.Version = tc.version + + serviceMonitor := monitoringv1.ServiceMonitor{ + ObjectMeta: metav1.ObjectMeta{ + Name: "testservicemonitor1", + Namespace: "default", + Labels: map[string]string{ + "group": "group1", + }, + }, + Spec: monitoringv1.ServiceMonitorSpec{ + Endpoints: []monitoringv1.Endpoint{ + { + Port: "web", + Interval: "30s", + }, + }, + }, + } + + serviceMonitor.Spec.NativeHistogramConfig = tc.nativeHistogramConfig + + cg := mustNewConfigGenerator(t, p) + cfg, err := cg.GenerateServerConfiguration( + p, + map[string]*monitoringv1.ServiceMonitor{ + "testservicemonitor1": &serviceMonitor, + }, + nil, + nil, + nil, + &assets.StoreBuilder{}, + nil, + nil, + nil, + nil, + ) + require.NoError(t, err) + golden.Assert(t, string(cfg), tc.golden) + }) + } +} + func TestBodySizeLimits(t *testing.T) { for _, tc := range []struct { version string diff --git a/pkg/prometheus/testdata/NativeHistogramConfig.golden b/pkg/prometheus/testdata/NativeHistogramConfig.golden new file mode 100644 index 000000000..8b7ea81f2 --- /dev/null +++ b/pkg/prometheus/testdata/NativeHistogramConfig.golden @@ -0,0 +1,71 @@ +global: + evaluation_interval: 30s + scrape_interval: 30s + external_labels: + prometheus: default/test + prometheus_replica: $(POD_NAME) +scrape_configs: +- job_name: serviceMonitor/default/testservicemonitor1/0 + honor_labels: false + kubernetes_sd_configs: + - role: endpoints + namespaces: + names: + - default + scrape_interval: 30s + relabel_configs: + - source_labels: + - job + target_label: __tmp_prometheus_job_name + - action: keep + source_labels: + - __meta_kubernetes_endpoint_port_name + regex: web + - source_labels: + - __meta_kubernetes_endpoint_address_target_kind + - __meta_kubernetes_endpoint_address_target_name + separator: ; + regex: Node;(.*) + replacement: ${1} + target_label: node + - source_labels: + - __meta_kubernetes_endpoint_address_target_kind + - __meta_kubernetes_endpoint_address_target_name + separator: ; + regex: Pod;(.*) + replacement: ${1} + target_label: pod + - source_labels: + - __meta_kubernetes_namespace + target_label: namespace + - source_labels: + - __meta_kubernetes_service_name + target_label: service + - source_labels: + - __meta_kubernetes_pod_name + target_label: pod + - source_labels: + - __meta_kubernetes_pod_container_name + target_label: container + - action: drop + source_labels: + - __meta_kubernetes_pod_phase + regex: (Failed|Succeeded) + - source_labels: + - __meta_kubernetes_service_name + target_label: job + replacement: ${1} + - target_label: endpoint + replacement: web + - source_labels: + - __address__ + target_label: __tmp_hash + modulus: 1 + action: hashmod + - source_labels: + - __tmp_hash + regex: $(SHARD) + action: keep + native_histogram_bucket_limit: 10 + native_histogram_min_bucket_factor: 12.124 + scrape_classic_histograms: true diff --git a/pkg/prometheus/testdata/NativeHistogramConfigWithMissALL.golden b/pkg/prometheus/testdata/NativeHistogramConfigWithMissALL.golden new file mode 100644 index 000000000..163ee2503 --- /dev/null +++ b/pkg/prometheus/testdata/NativeHistogramConfigWithMissALL.golden @@ -0,0 +1,68 @@ +global: + evaluation_interval: 30s + scrape_interval: 30s + external_labels: + prometheus: default/test + prometheus_replica: $(POD_NAME) +scrape_configs: +- job_name: serviceMonitor/default/testservicemonitor1/0 + honor_labels: false + kubernetes_sd_configs: + - role: endpoints + namespaces: + names: + - default + scrape_interval: 30s + relabel_configs: + - source_labels: + - job + target_label: __tmp_prometheus_job_name + - action: keep + source_labels: + - __meta_kubernetes_endpoint_port_name + regex: web + - source_labels: + - __meta_kubernetes_endpoint_address_target_kind + - __meta_kubernetes_endpoint_address_target_name + separator: ; + regex: Node;(.*) + replacement: ${1} + target_label: node + - source_labels: + - __meta_kubernetes_endpoint_address_target_kind + - __meta_kubernetes_endpoint_address_target_name + separator: ; + regex: Pod;(.*) + replacement: ${1} + target_label: pod + - source_labels: + - __meta_kubernetes_namespace + target_label: namespace + - source_labels: + - __meta_kubernetes_service_name + target_label: service + - source_labels: + - __meta_kubernetes_pod_name + target_label: pod + - source_labels: + - __meta_kubernetes_pod_container_name + target_label: container + - action: drop + source_labels: + - __meta_kubernetes_pod_phase + regex: (Failed|Succeeded) + - source_labels: + - __meta_kubernetes_service_name + target_label: job + replacement: ${1} + - target_label: endpoint + replacement: web + - source_labels: + - __address__ + target_label: __tmp_hash + modulus: 1 + action: hashmod + - source_labels: + - __tmp_hash + regex: $(SHARD) + action: keep diff --git a/pkg/prometheus/testdata/NativeHistogramConfigWithMissNativeHistogramMinBucketFactor.golden b/pkg/prometheus/testdata/NativeHistogramConfigWithMissNativeHistogramMinBucketFactor.golden new file mode 100644 index 000000000..180f4e160 --- /dev/null +++ b/pkg/prometheus/testdata/NativeHistogramConfigWithMissNativeHistogramMinBucketFactor.golden @@ -0,0 +1,70 @@ +global: + evaluation_interval: 30s + scrape_interval: 30s + external_labels: + prometheus: default/test + prometheus_replica: $(POD_NAME) +scrape_configs: +- job_name: serviceMonitor/default/testservicemonitor1/0 + honor_labels: false + kubernetes_sd_configs: + - role: endpoints + namespaces: + names: + - default + scrape_interval: 30s + relabel_configs: + - source_labels: + - job + target_label: __tmp_prometheus_job_name + - action: keep + source_labels: + - __meta_kubernetes_endpoint_port_name + regex: web + - source_labels: + - __meta_kubernetes_endpoint_address_target_kind + - __meta_kubernetes_endpoint_address_target_name + separator: ; + regex: Node;(.*) + replacement: ${1} + target_label: node + - source_labels: + - __meta_kubernetes_endpoint_address_target_kind + - __meta_kubernetes_endpoint_address_target_name + separator: ; + regex: Pod;(.*) + replacement: ${1} + target_label: pod + - source_labels: + - __meta_kubernetes_namespace + target_label: namespace + - source_labels: + - __meta_kubernetes_service_name + target_label: service + - source_labels: + - __meta_kubernetes_pod_name + target_label: pod + - source_labels: + - __meta_kubernetes_pod_container_name + target_label: container + - action: drop + source_labels: + - __meta_kubernetes_pod_phase + regex: (Failed|Succeeded) + - source_labels: + - __meta_kubernetes_service_name + target_label: job + replacement: ${1} + - target_label: endpoint + replacement: web + - source_labels: + - __address__ + target_label: __tmp_hash + modulus: 1 + action: hashmod + - source_labels: + - __tmp_hash + regex: $(SHARD) + action: keep + native_histogram_bucket_limit: 10 + scrape_classic_histograms: true