1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-07 01:24:29 +00:00

feat: support add native histogram config (#6796)

* add native histogram

---------

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
This commit is contained in:
dongjiang 2024-10-21 23:38:11 +08:00 committed by GitHub
parent 6616970906
commit a26ca7273e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 1390 additions and 103 deletions

387
Documentation/api.md generated
View file

@ -1039,6 +1039,47 @@ uint64
</tr>
<tr>
<td>
<code>scrapeClassicHistograms</code><br/>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Whether to scrape a classic histogram that is also exposed as a native histogram.
It requires Prometheus &gt;= v2.45.0.</p>
</td>
</tr>
<tr>
<td>
<code>nativeHistogramBucketLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>If there are more than this many buckets in a native histogram,
buckets will be merged to stay within the limit.
It requires Prometheus &gt;= v2.45.0.</p>
</td>
</tr>
<tr>
<td>
<code>nativeHistogramMinBucketFactor</code><br/>
<em>
k8s.io/apimachinery/pkg/api/resource.Quantity
</em>
</td>
<td>
<em>(Optional)</em>
<p>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 &gt;= v2.50.0.</p>
</td>
</tr>
<tr>
<td>
<code>keepDroppedTargets</code><br/>
<em>
uint64
@ -1404,6 +1445,47 @@ Only valid in Prometheus versions 2.27.0 and newer.</p>
</tr>
<tr>
<td>
<code>scrapeClassicHistograms</code><br/>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Whether to scrape a classic histogram that is also exposed as a native histogram.
It requires Prometheus &gt;= v2.45.0.</p>
</td>
</tr>
<tr>
<td>
<code>nativeHistogramBucketLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>If there are more than this many buckets in a native histogram,
buckets will be merged to stay within the limit.
It requires Prometheus &gt;= v2.45.0.</p>
</td>
</tr>
<tr>
<td>
<code>nativeHistogramMinBucketFactor</code><br/>
<em>
k8s.io/apimachinery/pkg/api/resource.Quantity
</em>
</td>
<td>
<em>(Optional)</em>
<p>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 &gt;= v2.50.0.</p>
</td>
</tr>
<tr>
<td>
<code>keepDroppedTargets</code><br/>
<em>
uint64
@ -3573,6 +3655,47 @@ uint64
</tr>
<tr>
<td>
<code>scrapeClassicHistograms</code><br/>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Whether to scrape a classic histogram that is also exposed as a native histogram.
It requires Prometheus &gt;= v2.45.0.</p>
</td>
</tr>
<tr>
<td>
<code>nativeHistogramBucketLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>If there are more than this many buckets in a native histogram,
buckets will be merged to stay within the limit.
It requires Prometheus &gt;= v2.45.0.</p>
</td>
</tr>
<tr>
<td>
<code>nativeHistogramMinBucketFactor</code><br/>
<em>
k8s.io/apimachinery/pkg/api/resource.Quantity
</em>
</td>
<td>
<em>(Optional)</em>
<p>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 &gt;= v2.50.0.</p>
</td>
</tr>
<tr>
<td>
<code>keepDroppedTargets</code><br/>
<em>
uint64
@ -9327,6 +9450,65 @@ list restricting them.</p>
</tr>
</tbody>
</table>
<h3 id="monitoring.coreos.com/v1.NativeHistogramConfig">NativeHistogramConfig
</h3>
<p>
(<em>Appears on:</em><a href="#monitoring.coreos.com/v1.PodMonitorSpec">PodMonitorSpec</a>, <a href="#monitoring.coreos.com/v1.ProbeSpec">ProbeSpec</a>, <a href="#monitoring.coreos.com/v1.ServiceMonitorSpec">ServiceMonitorSpec</a>, <a href="#monitoring.coreos.com/v1alpha1.ScrapeConfigSpec">ScrapeConfigSpec</a>)
</p>
<div>
<p>NativeHistogramConfig extends the native histogram configuration settings.</p>
</div>
<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>scrapeClassicHistograms</code><br/>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Whether to scrape a classic histogram that is also exposed as a native histogram.
It requires Prometheus &gt;= v2.45.0.</p>
</td>
</tr>
<tr>
<td>
<code>nativeHistogramBucketLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>If there are more than this many buckets in a native histogram,
buckets will be merged to stay within the limit.
It requires Prometheus &gt;= v2.45.0.</p>
</td>
</tr>
<tr>
<td>
<code>nativeHistogramMinBucketFactor</code><br/>
<em>
k8s.io/apimachinery/pkg/api/resource.Quantity
</em>
</td>
<td>
<em>(Optional)</em>
<p>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 &gt;= v2.50.0.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="monitoring.coreos.com/v1.NonEmptyDuration">NonEmptyDuration
(<code>string</code> alias)</h3>
<p>
@ -10196,6 +10378,47 @@ uint64
</tr>
<tr>
<td>
<code>scrapeClassicHistograms</code><br/>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Whether to scrape a classic histogram that is also exposed as a native histogram.
It requires Prometheus &gt;= v2.45.0.</p>
</td>
</tr>
<tr>
<td>
<code>nativeHistogramBucketLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>If there are more than this many buckets in a native histogram,
buckets will be merged to stay within the limit.
It requires Prometheus &gt;= v2.45.0.</p>
</td>
</tr>
<tr>
<td>
<code>nativeHistogramMinBucketFactor</code><br/>
<em>
k8s.io/apimachinery/pkg/api/resource.Quantity
</em>
</td>
<td>
<em>(Optional)</em>
<p>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 &gt;= v2.50.0.</p>
</td>
</tr>
<tr>
<td>
<code>keepDroppedTargets</code><br/>
<em>
uint64
@ -10512,6 +10735,47 @@ Only valid in Prometheus versions 2.27.0 and newer.</p>
</tr>
<tr>
<td>
<code>scrapeClassicHistograms</code><br/>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Whether to scrape a classic histogram that is also exposed as a native histogram.
It requires Prometheus &gt;= v2.45.0.</p>
</td>
</tr>
<tr>
<td>
<code>nativeHistogramBucketLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>If there are more than this many buckets in a native histogram,
buckets will be merged to stay within the limit.
It requires Prometheus &gt;= v2.45.0.</p>
</td>
</tr>
<tr>
<td>
<code>nativeHistogramMinBucketFactor</code><br/>
<em>
k8s.io/apimachinery/pkg/api/resource.Quantity
</em>
</td>
<td>
<em>(Optional)</em>
<p>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 &gt;= v2.50.0.</p>
</td>
</tr>
<tr>
<td>
<code>keepDroppedTargets</code><br/>
<em>
uint64
@ -14832,6 +15096,47 @@ uint64
</tr>
<tr>
<td>
<code>scrapeClassicHistograms</code><br/>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Whether to scrape a classic histogram that is also exposed as a native histogram.
It requires Prometheus &gt;= v2.45.0.</p>
</td>
</tr>
<tr>
<td>
<code>nativeHistogramBucketLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>If there are more than this many buckets in a native histogram,
buckets will be merged to stay within the limit.
It requires Prometheus &gt;= v2.45.0.</p>
</td>
</tr>
<tr>
<td>
<code>nativeHistogramMinBucketFactor</code><br/>
<em>
k8s.io/apimachinery/pkg/api/resource.Quantity
</em>
</td>
<td>
<em>(Optional)</em>
<p>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 &gt;= v2.50.0.</p>
</td>
</tr>
<tr>
<td>
<code>keepDroppedTargets</code><br/>
<em>
uint64
@ -19409,6 +19714,47 @@ Only valid in Prometheus versions 2.27.0 and newer.</p>
</tr>
<tr>
<td>
<code>scrapeClassicHistograms</code><br/>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Whether to scrape a classic histogram that is also exposed as a native histogram.
It requires Prometheus &gt;= v2.45.0.</p>
</td>
</tr>
<tr>
<td>
<code>nativeHistogramBucketLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>If there are more than this many buckets in a native histogram,
buckets will be merged to stay within the limit.
It requires Prometheus &gt;= v2.45.0.</p>
</td>
</tr>
<tr>
<td>
<code>nativeHistogramMinBucketFactor</code><br/>
<em>
k8s.io/apimachinery/pkg/api/resource.Quantity
</em>
</td>
<td>
<em>(Optional)</em>
<p>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 &gt;= v2.50.0.</p>
</td>
</tr>
<tr>
<td>
<code>keepDroppedTargets</code><br/>
<em>
uint64
@ -28340,6 +28686,47 @@ Only valid in Prometheus versions 2.27.0 and newer.</p>
</tr>
<tr>
<td>
<code>scrapeClassicHistograms</code><br/>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Whether to scrape a classic histogram that is also exposed as a native histogram.
It requires Prometheus &gt;= v2.45.0.</p>
</td>
</tr>
<tr>
<td>
<code>nativeHistogramBucketLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>If there are more than this many buckets in a native histogram,
buckets will be merged to stay within the limit.
It requires Prometheus &gt;= v2.45.0.</p>
</td>
</tr>
<tr>
<td>
<code>nativeHistogramMinBucketFactor</code><br/>
<em>
k8s.io/apimachinery/pkg/api/resource.Quantity
</em>
</td>
<td>
<em>(Optional)</em>
<p>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 &gt;= v2.50.0.</p>
</td>
</tr>
<tr>
<td>
<code>keepDroppedTargets</code><br/>
<em>
uint64

View file

@ -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 #

88
bundle.yaml generated
View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)?)$

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)?)$

View file

@ -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

View file

@ -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": {

View file

@ -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": {

View file

@ -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)?)$",

View file

@ -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": {

View file

@ -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.
//

View file

@ -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.
//

View file

@ -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.
//

View file

@ -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"`
}

View file

@ -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)

View file

@ -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.
//

View file

@ -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)

View file

@ -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
}

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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"):

View file

@ -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)

View file

@ -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

71
pkg/prometheus/testdata/NativeHistogramConfig.golden generated vendored Normal file
View file

@ -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

View file

@ -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

View file

@ -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