1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-21 19:49:46 +00:00

feat: add keep_dropped_targets limit to CRDs ()

Fixes 

Signed-off-by: Jayapriya Pai <slashpai9@gmail.com>
This commit is contained in:
Jayapriya Pai 2023-09-07 22:29:09 +05:30 committed by GitHub
parent 74505c3846
commit 0a93915921
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 950 additions and 0 deletions

267
Documentation/api.md generated
View file

@ -938,6 +938,20 @@ Only valid in Prometheus versions 2.27.0 and newer.</p>
</tr>
<tr>
<td>
<code>keepDroppedTargets</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on the number of targets dropped by relabeling
that will be kept in memory. 0 means no limit.</p>
<p>It requires Prometheus &gt;= v2.47.0.</p>
</td>
</tr>
<tr>
<td>
<code>attachMetadata</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.AttachMetadata">
@ -1236,6 +1250,20 @@ uint64
Only valid in Prometheus versions 2.27.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>keepDroppedTargets</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on the number of targets dropped by relabeling
that will be kept in memory. 0 means no limit.</p>
<p>It requires Prometheus &gt;= v2.47.0.</p>
</td>
</tr>
</table>
</td>
</tr>
@ -2217,6 +2245,23 @@ greater than zero and less than <code>spec.enforcedLabelValueLengthLimit</code>.
</tr>
<tr>
<td>
<code>enforcedKeepDroppedTargets</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>When defined, enforcedKeepDroppedTargets specifies a global limit on the number of targets
dropped by relabeling that will be kept in memory. The value overrides
any <code>spec.keepDroppedTargets</code> set by
ServiceMonitor, PodMonitor, Probe objects unless <code>spec.keepDroppedTargets</code> is
greater than zero and less than <code>spec.enforcedKeepDroppedTargets</code>.</p>
<p>It requires Prometheus &gt;= v2.47.0.</p>
</td>
</tr>
<tr>
<td>
<code>enforcedBodySizeLimit</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.ByteSize">
@ -2440,6 +2485,20 @@ Only valid in Prometheus versions 2.45.0 and newer.</p>
</tr>
<tr>
<td>
<code>keepDroppedTargets</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on the number of targets dropped by relabeling
that will be kept in memory. 0 means no limit.</p>
<p>It requires Prometheus &gt;= v2.47.0.</p>
</td>
</tr>
<tr>
<td>
<code>baseImage</code><br/>
<em>
string
@ -3068,6 +3127,20 @@ Only valid in Prometheus versions 2.27.0 and newer.</p>
</tr>
<tr>
<td>
<code>keepDroppedTargets</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on the number of targets dropped by relabeling
that will be kept in memory. 0 means no limit.</p>
<p>It requires Prometheus &gt;= v2.47.0.</p>
</td>
</tr>
<tr>
<td>
<code>attachMetadata</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.AttachMetadata">
@ -6336,6 +6409,23 @@ greater than zero and less than <code>spec.enforcedLabelValueLengthLimit</code>.
</tr>
<tr>
<td>
<code>enforcedKeepDroppedTargets</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>When defined, enforcedKeepDroppedTargets specifies a global limit on the number of targets
dropped by relabeling that will be kept in memory. The value overrides
any <code>spec.keepDroppedTargets</code> set by
ServiceMonitor, PodMonitor, Probe objects unless <code>spec.keepDroppedTargets</code> is
greater than zero and less than <code>spec.enforcedKeepDroppedTargets</code>.</p>
<p>It requires Prometheus &gt;= v2.47.0.</p>
</td>
</tr>
<tr>
<td>
<code>enforcedBodySizeLimit</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.ByteSize">
@ -6557,6 +6647,20 @@ uint64
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>keepDroppedTargets</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on the number of targets dropped by relabeling
that will be kept in memory. 0 means no limit.</p>
<p>It requires Prometheus &gt;= v2.47.0.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="monitoring.coreos.com/v1.Condition">Condition
@ -8406,6 +8510,20 @@ Only valid in Prometheus versions 2.27.0 and newer.</p>
</tr>
<tr>
<td>
<code>keepDroppedTargets</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on the number of targets dropped by relabeling
that will be kept in memory. 0 means no limit.</p>
<p>It requires Prometheus &gt;= v2.47.0.</p>
</td>
</tr>
<tr>
<td>
<code>attachMetadata</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.AttachMetadata">
@ -8659,6 +8777,20 @@ uint64
Only valid in Prometheus versions 2.27.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>keepDroppedTargets</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on the number of targets dropped by relabeling
that will be kept in memory. 0 means no limit.</p>
<p>It requires Prometheus &gt;= v2.47.0.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="monitoring.coreos.com/v1.ProbeTLSConfig">ProbeTLSConfig
@ -10008,6 +10140,23 @@ greater than zero and less than <code>spec.enforcedLabelValueLengthLimit</code>.
</tr>
<tr>
<td>
<code>enforcedKeepDroppedTargets</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>When defined, enforcedKeepDroppedTargets specifies a global limit on the number of targets
dropped by relabeling that will be kept in memory. The value overrides
any <code>spec.keepDroppedTargets</code> set by
ServiceMonitor, PodMonitor, Probe objects unless <code>spec.keepDroppedTargets</code> is
greater than zero and less than <code>spec.enforcedKeepDroppedTargets</code>.</p>
<p>It requires Prometheus &gt;= v2.47.0.</p>
</td>
</tr>
<tr>
<td>
<code>enforcedBodySizeLimit</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.ByteSize">
@ -10231,6 +10380,20 @@ Only valid in Prometheus versions 2.45.0 and newer.</p>
</tr>
<tr>
<td>
<code>keepDroppedTargets</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on the number of targets dropped by relabeling
that will be kept in memory. 0 means no limit.</p>
<p>It requires Prometheus &gt;= v2.47.0.</p>
</td>
</tr>
<tr>
<td>
<code>baseImage</code><br/>
<em>
string
@ -12259,6 +12422,20 @@ Only valid in Prometheus versions 2.27.0 and newer.</p>
</tr>
<tr>
<td>
<code>keepDroppedTargets</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on the number of targets dropped by relabeling
that will be kept in memory. 0 means no limit.</p>
<p>It requires Prometheus &gt;= v2.47.0.</p>
</td>
</tr>
<tr>
<td>
<code>attachMetadata</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.AttachMetadata">
@ -15255,6 +15432,23 @@ greater than zero and less than <code>spec.enforcedLabelValueLengthLimit</code>.
</tr>
<tr>
<td>
<code>enforcedKeepDroppedTargets</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>When defined, enforcedKeepDroppedTargets specifies a global limit on the number of targets
dropped by relabeling that will be kept in memory. The value overrides
any <code>spec.keepDroppedTargets</code> set by
ServiceMonitor, PodMonitor, Probe objects unless <code>spec.keepDroppedTargets</code> is
greater than zero and less than <code>spec.enforcedKeepDroppedTargets</code>.</p>
<p>It requires Prometheus &gt;= v2.47.0.</p>
</td>
</tr>
<tr>
<td>
<code>enforcedBodySizeLimit</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.ByteSize">
@ -15476,6 +15670,20 @@ uint64
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>keepDroppedTargets</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on the number of targets dropped by relabeling
that will be kept in memory. 0 means no limit.</p>
<p>It requires Prometheus &gt;= v2.47.0.</p>
</td>
</tr>
</table>
</td>
</tr>
@ -15851,6 +16059,20 @@ Only valid in Prometheus versions 2.27.0 and newer.</p>
</tr>
<tr>
<td>
<code>keepDroppedTargets</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on the number of targets dropped by relabeling
that will be kept in memory. 0 means no limit.</p>
<p>It requires Prometheus &gt;= v2.47.0.</p>
</td>
</tr>
<tr>
<td>
<code>metricRelabelings</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.RelabelConfig">
@ -18777,6 +18999,23 @@ greater than zero and less than <code>spec.enforcedLabelValueLengthLimit</code>.
</tr>
<tr>
<td>
<code>enforcedKeepDroppedTargets</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>When defined, enforcedKeepDroppedTargets specifies a global limit on the number of targets
dropped by relabeling that will be kept in memory. The value overrides
any <code>spec.keepDroppedTargets</code> set by
ServiceMonitor, PodMonitor, Probe objects unless <code>spec.keepDroppedTargets</code> is
greater than zero and less than <code>spec.enforcedKeepDroppedTargets</code>.</p>
<p>It requires Prometheus &gt;= v2.47.0.</p>
</td>
</tr>
<tr>
<td>
<code>enforcedBodySizeLimit</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.ByteSize">
@ -18998,6 +19237,20 @@ uint64
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>keepDroppedTargets</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on the number of targets dropped by relabeling
that will be kept in memory. 0 means no limit.</p>
<p>It requires Prometheus &gt;= v2.47.0.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="monitoring.coreos.com/v1alpha1.PushoverConfig">PushoverConfig
@ -20001,6 +20254,20 @@ Only valid in Prometheus versions 2.27.0 and newer.</p>
</tr>
<tr>
<td>
<code>keepDroppedTargets</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on the number of targets dropped by relabeling
that will be kept in memory. 0 means no limit.</p>
<p>It requires Prometheus &gt;= v2.47.0.</p>
</td>
</tr>
<tr>
<td>
<code>metricRelabelings</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.RelabelConfig">

54
bundle.yaml generated
View file

@ -12733,6 +12733,12 @@ spec:
jobLabel:
description: The label to use to retrieve the job name from.
type: string
keepDroppedTargets:
description: "Per-scrape limit on the number of targets dropped by
relabeling that will be kept in memory. 0 means no limit. \n It
requires Prometheus >= v2.47.0."
format: int64
type: integer
labelLimit:
description: Per-scrape limit on number of labels that will be accepted
for a sample. Only valid in Prometheus versions 2.27.0 and newer.
@ -13507,6 +13513,12 @@ spec:
jobName:
description: The job name assigned to scraped metrics by default.
type: string
keepDroppedTargets:
description: "Per-scrape limit on the number of targets dropped by
relabeling that will be kept in memory. 0 means no limit. \n It
requires Prometheus >= v2.47.0."
format: int64
type: integer
labelLimit:
description: Per-scrape limit on number of labels that will be accepted
for a sample. Only valid in Prometheus versions 2.27.0 and newer.
@ -16623,6 +16635,15 @@ spec:
v2.28.0."
pattern: (^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$
type: string
enforcedKeepDroppedTargets:
description: "When defined, enforcedKeepDroppedTargets specifies a
global limit on the number of targets dropped by relabeling that
will be kept in memory. The value overrides any `spec.keepDroppedTargets`
set by ServiceMonitor, PodMonitor, Probe objects unless `spec.keepDroppedTargets`
is greater than zero and less than `spec.enforcedKeepDroppedTargets`.
\n It requires Prometheus >= v2.47.0."
format: int64
type: integer
enforcedLabelLimit:
description: "When defined, enforcedLabelLimit specifies a global
limit on the number of labels per sample. The value overrides any
@ -18095,6 +18116,12 @@ spec:
- name
type: object
type: array
keepDroppedTargets:
description: "Per-scrape limit on the number of targets dropped by
relabeling that will be kept in memory. 0 means no limit. \n It
requires Prometheus >= v2.47.0."
format: int64
type: integer
labelLimit:
description: Per-scrape limit on number of labels that will be accepted
for a sample. Only valid in Prometheus versions 2.45.0 and newer.
@ -25362,6 +25389,15 @@ spec:
v2.28.0."
pattern: (^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$
type: string
enforcedKeepDroppedTargets:
description: "When defined, enforcedKeepDroppedTargets specifies a
global limit on the number of targets dropped by relabeling that
will be kept in memory. The value overrides any `spec.keepDroppedTargets`
set by ServiceMonitor, PodMonitor, Probe objects unless `spec.keepDroppedTargets`
is greater than zero and less than `spec.enforcedKeepDroppedTargets`.
\n It requires Prometheus >= v2.47.0."
format: int64
type: integer
enforcedLabelLimit:
description: "When defined, enforcedLabelLimit specifies a global
limit on the number of labels per sample. The value overrides any
@ -26853,6 +26889,12 @@ spec:
- name
type: object
type: array
keepDroppedTargets:
description: "Per-scrape limit on the number of targets dropped by
relabeling that will be kept in memory. 0 means no limit. \n It
requires Prometheus >= v2.47.0."
format: int64
type: integer
labelLimit:
description: Per-scrape limit on number of labels that will be accepted
for a sample. Only valid in Prometheus versions 2.45.0 and newer.
@ -33155,6 +33197,12 @@ spec:
- url
type: object
type: array
keepDroppedTargets:
description: "Per-scrape limit on the number of targets dropped by
relabeling that will be kept in memory. 0 means no limit. \n It
requires Prometheus >= v2.47.0."
format: int64
type: integer
kubernetesSDConfigs:
description: KubernetesSDConfigs defines a list of Kubernetes service
discovery configurations.
@ -34124,6 +34172,12 @@ spec:
the given Service, the `job` label of the metrics defaults to the
name of the Kubernetes Service."
type: string
keepDroppedTargets:
description: "Per-scrape limit on the number of targets dropped by
relabeling that will be kept in memory. 0 means no limit. \n It
requires Prometheus >= v2.47.0."
format: int64
type: integer
labelLimit:
description: Per-scrape limit on number of labels that will be accepted
for a sample. Only valid in Prometheus versions 2.27.0 and newer.

View file

@ -52,6 +52,12 @@ spec:
jobLabel:
description: The label to use to retrieve the job name from.
type: string
keepDroppedTargets:
description: "Per-scrape limit on the number of targets dropped by
relabeling that will be kept in memory. 0 means no limit. \n It
requires Prometheus >= v2.47.0."
format: int64
type: integer
labelLimit:
description: Per-scrape limit on number of labels that will be accepted
for a sample. Only valid in Prometheus versions 2.27.0 and newer.

View file

@ -141,6 +141,12 @@ spec:
jobName:
description: The job name assigned to scraped metrics by default.
type: string
keepDroppedTargets:
description: "Per-scrape limit on the number of targets dropped by
relabeling that will be kept in memory. 0 means no limit. \n It
requires Prometheus >= v2.47.0."
format: int64
type: integer
labelLimit:
description: Per-scrape limit on number of labels that will be accepted
for a sample. Only valid in Prometheus versions 2.27.0 and newer.

View file

@ -2530,6 +2530,15 @@ spec:
v2.28.0."
pattern: (^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$
type: string
enforcedKeepDroppedTargets:
description: "When defined, enforcedKeepDroppedTargets specifies a
global limit on the number of targets dropped by relabeling that
will be kept in memory. The value overrides any `spec.keepDroppedTargets`
set by ServiceMonitor, PodMonitor, Probe objects unless `spec.keepDroppedTargets`
is greater than zero and less than `spec.enforcedKeepDroppedTargets`.
\n It requires Prometheus >= v2.47.0."
format: int64
type: integer
enforcedLabelLimit:
description: "When defined, enforcedLabelLimit specifies a global
limit on the number of labels per sample. The value overrides any
@ -4002,6 +4011,12 @@ spec:
- name
type: object
type: array
keepDroppedTargets:
description: "Per-scrape limit on the number of targets dropped by
relabeling that will be kept in memory. 0 means no limit. \n It
requires Prometheus >= v2.47.0."
format: int64
type: integer
labelLimit:
description: Per-scrape limit on number of labels that will be accepted
for a sample. Only valid in Prometheus versions 2.45.0 and newer.

View file

@ -2879,6 +2879,15 @@ spec:
v2.28.0."
pattern: (^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$
type: string
enforcedKeepDroppedTargets:
description: "When defined, enforcedKeepDroppedTargets specifies a
global limit on the number of targets dropped by relabeling that
will be kept in memory. The value overrides any `spec.keepDroppedTargets`
set by ServiceMonitor, PodMonitor, Probe objects unless `spec.keepDroppedTargets`
is greater than zero and less than `spec.enforcedKeepDroppedTargets`.
\n It requires Prometheus >= v2.47.0."
format: int64
type: integer
enforcedLabelLimit:
description: "When defined, enforcedLabelLimit specifies a global
limit on the number of labels per sample. The value overrides any
@ -4370,6 +4379,12 @@ spec:
- name
type: object
type: array
keepDroppedTargets:
description: "Per-scrape limit on the number of targets dropped by
relabeling that will be kept in memory. 0 means no limit. \n It
requires Prometheus >= v2.47.0."
format: int64
type: integer
labelLimit:
description: Per-scrape limit on number of labels that will be accepted
for a sample. Only valid in Prometheus versions 2.45.0 and newer.

View file

@ -817,6 +817,12 @@ spec:
- url
type: object
type: array
keepDroppedTargets:
description: "Per-scrape limit on the number of targets dropped by
relabeling that will be kept in memory. 0 means no limit. \n It
requires Prometheus >= v2.47.0."
format: int64
type: integer
kubernetesSDConfigs:
description: KubernetesSDConfigs defines a list of Kubernetes service
discovery configurations.

View file

@ -605,6 +605,12 @@ spec:
the given Service, the `job` label of the metrics defaults to the
name of the Kubernetes Service."
type: string
keepDroppedTargets:
description: "Per-scrape limit on the number of targets dropped by
relabeling that will be kept in memory. 0 means no limit. \n It
requires Prometheus >= v2.47.0."
format: int64
type: integer
labelLimit:
description: Per-scrape limit on number of labels that will be accepted
for a sample. Only valid in Prometheus versions 2.27.0 and newer.

View file

@ -52,6 +52,12 @@ spec:
jobLabel:
description: The label to use to retrieve the job name from.
type: string
keepDroppedTargets:
description: "Per-scrape limit on the number of targets dropped by
relabeling that will be kept in memory. 0 means no limit. \n It
requires Prometheus >= v2.47.0."
format: int64
type: integer
labelLimit:
description: Per-scrape limit on number of labels that will be accepted
for a sample. Only valid in Prometheus versions 2.27.0 and newer.

View file

@ -141,6 +141,12 @@ spec:
jobName:
description: The job name assigned to scraped metrics by default.
type: string
keepDroppedTargets:
description: "Per-scrape limit on the number of targets dropped by
relabeling that will be kept in memory. 0 means no limit. \n It
requires Prometheus >= v2.47.0."
format: int64
type: integer
labelLimit:
description: Per-scrape limit on number of labels that will be accepted
for a sample. Only valid in Prometheus versions 2.27.0 and newer.

View file

@ -2530,6 +2530,15 @@ spec:
v2.28.0."
pattern: (^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$
type: string
enforcedKeepDroppedTargets:
description: "When defined, enforcedKeepDroppedTargets specifies a
global limit on the number of targets dropped by relabeling that
will be kept in memory. The value overrides any `spec.keepDroppedTargets`
set by ServiceMonitor, PodMonitor, Probe objects unless `spec.keepDroppedTargets`
is greater than zero and less than `spec.enforcedKeepDroppedTargets`.
\n It requires Prometheus >= v2.47.0."
format: int64
type: integer
enforcedLabelLimit:
description: "When defined, enforcedLabelLimit specifies a global
limit on the number of labels per sample. The value overrides any
@ -4002,6 +4011,12 @@ spec:
- name
type: object
type: array
keepDroppedTargets:
description: "Per-scrape limit on the number of targets dropped by
relabeling that will be kept in memory. 0 means no limit. \n It
requires Prometheus >= v2.47.0."
format: int64
type: integer
labelLimit:
description: Per-scrape limit on number of labels that will be accepted
for a sample. Only valid in Prometheus versions 2.45.0 and newer.

View file

@ -2879,6 +2879,15 @@ spec:
v2.28.0."
pattern: (^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$
type: string
enforcedKeepDroppedTargets:
description: "When defined, enforcedKeepDroppedTargets specifies a
global limit on the number of targets dropped by relabeling that
will be kept in memory. The value overrides any `spec.keepDroppedTargets`
set by ServiceMonitor, PodMonitor, Probe objects unless `spec.keepDroppedTargets`
is greater than zero and less than `spec.enforcedKeepDroppedTargets`.
\n It requires Prometheus >= v2.47.0."
format: int64
type: integer
enforcedLabelLimit:
description: "When defined, enforcedLabelLimit specifies a global
limit on the number of labels per sample. The value overrides any
@ -4370,6 +4379,12 @@ spec:
- name
type: object
type: array
keepDroppedTargets:
description: "Per-scrape limit on the number of targets dropped by
relabeling that will be kept in memory. 0 means no limit. \n It
requires Prometheus >= v2.47.0."
format: int64
type: integer
labelLimit:
description: Per-scrape limit on number of labels that will be accepted
for a sample. Only valid in Prometheus versions 2.45.0 and newer.

View file

@ -815,6 +815,12 @@ spec:
- url
type: object
type: array
keepDroppedTargets:
description: "Per-scrape limit on the number of targets dropped by
relabeling that will be kept in memory. 0 means no limit. \n It
requires Prometheus >= v2.47.0."
format: int64
type: integer
kubernetesSDConfigs:
description: KubernetesSDConfigs defines a list of Kubernetes service
discovery configurations.

View file

@ -605,6 +605,12 @@ spec:
the given Service, the `job` label of the metrics defaults to the
name of the Kubernetes Service."
type: string
keepDroppedTargets:
description: "Per-scrape limit on the number of targets dropped by
relabeling that will be kept in memory. 0 means no limit. \n It
requires Prometheus >= v2.47.0."
format: int64
type: integer
labelLimit:
description: Per-scrape limit on number of labels that will be accepted
for a sample. Only valid in Prometheus versions 2.27.0 and newer.

View file

@ -58,6 +58,11 @@
"description": "The label to use to retrieve the job name from.",
"type": "string"
},
"keepDroppedTargets": {
"description": "Per-scrape limit on the number of targets dropped by relabeling that will be kept in memory. 0 means no limit. \n It requires Prometheus >= v2.47.0.",
"format": "int64",
"type": "integer"
},
"labelLimit": {
"description": "Per-scrape limit on number of labels that will be accepted for a sample. Only valid in Prometheus versions 2.27.0 and newer.",
"format": "int64",

View file

@ -157,6 +157,11 @@
"description": "The job name assigned to scraped metrics by default.",
"type": "string"
},
"keepDroppedTargets": {
"description": "Per-scrape limit on the number of targets dropped by relabeling that will be kept in memory. 0 means no limit. \n It requires Prometheus >= v2.47.0.",
"format": "int64",
"type": "integer"
},
"labelLimit": {
"description": "Per-scrape limit on number of labels that will be accepted for a sample. Only valid in Prometheus versions 2.27.0 and newer.",
"format": "int64",

View file

@ -2257,6 +2257,11 @@
"pattern": "(^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$",
"type": "string"
},
"enforcedKeepDroppedTargets": {
"description": "When defined, enforcedKeepDroppedTargets specifies a global limit on the number of targets dropped by relabeling that will be kept in memory. The value overrides any `spec.keepDroppedTargets` set by ServiceMonitor, PodMonitor, Probe objects unless `spec.keepDroppedTargets` is greater than zero and less than `spec.enforcedKeepDroppedTargets`. \n It requires Prometheus >= v2.47.0.",
"format": "int64",
"type": "integer"
},
"enforcedLabelLimit": {
"description": "When defined, enforcedLabelLimit specifies a global limit on the number of labels per sample. The value overrides any `spec.labelLimit` set by ServiceMonitor, PodMonitor, Probe objects unless `spec.labelLimit` is greater than zero and less than `spec.enforcedLabelLimit`. \n It requires Prometheus >= v2.27.0.",
"format": "int64",
@ -3583,6 +3588,11 @@
},
"type": "array"
},
"keepDroppedTargets": {
"description": "Per-scrape limit on the number of targets dropped by relabeling that will be kept in memory. 0 means no limit. \n It requires Prometheus >= v2.47.0.",
"format": "int64",
"type": "integer"
},
"labelLimit": {
"description": "Per-scrape limit on number of labels that will be accepted for a sample. Only valid in Prometheus versions 2.45.0 and newer.",
"format": "int64",

View file

@ -2616,6 +2616,11 @@
"pattern": "(^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$",
"type": "string"
},
"enforcedKeepDroppedTargets": {
"description": "When defined, enforcedKeepDroppedTargets specifies a global limit on the number of targets dropped by relabeling that will be kept in memory. The value overrides any `spec.keepDroppedTargets` set by ServiceMonitor, PodMonitor, Probe objects unless `spec.keepDroppedTargets` is greater than zero and less than `spec.enforcedKeepDroppedTargets`. \n It requires Prometheus >= v2.47.0.",
"format": "int64",
"type": "integer"
},
"enforcedLabelLimit": {
"description": "When defined, enforcedLabelLimit specifies a global limit on the number of labels per sample. The value overrides any `spec.labelLimit` set by ServiceMonitor, PodMonitor, Probe objects unless `spec.labelLimit` is greater than zero and less than `spec.enforcedLabelLimit`. \n It requires Prometheus >= v2.27.0.",
"format": "int64",
@ -3959,6 +3964,11 @@
},
"type": "array"
},
"keepDroppedTargets": {
"description": "Per-scrape limit on the number of targets dropped by relabeling that will be kept in memory. 0 means no limit. \n It requires Prometheus >= v2.47.0.",
"format": "int64",
"type": "integer"
},
"labelLimit": {
"description": "Per-scrape limit on number of labels that will be accepted for a sample. Only valid in Prometheus versions 2.45.0 and newer.",
"format": "int64",

View file

@ -906,6 +906,11 @@
},
"type": "array"
},
"keepDroppedTargets": {
"description": "Per-scrape limit on the number of targets dropped by relabeling that will be kept in memory. 0 means no limit. \n It requires Prometheus >= v2.47.0.",
"format": "int64",
"type": "integer"
},
"kubernetesSDConfigs": {
"description": "KubernetesSDConfigs defines a list of Kubernetes service discovery configurations.",
"items": {

View file

@ -636,6 +636,11 @@
"description": "JobLabel selects the label from the associated Kubernetes service which will be used as the `job` label for all metrics. \n For example: If in `ServiceMonitor.spec.jobLabel: foo` and in `Service.metadata.labels.foo: bar`, then the `job=\"bar\"` label is added to all metrics. \n If the value of this field is empty or if the label doesn't exist for the given Service, the `job` label of the metrics defaults to the name of the Kubernetes Service.",
"type": "string"
},
"keepDroppedTargets": {
"description": "Per-scrape limit on the number of targets dropped by relabeling that will be kept in memory. 0 means no limit. \n It requires Prometheus >= v2.47.0.",
"format": "int64",
"type": "integer"
},
"labelLimit": {
"description": "Per-scrape limit on number of labels that will be accepted for a sample. Only valid in Prometheus versions 2.27.0 and newer.",
"format": "int64",

View file

@ -74,6 +74,13 @@ type PodMonitorSpec struct {
// Only valid in Prometheus versions 2.27.0 and newer.
// +optional
LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"`
// Per-scrape limit on the number of targets dropped by relabeling
// that will be kept in memory. 0 means no limit.
//
// It requires Prometheus >= v2.47.0.
//
// +optional
KeepDroppedTargets *uint64 `json:"keepDroppedTargets,omitempty"`
// Attaches node metadata to discovered targets.
// Requires Prometheus v2.35.0 and above.
AttachMetadata *AttachMetadata `json:"attachMetadata,omitempty"`

View file

@ -96,6 +96,13 @@ type ProbeSpec struct {
// Only valid in Prometheus versions 2.27.0 and newer.
// +optional
LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"`
// Per-scrape limit on the number of targets dropped by relabeling
// that will be kept in memory. 0 means no limit.
//
// It requires Prometheus >= v2.47.0.
//
// +optional
KeepDroppedTargets *uint64 `json:"keepDroppedTargets,omitempty"`
}
// ProbeTargets defines how to discover the probed targets.

View file

@ -472,6 +472,16 @@ type CommonPrometheusFields struct {
//
// +optional
EnforcedLabelValueLengthLimit *uint64 `json:"enforcedLabelValueLengthLimit,omitempty"`
// When defined, enforcedKeepDroppedTargets specifies a global limit on the number of targets
// dropped by relabeling that will be kept in memory. The value overrides
// any `spec.keepDroppedTargets` set by
// ServiceMonitor, PodMonitor, Probe objects unless `spec.keepDroppedTargets` is
// greater than zero and less than `spec.enforcedKeepDroppedTargets`.
//
// It requires Prometheus >= v2.47.0.
//
// +optional
EnforcedKeepDroppedTargets *uint64 `json:"enforcedKeepDroppedTargets,omitempty"`
// When defined, enforcedBodySizeLimit specifies a global limit on the size
// of uncompressed response body that will be accepted by Prometheus.
// Targets responding with a body larger than this many bytes will cause
@ -580,6 +590,13 @@ type CommonPrometheusFields struct {
//
// +optional
LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"`
// Per-scrape limit on the number of targets dropped by relabeling
// that will be kept in memory. 0 means no limit.
//
// It requires Prometheus >= v2.47.0.
//
// +optional
KeepDroppedTargets *uint64 `json:"keepDroppedTargets,omitempty"`
}
// +genclient

View file

@ -82,6 +82,13 @@ type ServiceMonitorSpec struct {
// Only valid in Prometheus versions 2.27.0 and newer.
// +optional
LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"`
// Per-scrape limit on the number of targets dropped by relabeling
// that will be kept in memory. 0 means no limit.
//
// It requires Prometheus >= v2.47.0.
//
// +optional
KeepDroppedTargets *uint64 `json:"keepDroppedTargets,omitempty"`
// Attaches node metadata to discovered targets.
// Requires Prometheus v2.37.0 and above.
AttachMetadata *AttachMetadata `json:"attachMetadata,omitempty"`

View file

@ -755,6 +755,11 @@ func (in *CommonPrometheusFields) DeepCopyInto(out *CommonPrometheusFields) {
*out = new(uint64)
**out = **in
}
if in.EnforcedKeepDroppedTargets != nil {
in, out := &in.EnforcedKeepDroppedTargets, &out.EnforcedKeepDroppedTargets
*out = new(uint64)
**out = **in
}
if in.MinReadySeconds != nil {
in, out := &in.MinReadySeconds, &out.MinReadySeconds
*out = new(uint32)
@ -822,6 +827,11 @@ func (in *CommonPrometheusFields) DeepCopyInto(out *CommonPrometheusFields) {
*out = new(uint64)
**out = **in
}
if in.KeepDroppedTargets != nil {
in, out := &in.KeepDroppedTargets, &out.KeepDroppedTargets
*out = new(uint64)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonPrometheusFields.
@ -1461,6 +1471,11 @@ func (in *PodMonitorSpec) DeepCopyInto(out *PodMonitorSpec) {
*out = new(uint64)
**out = **in
}
if in.KeepDroppedTargets != nil {
in, out := &in.KeepDroppedTargets, &out.KeepDroppedTargets
*out = new(uint64)
**out = **in
}
if in.AttachMetadata != nil {
in, out := &in.AttachMetadata, &out.AttachMetadata
*out = new(AttachMetadata)
@ -1586,6 +1601,11 @@ func (in *ProbeSpec) DeepCopyInto(out *ProbeSpec) {
*out = new(uint64)
**out = **in
}
if in.KeepDroppedTargets != nil {
in, out := &in.KeepDroppedTargets, &out.KeepDroppedTargets
*out = new(uint64)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProbeSpec.
@ -2521,6 +2541,11 @@ func (in *ServiceMonitorSpec) DeepCopyInto(out *ServiceMonitorSpec) {
*out = new(uint64)
**out = **in
}
if in.KeepDroppedTargets != nil {
in, out := &in.KeepDroppedTargets, &out.KeepDroppedTargets
*out = new(uint64)
**out = **in
}
if in.AttachMetadata != nil {
in, out := &in.AttachMetadata, &out.AttachMetadata
*out = new(AttachMetadata)

View file

@ -147,6 +147,13 @@ type ScrapeConfigSpec struct {
// Only valid in Prometheus versions 2.27.0 and newer.
// +optional
LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"`
// Per-scrape limit on the number of targets dropped by relabeling
// that will be kept in memory. 0 means no limit.
//
// It requires Prometheus >= v2.47.0.
//
// +optional
KeepDroppedTargets *uint64 `json:"keepDroppedTargets,omitempty"`
// MetricRelabelConfigs to apply to samples before ingestion.
// +optional
MetricRelabelConfigs []*v1.RelabelConfig `json:"metricRelabelings,omitempty"`

View file

@ -1180,6 +1180,11 @@ func (in *ScrapeConfigSpec) DeepCopyInto(out *ScrapeConfigSpec) {
*out = new(uint64)
**out = **in
}
if in.KeepDroppedTargets != nil {
in, out := &in.KeepDroppedTargets, &out.KeepDroppedTargets
*out = new(uint64)
**out = **in
}
if in.MetricRelabelConfigs != nil {
in, out := &in.MetricRelabelConfigs, &out.MetricRelabelConfigs
*out = make([]*monitoringv1.RelabelConfig, len(*in))

View file

@ -83,6 +83,7 @@ type CommonPrometheusFieldsApplyConfiguration struct {
EnforcedLabelLimit *uint64 `json:"enforcedLabelLimit,omitempty"`
EnforcedLabelNameLengthLimit *uint64 `json:"enforcedLabelNameLengthLimit,omitempty"`
EnforcedLabelValueLengthLimit *uint64 `json:"enforcedLabelValueLengthLimit,omitempty"`
EnforcedKeepDroppedTargets *uint64 `json:"enforcedKeepDroppedTargets,omitempty"`
EnforcedBodySizeLimit *monitoringv1.ByteSize `json:"enforcedBodySizeLimit,omitempty"`
MinReadySeconds *uint32 `json:"minReadySeconds,omitempty"`
HostAliases []HostAliasApplyConfiguration `json:"hostAliases,omitempty"`
@ -98,6 +99,7 @@ type CommonPrometheusFieldsApplyConfiguration struct {
LabelLimit *uint64 `json:"labelLimit,omitempty"`
LabelNameLengthLimit *uint64 `json:"labelNameLengthLimit,omitempty"`
LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"`
KeepDroppedTargets *uint64 `json:"keepDroppedTargets,omitempty"`
}
// CommonPrometheusFieldsApplyConfiguration constructs an declarative configuration of the CommonPrometheusFields type for use with
@ -607,6 +609,14 @@ func (b *CommonPrometheusFieldsApplyConfiguration) WithEnforcedLabelValueLengthL
return b
}
// WithEnforcedKeepDroppedTargets sets the EnforcedKeepDroppedTargets 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 EnforcedKeepDroppedTargets field is set to the value of the last call.
func (b *CommonPrometheusFieldsApplyConfiguration) WithEnforcedKeepDroppedTargets(value uint64) *CommonPrometheusFieldsApplyConfiguration {
b.EnforcedKeepDroppedTargets = &value
return b
}
// WithEnforcedBodySizeLimit sets the EnforcedBodySizeLimit 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 EnforcedBodySizeLimit field is set to the value of the last call.
@ -743,3 +753,11 @@ func (b *CommonPrometheusFieldsApplyConfiguration) WithLabelValueLengthLimit(val
b.LabelValueLengthLimit = &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.
func (b *CommonPrometheusFieldsApplyConfiguration) WithKeepDroppedTargets(value uint64) *CommonPrometheusFieldsApplyConfiguration {
b.KeepDroppedTargets = &value
return b
}

View file

@ -33,6 +33,7 @@ type PodMonitorSpecApplyConfiguration struct {
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"`
}
@ -129,6 +130,14 @@ func (b *PodMonitorSpecApplyConfiguration) WithLabelValueLengthLimit(value uint6
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.
func (b *PodMonitorSpecApplyConfiguration) WithKeepDroppedTargets(value uint64) *PodMonitorSpecApplyConfiguration {
b.KeepDroppedTargets = &value
return b
}
// WithAttachMetadata sets the AttachMetadata 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 AttachMetadata field is set to the value of the last call.

View file

@ -41,6 +41,7 @@ type ProbeSpecApplyConfiguration struct {
LabelLimit *uint64 `json:"labelLimit,omitempty"`
LabelNameLengthLimit *uint64 `json:"labelNameLengthLimit,omitempty"`
LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"`
KeepDroppedTargets *uint64 `json:"keepDroppedTargets,omitempty"`
}
// ProbeSpecApplyConfiguration constructs an declarative configuration of the ProbeSpec type for use with
@ -189,3 +190,11 @@ func (b *ProbeSpecApplyConfiguration) WithLabelValueLengthLimit(value uint64) *P
b.LabelValueLengthLimit = &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.
func (b *ProbeSpecApplyConfiguration) WithKeepDroppedTargets(value uint64) *ProbeSpecApplyConfiguration {
b.KeepDroppedTargets = &value
return b
}

View file

@ -557,6 +557,14 @@ func (b *PrometheusSpecApplyConfiguration) WithEnforcedLabelValueLengthLimit(val
return b
}
// WithEnforcedKeepDroppedTargets sets the EnforcedKeepDroppedTargets 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 EnforcedKeepDroppedTargets field is set to the value of the last call.
func (b *PrometheusSpecApplyConfiguration) WithEnforcedKeepDroppedTargets(value uint64) *PrometheusSpecApplyConfiguration {
b.EnforcedKeepDroppedTargets = &value
return b
}
// WithEnforcedBodySizeLimit sets the EnforcedBodySizeLimit 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 EnforcedBodySizeLimit field is set to the value of the last call.
@ -694,6 +702,14 @@ func (b *PrometheusSpecApplyConfiguration) WithLabelValueLengthLimit(value uint6
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.
func (b *PrometheusSpecApplyConfiguration) WithKeepDroppedTargets(value uint64) *PrometheusSpecApplyConfiguration {
b.KeepDroppedTargets = &value
return b
}
// WithBaseImage sets the BaseImage field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the BaseImage field is set to the value of the last call.

View file

@ -34,6 +34,7 @@ type ServiceMonitorSpecApplyConfiguration struct {
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"`
}
@ -140,6 +141,14 @@ func (b *ServiceMonitorSpecApplyConfiguration) WithLabelValueLengthLimit(value u
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.
func (b *ServiceMonitorSpecApplyConfiguration) WithKeepDroppedTargets(value uint64) *ServiceMonitorSpecApplyConfiguration {
b.KeepDroppedTargets = &value
return b
}
// WithAttachMetadata sets the AttachMetadata 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 AttachMetadata field is set to the value of the last call.

View file

@ -536,6 +536,14 @@ func (b *PrometheusAgentSpecApplyConfiguration) WithEnforcedLabelValueLengthLimi
return b
}
// WithEnforcedKeepDroppedTargets sets the EnforcedKeepDroppedTargets 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 EnforcedKeepDroppedTargets field is set to the value of the last call.
func (b *PrometheusAgentSpecApplyConfiguration) WithEnforcedKeepDroppedTargets(value uint64) *PrometheusAgentSpecApplyConfiguration {
b.EnforcedKeepDroppedTargets = &value
return b
}
// WithEnforcedBodySizeLimit sets the EnforcedBodySizeLimit 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 EnforcedBodySizeLimit field is set to the value of the last call.
@ -672,3 +680,11 @@ func (b *PrometheusAgentSpecApplyConfiguration) WithLabelValueLengthLimit(value
b.LabelValueLengthLimit = &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.
func (b *PrometheusAgentSpecApplyConfiguration) WithKeepDroppedTargets(value uint64) *PrometheusAgentSpecApplyConfiguration {
b.KeepDroppedTargets = &value
return b
}

View file

@ -46,6 +46,7 @@ type ScrapeConfigSpecApplyConfiguration struct {
LabelLimit *uint64 `json:"labelLimit,omitempty"`
LabelNameLengthLimit *uint64 `json:"labelNameLengthLimit,omitempty"`
LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"`
KeepDroppedTargets *uint64 `json:"keepDroppedTargets,omitempty"`
MetricRelabelConfigs []*v1.RelabelConfig `json:"metricRelabelings,omitempty"`
}
@ -272,6 +273,14 @@ func (b *ScrapeConfigSpecApplyConfiguration) WithLabelValueLengthLimit(value uin
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.
func (b *ScrapeConfigSpecApplyConfiguration) WithKeepDroppedTargets(value uint64) *ScrapeConfigSpecApplyConfiguration {
b.KeepDroppedTargets = &value
return b
}
// WithMetricRelabelConfigs adds the given value to the MetricRelabelConfigs field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the MetricRelabelConfigs field.

View file

@ -205,6 +205,11 @@ var (
prometheusField: "label_value_length_limit",
minVersion: "2.27.0",
}
keepDroppedTargetsKey = limitKey{
specField: "keepDroppedTargets",
prometheusField: "keep_dropped_targets",
minVersion: "2.47.0",
}
)
// AddLimitsToYAML appends the given limit key to the configuration if
@ -851,6 +856,7 @@ func (cg *ConfigGenerator) generatePodMonitorConfig(
cfg = cg.AddLimitsToYAML(cfg, labelLimitKey, m.Spec.LabelLimit, cpf.EnforcedLabelLimit)
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)
if cpf.EnforcedBodySizeLimit != "" {
cfg = cg.WithMinimumVersion("2.28.0").AppendMapItem(cfg, "body_size_limit", cpf.EnforcedBodySizeLimit)
@ -908,6 +914,7 @@ func (cg *ConfigGenerator) generateProbeConfig(
cfg = cg.AddLimitsToYAML(cfg, labelLimitKey, m.Spec.LabelLimit, cpf.EnforcedLabelLimit)
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)
if cpf.EnforcedBodySizeLimit != "" {
cfg = cg.WithMinimumVersion("2.28.0").AppendMapItem(cfg, "body_size_limit", cpf.EnforcedBodySizeLimit)
@ -1351,6 +1358,7 @@ func (cg *ConfigGenerator) generateServiceMonitorConfig(
cfg = cg.AddLimitsToYAML(cfg, labelLimitKey, m.Spec.LabelLimit, cpf.EnforcedLabelLimit)
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)
if cpf.EnforcedBodySizeLimit != "" {
cfg = cg.WithMinimumVersion("2.28.0").AppendMapItem(cfg, "body_size_limit", cpf.EnforcedBodySizeLimit)
@ -1960,6 +1968,9 @@ func (cg *ConfigGenerator) appendScrapeLimits(slice yaml.MapSlice) yaml.MapSlice
if cpf.LabelValueLengthLimit != nil {
slice = cg.WithMinimumVersion("2.45.0").AppendMapItem(slice, "label_value_length_limit", *cpf.LabelValueLengthLimit)
}
if cpf.KeepDroppedTargets != nil {
slice = cg.WithMinimumVersion("2.47.0").AppendMapItem(slice, "keep_dropped_targets", *cpf.KeepDroppedTargets)
}
return slice
}
@ -2260,6 +2271,7 @@ func (cg *ConfigGenerator) generateScrapeConfig(
cfg = cg.AddLimitsToYAML(cfg, labelLimitKey, sc.Spec.LabelLimit, cpf.EnforcedLabelLimit)
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)
if cpf.EnforcedBodySizeLimit != "" {
cfg = cg.WithMinimumVersion("2.28.0").AppendMapItem(cfg, "body_size_limit", cpf.EnforcedBodySizeLimit)

View file

@ -107,6 +107,7 @@ func TestGlobalSettings(t *testing.T) {
expectedLabelLimit uint64 = 50
expectedLabelNameLengthLimit uint64 = 40
expectedLabelValueLengthLimit uint64 = 30
expectedkeepDroppedTargets uint64 = 50
)
for _, tc := range []struct {
@ -125,6 +126,7 @@ func TestGlobalSettings(t *testing.T) {
LabelLimit *uint64
LabelNameLengthLimit *uint64
LabelValueLengthLimit *uint64
KeepDroppedTargets *uint64
ExpectError bool
Golden string
}{
@ -207,6 +209,14 @@ func TestGlobalSettings(t *testing.T) {
LabelValueLengthLimit: &expectedLabelValueLengthLimit,
Golden: "valid_global_config_with_label_limits.golden",
},
{
Scenario: "valid global config with keep dropped targets",
Version: "v2.47.0",
ScrapeInterval: "30s",
EvaluationInterval: "30s",
KeepDroppedTargets: &expectedkeepDroppedTargets,
Golden: "valid_global_config_with_keep_dropped_targets.golden",
},
} {
p := &monitoringv1.Prometheus{
@ -226,6 +236,7 @@ func TestGlobalSettings(t *testing.T) {
LabelLimit: tc.LabelLimit,
LabelNameLengthLimit: tc.LabelNameLengthLimit,
LabelValueLengthLimit: tc.LabelValueLengthLimit,
KeepDroppedTargets: tc.KeepDroppedTargets,
},
EvaluationInterval: tc.EvaluationInterval,
QueryLogFile: tc.QueryLogFile,
@ -5510,6 +5521,86 @@ scrape_configs:
}
}
func TestKeepDroppedTargets(t *testing.T) {
for _, tc := range []struct {
version string
enforcedKeepDroppedTargets *uint64
keepDroppedTargets *uint64
golden string
}{
{
version: "v2.46.0",
enforcedKeepDroppedTargets: ptr.To(uint64(1000)),
keepDroppedTargets: ptr.To(uint64(50)),
golden: "KeepDroppedTargetsNotAddedInConfig.golden",
},
{
version: "v2.47.0",
enforcedKeepDroppedTargets: ptr.To(uint64(1000)),
keepDroppedTargets: ptr.To(uint64(2000)),
golden: "KeepDroppedTargetsOverridedWithEnforcedValue.golden",
},
{
version: "v2.47.0",
enforcedKeepDroppedTargets: ptr.To(uint64(1000)),
keepDroppedTargets: ptr.To(uint64(500)),
golden: "KeepDroppedTargets.golden",
},
} {
t.Run(fmt.Sprintf("%s enforcedKeepDroppedTargets(%d) keepDroppedTargets(%d)", tc.version, tc.enforcedKeepDroppedTargets, tc.keepDroppedTargets), func(t *testing.T) {
p := defaultPrometheus()
p.Spec.CommonPrometheusFields.Version = tc.version
p.Spec.EnforcedKeepDroppedTargets = tc.enforcedKeepDroppedTargets
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.KeepDroppedTargets = tc.keepDroppedTargets
cg := mustNewConfigGenerator(t, p)
cfg, err := cg.GenerateServerConfiguration(
context.Background(),
p.Spec.EvaluationInterval,
p.Spec.QueryLogFile,
p.Spec.RuleSelector,
p.Spec.Exemplars,
p.Spec.TSDB,
p.Spec.Alerting,
p.Spec.RemoteRead,
map[string]*monitoringv1.ServiceMonitor{
"testservicemonitor1": &serviceMonitor,
},
nil,
nil,
nil,
&assets.Store{},
nil,
nil,
nil,
nil,
)
require.NoError(t, err)
golden.Assert(t, string(cfg), tc.golden)
})
}
}
func TestBodySizeLimits(t *testing.T) {
expectNoLimit := `global:
evaluation_interval: 30s

70
pkg/prometheus/testdata/KeepDroppedTargets.golden generated vendored Normal file
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
keep_dropped_targets: 500
metric_relabel_configs: []

View file

@ -0,0 +1,69 @@
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
metric_relabel_configs: []

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
keep_dropped_targets: 1000
metric_relabel_configs: []

View file

@ -0,0 +1,8 @@
global:
evaluation_interval: 30s
scrape_interval: 30s
external_labels:
prometheus: /
prometheus_replica: $(POD_NAME)
keep_dropped_targets: 50
scrape_configs: []