mirror of
https://github.com/prometheus-operator/prometheus-operator.git
synced 2025-04-15 16:56:24 +00:00
feat: support scrape_protocols for GlobalConfig and ScrapeConfig (#6235)
* support scrape_protocols for GlobalConfig and ScrapeConfig --------- Signed-off-by: dongjiang1989 <dongjiang1989@126.com> Co-authored-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
parent
57e4f8f576
commit
18265de80e
23 changed files with 490 additions and 7 deletions
132
Documentation/api.md
generated
132
Documentation/api.md
generated
|
@ -1724,6 +1724,23 @@ Duration
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>scrapeProtocols</code><br/>
|
||||
<em>
|
||||
<a href="#monitoring.coreos.com/v1.ScrapeProtocol">
|
||||
[]ScrapeProtocol
|
||||
</a>
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>The protocols to negotiate during a scrape. It tells clients the
|
||||
protocols supported by Prometheus in order of preference (from most to least preferred).</p>
|
||||
<p>If unset, Prometheus uses its default value.</p>
|
||||
<p>It requires Prometheus >= v2.49.0.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>externalLabels</code><br/>
|
||||
<em>
|
||||
map[string]string
|
||||
|
@ -6129,6 +6146,23 @@ Duration
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>scrapeProtocols</code><br/>
|
||||
<em>
|
||||
<a href="#monitoring.coreos.com/v1.ScrapeProtocol">
|
||||
[]ScrapeProtocol
|
||||
</a>
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>The protocols to negotiate during a scrape. It tells clients the
|
||||
protocols supported by Prometheus in order of preference (from most to least preferred).</p>
|
||||
<p>If unset, Prometheus uses its default value.</p>
|
||||
<p>It requires Prometheus >= v2.49.0.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>externalLabels</code><br/>
|
||||
<em>
|
||||
map[string]string
|
||||
|
@ -10279,6 +10313,23 @@ Duration
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>scrapeProtocols</code><br/>
|
||||
<em>
|
||||
<a href="#monitoring.coreos.com/v1.ScrapeProtocol">
|
||||
[]ScrapeProtocol
|
||||
</a>
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>The protocols to negotiate during a scrape. It tells clients the
|
||||
protocols supported by Prometheus in order of preference (from most to least preferred).</p>
|
||||
<p>If unset, Prometheus uses its default value.</p>
|
||||
<p>It requires Prometheus >= v2.49.0.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>externalLabels</code><br/>
|
||||
<em>
|
||||
map[string]string
|
||||
|
@ -13011,6 +13062,19 @@ bool
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h3 id="monitoring.coreos.com/v1.ScrapeProtocol">ScrapeProtocol
|
||||
(<code>string</code> alias)</h3>
|
||||
<p>
|
||||
(<em>Appears on:</em><a href="#monitoring.coreos.com/v1.CommonPrometheusFields">CommonPrometheusFields</a>, <a href="#monitoring.coreos.com/v1alpha1.ScrapeConfigSpec">ScrapeConfigSpec</a>)
|
||||
</p>
|
||||
<div>
|
||||
<p>ScrapeProtocol represents a protocol used by Prometheus for scraping metrics.
|
||||
Supported values are:
|
||||
* <code>OpenMetricsText0.0.1</code>
|
||||
* <code>OpenMetricsText1.0.0</code>
|
||||
* <code>PrometheusProto</code>
|
||||
* <code>PrometheusText0.0.4</code></p>
|
||||
</div>
|
||||
<h3 id="monitoring.coreos.com/v1.SecretOrConfigMap">SecretOrConfigMap
|
||||
</h3>
|
||||
<p>
|
||||
|
@ -15873,6 +15937,23 @@ Duration
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>scrapeProtocols</code><br/>
|
||||
<em>
|
||||
<a href="#monitoring.coreos.com/v1.ScrapeProtocol">
|
||||
[]ScrapeProtocol
|
||||
</a>
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>The protocols to negotiate during a scrape. It tells clients the
|
||||
protocols supported by Prometheus in order of preference (from most to least preferred).</p>
|
||||
<p>If unset, Prometheus uses its default value.</p>
|
||||
<p>It requires Prometheus >= v2.49.0.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>externalLabels</code><br/>
|
||||
<em>
|
||||
map[string]string
|
||||
|
@ -17023,6 +17104,23 @@ Duration
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>scrapeProtocols</code><br/>
|
||||
<em>
|
||||
<a href="#monitoring.coreos.com/v1.ScrapeProtocol">
|
||||
[]ScrapeProtocol
|
||||
</a>
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>The protocols to negotiate during a scrape. It tells clients the
|
||||
protocols supported by Prometheus in order of preference (from most to least preferred).</p>
|
||||
<p>If unset, Prometheus uses its default value.</p>
|
||||
<p>It requires Prometheus >= v2.49.0.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>honorTimestamps</code><br/>
|
||||
<em>
|
||||
bool
|
||||
|
@ -20652,6 +20750,23 @@ Duration
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>scrapeProtocols</code><br/>
|
||||
<em>
|
||||
<a href="#monitoring.coreos.com/v1.ScrapeProtocol">
|
||||
[]ScrapeProtocol
|
||||
</a>
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>The protocols to negotiate during a scrape. It tells clients the
|
||||
protocols supported by Prometheus in order of preference (from most to least preferred).</p>
|
||||
<p>If unset, Prometheus uses its default value.</p>
|
||||
<p>It requires Prometheus >= v2.49.0.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>externalLabels</code><br/>
|
||||
<em>
|
||||
map[string]string
|
||||
|
@ -22571,6 +22686,23 @@ Duration
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>scrapeProtocols</code><br/>
|
||||
<em>
|
||||
<a href="#monitoring.coreos.com/v1.ScrapeProtocol">
|
||||
[]ScrapeProtocol
|
||||
</a>
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>The protocols to negotiate during a scrape. It tells clients the
|
||||
protocols supported by Prometheus in order of preference (from most to least preferred).</p>
|
||||
<p>If unset, Prometheus uses its default value.</p>
|
||||
<p>It requires Prometheus >= v2.49.0.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>honorTimestamps</code><br/>
|
||||
<em>
|
||||
bool
|
||||
|
|
51
bundle.yaml
generated
51
bundle.yaml
generated
|
@ -19790,6 +19790,23 @@ spec:
|
|||
description: "Interval between consecutive scrapes. \n Default: \"30s\""
|
||||
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
|
||||
type: string
|
||||
scrapeProtocols:
|
||||
description: "The protocols to negotiate during a scrape. It tells
|
||||
clients the protocols supported by Prometheus in order of preference
|
||||
(from most to least preferred). \n If unset, Prometheus uses its
|
||||
default value. \n It requires Prometheus >= v2.49.0."
|
||||
items:
|
||||
description: 'ScrapeProtocol represents a protocol used by Prometheus
|
||||
for scraping metrics. Supported values are: * `OpenMetricsText0.0.1`
|
||||
* `OpenMetricsText1.0.0` * `PrometheusProto` * `PrometheusText0.0.4`'
|
||||
enum:
|
||||
- PrometheusProto
|
||||
- OpenMetricsText0.0.1
|
||||
- OpenMetricsText1.0.0
|
||||
- PrometheusText0.0.4
|
||||
type: string
|
||||
type: array
|
||||
x-kubernetes-list-type: set
|
||||
scrapeTimeout:
|
||||
description: Number of seconds to wait until a scrape request times
|
||||
out.
|
||||
|
@ -29317,6 +29334,23 @@ spec:
|
|||
description: "Interval between consecutive scrapes. \n Default: \"30s\""
|
||||
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
|
||||
type: string
|
||||
scrapeProtocols:
|
||||
description: "The protocols to negotiate during a scrape. It tells
|
||||
clients the protocols supported by Prometheus in order of preference
|
||||
(from most to least preferred). \n If unset, Prometheus uses its
|
||||
default value. \n It requires Prometheus >= v2.49.0."
|
||||
items:
|
||||
description: 'ScrapeProtocol represents a protocol used by Prometheus
|
||||
for scraping metrics. Supported values are: * `OpenMetricsText0.0.1`
|
||||
* `OpenMetricsText1.0.0` * `PrometheusProto` * `PrometheusText0.0.4`'
|
||||
enum:
|
||||
- PrometheusProto
|
||||
- OpenMetricsText0.0.1
|
||||
- OpenMetricsText1.0.0
|
||||
- PrometheusText0.0.4
|
||||
type: string
|
||||
type: array
|
||||
x-kubernetes-list-type: set
|
||||
scrapeTimeout:
|
||||
description: Number of seconds to wait until a scrape request times
|
||||
out.
|
||||
|
@ -35535,6 +35569,23 @@ spec:
|
|||
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)?)$
|
||||
type: string
|
||||
scrapeProtocols:
|
||||
description: "The protocols to negotiate during a scrape. It tells
|
||||
clients the protocols supported by Prometheus in order of preference
|
||||
(from most to least preferred). \n If unset, Prometheus uses its
|
||||
default value. \n It requires Prometheus >= v2.49.0."
|
||||
items:
|
||||
description: 'ScrapeProtocol represents a protocol used by Prometheus
|
||||
for scraping metrics. Supported values are: * `OpenMetricsText0.0.1`
|
||||
* `OpenMetricsText1.0.0` * `PrometheusProto` * `PrometheusText0.0.4`'
|
||||
enum:
|
||||
- PrometheusProto
|
||||
- OpenMetricsText0.0.1
|
||||
- OpenMetricsText1.0.0
|
||||
- PrometheusText0.0.4
|
||||
type: string
|
||||
type: array
|
||||
x-kubernetes-list-type: set
|
||||
scrapeTimeout:
|
||||
description: ScrapeTimeout is the number of seconds to wait until
|
||||
a scrape request times out.
|
||||
|
|
|
@ -5182,6 +5182,23 @@ spec:
|
|||
description: "Interval between consecutive scrapes. \n Default: \"30s\""
|
||||
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
|
||||
type: string
|
||||
scrapeProtocols:
|
||||
description: "The protocols to negotiate during a scrape. It tells
|
||||
clients the protocols supported by Prometheus in order of preference
|
||||
(from most to least preferred). \n If unset, Prometheus uses its
|
||||
default value. \n It requires Prometheus >= v2.49.0."
|
||||
items:
|
||||
description: 'ScrapeProtocol represents a protocol used by Prometheus
|
||||
for scraping metrics. Supported values are: * `OpenMetricsText0.0.1`
|
||||
* `OpenMetricsText1.0.0` * `PrometheusProto` * `PrometheusText0.0.4`'
|
||||
enum:
|
||||
- PrometheusProto
|
||||
- OpenMetricsText0.0.1
|
||||
- OpenMetricsText1.0.0
|
||||
- PrometheusText0.0.4
|
||||
type: string
|
||||
type: array
|
||||
x-kubernetes-list-type: set
|
||||
scrapeTimeout:
|
||||
description: Number of seconds to wait until a scrape request times
|
||||
out.
|
||||
|
|
|
@ -6162,6 +6162,23 @@ spec:
|
|||
description: "Interval between consecutive scrapes. \n Default: \"30s\""
|
||||
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
|
||||
type: string
|
||||
scrapeProtocols:
|
||||
description: "The protocols to negotiate during a scrape. It tells
|
||||
clients the protocols supported by Prometheus in order of preference
|
||||
(from most to least preferred). \n If unset, Prometheus uses its
|
||||
default value. \n It requires Prometheus >= v2.49.0."
|
||||
items:
|
||||
description: 'ScrapeProtocol represents a protocol used by Prometheus
|
||||
for scraping metrics. Supported values are: * `OpenMetricsText0.0.1`
|
||||
* `OpenMetricsText1.0.0` * `PrometheusProto` * `PrometheusText0.0.4`'
|
||||
enum:
|
||||
- PrometheusProto
|
||||
- OpenMetricsText0.0.1
|
||||
- OpenMetricsText1.0.0
|
||||
- PrometheusText0.0.4
|
||||
type: string
|
||||
type: array
|
||||
x-kubernetes-list-type: set
|
||||
scrapeTimeout:
|
||||
description: Number of seconds to wait until a scrape request times
|
||||
out.
|
||||
|
|
|
@ -2299,6 +2299,23 @@ spec:
|
|||
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)?)$
|
||||
type: string
|
||||
scrapeProtocols:
|
||||
description: "The protocols to negotiate during a scrape. It tells
|
||||
clients the protocols supported by Prometheus in order of preference
|
||||
(from most to least preferred). \n If unset, Prometheus uses its
|
||||
default value. \n It requires Prometheus >= v2.49.0."
|
||||
items:
|
||||
description: 'ScrapeProtocol represents a protocol used by Prometheus
|
||||
for scraping metrics. Supported values are: * `OpenMetricsText0.0.1`
|
||||
* `OpenMetricsText1.0.0` * `PrometheusProto` * `PrometheusText0.0.4`'
|
||||
enum:
|
||||
- PrometheusProto
|
||||
- OpenMetricsText0.0.1
|
||||
- OpenMetricsText1.0.0
|
||||
- PrometheusText0.0.4
|
||||
type: string
|
||||
type: array
|
||||
x-kubernetes-list-type: set
|
||||
scrapeTimeout:
|
||||
description: ScrapeTimeout is the number of seconds to wait until
|
||||
a scrape request times out.
|
||||
|
|
|
@ -5183,6 +5183,23 @@ spec:
|
|||
description: "Interval between consecutive scrapes. \n Default: \"30s\""
|
||||
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
|
||||
type: string
|
||||
scrapeProtocols:
|
||||
description: "The protocols to negotiate during a scrape. It tells
|
||||
clients the protocols supported by Prometheus in order of preference
|
||||
(from most to least preferred). \n If unset, Prometheus uses its
|
||||
default value. \n It requires Prometheus >= v2.49.0."
|
||||
items:
|
||||
description: 'ScrapeProtocol represents a protocol used by Prometheus
|
||||
for scraping metrics. Supported values are: * `OpenMetricsText0.0.1`
|
||||
* `OpenMetricsText1.0.0` * `PrometheusProto` * `PrometheusText0.0.4`'
|
||||
enum:
|
||||
- PrometheusProto
|
||||
- OpenMetricsText0.0.1
|
||||
- OpenMetricsText1.0.0
|
||||
- PrometheusText0.0.4
|
||||
type: string
|
||||
type: array
|
||||
x-kubernetes-list-type: set
|
||||
scrapeTimeout:
|
||||
description: Number of seconds to wait until a scrape request times
|
||||
out.
|
||||
|
|
|
@ -6163,6 +6163,23 @@ spec:
|
|||
description: "Interval between consecutive scrapes. \n Default: \"30s\""
|
||||
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
|
||||
type: string
|
||||
scrapeProtocols:
|
||||
description: "The protocols to negotiate during a scrape. It tells
|
||||
clients the protocols supported by Prometheus in order of preference
|
||||
(from most to least preferred). \n If unset, Prometheus uses its
|
||||
default value. \n It requires Prometheus >= v2.49.0."
|
||||
items:
|
||||
description: 'ScrapeProtocol represents a protocol used by Prometheus
|
||||
for scraping metrics. Supported values are: * `OpenMetricsText0.0.1`
|
||||
* `OpenMetricsText1.0.0` * `PrometheusProto` * `PrometheusText0.0.4`'
|
||||
enum:
|
||||
- PrometheusProto
|
||||
- OpenMetricsText0.0.1
|
||||
- OpenMetricsText1.0.0
|
||||
- PrometheusText0.0.4
|
||||
type: string
|
||||
type: array
|
||||
x-kubernetes-list-type: set
|
||||
scrapeTimeout:
|
||||
description: Number of seconds to wait until a scrape request times
|
||||
out.
|
||||
|
|
|
@ -2300,6 +2300,23 @@ spec:
|
|||
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)?)$
|
||||
type: string
|
||||
scrapeProtocols:
|
||||
description: "The protocols to negotiate during a scrape. It tells
|
||||
clients the protocols supported by Prometheus in order of preference
|
||||
(from most to least preferred). \n If unset, Prometheus uses its
|
||||
default value. \n It requires Prometheus >= v2.49.0."
|
||||
items:
|
||||
description: 'ScrapeProtocol represents a protocol used by Prometheus
|
||||
for scraping metrics. Supported values are: * `OpenMetricsText0.0.1`
|
||||
* `OpenMetricsText1.0.0` * `PrometheusProto` * `PrometheusText0.0.4`'
|
||||
enum:
|
||||
- PrometheusProto
|
||||
- OpenMetricsText0.0.1
|
||||
- OpenMetricsText1.0.0
|
||||
- PrometheusText0.0.4
|
||||
type: string
|
||||
type: array
|
||||
x-kubernetes-list-type: set
|
||||
scrapeTimeout:
|
||||
description: ScrapeTimeout is the number of seconds to wait until
|
||||
a scrape request times out.
|
||||
|
|
|
@ -4722,6 +4722,21 @@
|
|||
"pattern": "^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$",
|
||||
"type": "string"
|
||||
},
|
||||
"scrapeProtocols": {
|
||||
"description": "The protocols to negotiate during a scrape. It tells clients the protocols supported by Prometheus in order of preference (from most to least preferred). \n If unset, Prometheus uses its default value. \n It requires Prometheus >= v2.49.0.",
|
||||
"items": {
|
||||
"description": "ScrapeProtocol represents a protocol used by Prometheus for scraping metrics. Supported values are: * `OpenMetricsText0.0.1` * `OpenMetricsText1.0.0` * `PrometheusProto` * `PrometheusText0.0.4`",
|
||||
"enum": [
|
||||
"PrometheusProto",
|
||||
"OpenMetricsText0.0.1",
|
||||
"OpenMetricsText1.0.0",
|
||||
"PrometheusText0.0.4"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array",
|
||||
"x-kubernetes-list-type": "set"
|
||||
},
|
||||
"scrapeTimeout": {
|
||||
"description": "Number of seconds to wait until a scrape request times out.",
|
||||
"pattern": "^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$",
|
||||
|
|
|
@ -5732,6 +5732,21 @@
|
|||
"pattern": "^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$",
|
||||
"type": "string"
|
||||
},
|
||||
"scrapeProtocols": {
|
||||
"description": "The protocols to negotiate during a scrape. It tells clients the protocols supported by Prometheus in order of preference (from most to least preferred). \n If unset, Prometheus uses its default value. \n It requires Prometheus >= v2.49.0.",
|
||||
"items": {
|
||||
"description": "ScrapeProtocol represents a protocol used by Prometheus for scraping metrics. Supported values are: * `OpenMetricsText0.0.1` * `OpenMetricsText1.0.0` * `PrometheusProto` * `PrometheusText0.0.4`",
|
||||
"enum": [
|
||||
"PrometheusProto",
|
||||
"OpenMetricsText0.0.1",
|
||||
"OpenMetricsText1.0.0",
|
||||
"PrometheusText0.0.4"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array",
|
||||
"x-kubernetes-list-type": "set"
|
||||
},
|
||||
"scrapeTimeout": {
|
||||
"description": "Number of seconds to wait until a scrape request times out.",
|
||||
"pattern": "^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$",
|
||||
|
|
|
@ -2470,6 +2470,21 @@
|
|||
"pattern": "^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$",
|
||||
"type": "string"
|
||||
},
|
||||
"scrapeProtocols": {
|
||||
"description": "The protocols to negotiate during a scrape. It tells clients the protocols supported by Prometheus in order of preference (from most to least preferred). \n If unset, Prometheus uses its default value. \n It requires Prometheus >= v2.49.0.",
|
||||
"items": {
|
||||
"description": "ScrapeProtocol represents a protocol used by Prometheus for scraping metrics. Supported values are: * `OpenMetricsText0.0.1` * `OpenMetricsText1.0.0` * `PrometheusProto` * `PrometheusText0.0.4`",
|
||||
"enum": [
|
||||
"PrometheusProto",
|
||||
"OpenMetricsText0.0.1",
|
||||
"OpenMetricsText1.0.0",
|
||||
"PrometheusText0.0.4"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array",
|
||||
"x-kubernetes-list-type": "set"
|
||||
},
|
||||
"scrapeTimeout": {
|
||||
"description": "ScrapeTimeout is the number of seconds to wait until a scrape request times out.",
|
||||
"pattern": "^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$",
|
||||
|
|
|
@ -32,6 +32,15 @@ const (
|
|||
PrometheusKindKey = "prometheus"
|
||||
)
|
||||
|
||||
// ScrapeProtocol represents a protocol used by Prometheus for scraping metrics.
|
||||
// Supported values are:
|
||||
// * `OpenMetricsText0.0.1`
|
||||
// * `OpenMetricsText1.0.0`
|
||||
// * `PrometheusProto`
|
||||
// * `PrometheusText0.0.4`
|
||||
// +kubebuilder:validation:Enum=PrometheusProto;OpenMetricsText0.0.1;OpenMetricsText1.0.0;PrometheusText0.0.4
|
||||
type ScrapeProtocol string
|
||||
|
||||
// PrometheusInterface is used by Prometheus and PrometheusAgent to share common methods, e.g. config generation.
|
||||
// +k8s:deepcopy-gen=false
|
||||
type PrometheusInterface interface {
|
||||
|
@ -252,6 +261,17 @@ type CommonPrometheusFields struct {
|
|||
// Number of seconds to wait until a scrape request times out.
|
||||
ScrapeTimeout Duration `json:"scrapeTimeout,omitempty"`
|
||||
|
||||
// The protocols to negotiate during a scrape. It tells clients the
|
||||
// protocols supported by Prometheus in order of preference (from most to least preferred).
|
||||
//
|
||||
// If unset, Prometheus uses its default value.
|
||||
//
|
||||
// It requires Prometheus >= v2.49.0.
|
||||
//
|
||||
// +listType=set
|
||||
// +optional
|
||||
ScrapeProtocols []ScrapeProtocol `json:"scrapeProtocols,omitempty"`
|
||||
|
||||
// The labels to add to any time series or alerts when communicating with
|
||||
// external systems (federation, remote storage, Alertmanager).
|
||||
// Labels defined by `spec.replicaExternalLabelName` and
|
||||
|
|
5
pkg/apis/monitoring/v1/zz_generated.deepcopy.go
generated
5
pkg/apis/monitoring/v1/zz_generated.deepcopy.go
generated
|
@ -681,6 +681,11 @@ func (in *CommonPrometheusFields) DeepCopyInto(out *CommonPrometheusFields) {
|
|||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
if in.ScrapeProtocols != nil {
|
||||
in, out := &in.ScrapeProtocols, &out.ScrapeProtocols
|
||||
*out = make([]ScrapeProtocol, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.ExternalLabels != nil {
|
||||
in, out := &in.ExternalLabels, &out.ExternalLabels
|
||||
*out = make(map[string]string, len(*in))
|
||||
|
|
|
@ -160,6 +160,16 @@ type ScrapeConfigSpec struct {
|
|||
// ScrapeTimeout is the number of seconds to wait until a scrape request times out.
|
||||
// +optional
|
||||
ScrapeTimeout *v1.Duration `json:"scrapeTimeout,omitempty"`
|
||||
// The protocols to negotiate during a scrape. It tells clients the
|
||||
// protocols supported by Prometheus in order of preference (from most to least preferred).
|
||||
//
|
||||
// If unset, Prometheus uses its default value.
|
||||
//
|
||||
// It requires Prometheus >= v2.49.0.
|
||||
//
|
||||
// +listType=set
|
||||
// +optional
|
||||
ScrapeProtocols []v1.ScrapeProtocol `json:"scrapeProtocols,omitempty"`
|
||||
// HonorTimestamps controls whether Prometheus respects the timestamps present in scraped data.
|
||||
// +optional
|
||||
HonorTimestamps *bool `json:"honorTimestamps,omitempty"`
|
||||
|
|
|
@ -1660,6 +1660,11 @@ func (in *ScrapeConfigSpec) DeepCopyInto(out *ScrapeConfigSpec) {
|
|||
*out = new(monitoringv1.Duration)
|
||||
**out = **in
|
||||
}
|
||||
if in.ScrapeProtocols != nil {
|
||||
in, out := &in.ScrapeProtocols, &out.ScrapeProtocols
|
||||
*out = make([]monitoringv1.ScrapeProtocol, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.HonorTimestamps != nil {
|
||||
in, out := &in.HonorTimestamps, &out.HonorTimestamps
|
||||
*out = new(bool)
|
||||
|
|
|
@ -48,6 +48,7 @@ type CommonPrometheusFieldsApplyConfiguration struct {
|
|||
LogFormat *string `json:"logFormat,omitempty"`
|
||||
ScrapeInterval *monitoringv1.Duration `json:"scrapeInterval,omitempty"`
|
||||
ScrapeTimeout *monitoringv1.Duration `json:"scrapeTimeout,omitempty"`
|
||||
ScrapeProtocols []monitoringv1.ScrapeProtocol `json:"scrapeProtocols,omitempty"`
|
||||
ExternalLabels map[string]string `json:"externalLabels,omitempty"`
|
||||
EnableRemoteWriteReceiver *bool `json:"enableRemoteWriteReceiver,omitempty"`
|
||||
EnableFeatures []string `json:"enableFeatures,omitempty"`
|
||||
|
@ -290,6 +291,16 @@ func (b *CommonPrometheusFieldsApplyConfiguration) WithScrapeTimeout(value monit
|
|||
return b
|
||||
}
|
||||
|
||||
// WithScrapeProtocols adds the given value to the ScrapeProtocols 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 ScrapeProtocols field.
|
||||
func (b *CommonPrometheusFieldsApplyConfiguration) WithScrapeProtocols(values ...monitoringv1.ScrapeProtocol) *CommonPrometheusFieldsApplyConfiguration {
|
||||
for i := range values {
|
||||
b.ScrapeProtocols = append(b.ScrapeProtocols, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithExternalLabels puts the entries into the ExternalLabels field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the ExternalLabels field,
|
||||
|
|
|
@ -235,6 +235,16 @@ func (b *PrometheusSpecApplyConfiguration) WithScrapeTimeout(value monitoringv1.
|
|||
return b
|
||||
}
|
||||
|
||||
// WithScrapeProtocols adds the given value to the ScrapeProtocols 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 ScrapeProtocols field.
|
||||
func (b *PrometheusSpecApplyConfiguration) WithScrapeProtocols(values ...monitoringv1.ScrapeProtocol) *PrometheusSpecApplyConfiguration {
|
||||
for i := range values {
|
||||
b.ScrapeProtocols = append(b.ScrapeProtocols, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithExternalLabels puts the entries into the ExternalLabels field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the ExternalLabels field,
|
||||
|
|
|
@ -214,6 +214,16 @@ func (b *PrometheusAgentSpecApplyConfiguration) WithScrapeTimeout(value monitori
|
|||
return b
|
||||
}
|
||||
|
||||
// WithScrapeProtocols adds the given value to the ScrapeProtocols 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 ScrapeProtocols field.
|
||||
func (b *PrometheusAgentSpecApplyConfiguration) WithScrapeProtocols(values ...monitoringv1.ScrapeProtocol) *PrometheusAgentSpecApplyConfiguration {
|
||||
for i := range values {
|
||||
b.ScrapeProtocols = append(b.ScrapeProtocols, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithExternalLabels puts the entries into the ExternalLabels field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the ExternalLabels field,
|
||||
|
|
|
@ -39,6 +39,7 @@ type ScrapeConfigSpecApplyConfiguration struct {
|
|||
MetricsPath *string `json:"metricsPath,omitempty"`
|
||||
ScrapeInterval *v1.Duration `json:"scrapeInterval,omitempty"`
|
||||
ScrapeTimeout *v1.Duration `json:"scrapeTimeout,omitempty"`
|
||||
ScrapeProtocols []v1.ScrapeProtocol `json:"scrapeProtocols,omitempty"`
|
||||
HonorTimestamps *bool `json:"honorTimestamps,omitempty"`
|
||||
TrackTimestampsStaleness *bool `json:"trackTimestampsStaleness,omitempty"`
|
||||
HonorLabels *bool `json:"honorLabels,omitempty"`
|
||||
|
@ -244,6 +245,16 @@ func (b *ScrapeConfigSpecApplyConfiguration) WithScrapeTimeout(value v1.Duration
|
|||
return b
|
||||
}
|
||||
|
||||
// WithScrapeProtocols adds the given value to the ScrapeProtocols 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 ScrapeProtocols field.
|
||||
func (b *ScrapeConfigSpecApplyConfiguration) WithScrapeProtocols(values ...v1.ScrapeProtocol) *ScrapeConfigSpecApplyConfiguration {
|
||||
for i := range values {
|
||||
b.ScrapeProtocols = append(b.ScrapeProtocols, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithHonorTimestamps sets the HonorTimestamps 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 HonorTimestamps field is set to the value of the last call.
|
||||
|
|
|
@ -563,6 +563,7 @@ func (cg *ConfigGenerator) GenerateServerConfiguration(
|
|||
globalItems := yaml.MapSlice{}
|
||||
globalItems = cg.appendEvaluationInterval(globalItems, evaluationInterval)
|
||||
globalItems = cg.appendScrapeIntervals(globalItems)
|
||||
globalItems = cg.appendScrapeProtocols(globalItems)
|
||||
globalItems = cg.appendExternalLabels(globalItems)
|
||||
globalItems = cg.appendQueryLogFile(globalItems, queryLogFile)
|
||||
globalItems = cg.appendScrapeLimits(globalItems)
|
||||
|
@ -2064,6 +2065,16 @@ func (cg *ConfigGenerator) appendScrapeIntervals(slice yaml.MapSlice) yaml.MapSl
|
|||
return slice
|
||||
}
|
||||
|
||||
func (cg *ConfigGenerator) appendScrapeProtocols(slice yaml.MapSlice) yaml.MapSlice {
|
||||
cpf := cg.prom.GetCommonPrometheusFields()
|
||||
|
||||
if len(cpf.ScrapeProtocols) == 0 {
|
||||
return slice
|
||||
}
|
||||
|
||||
return cg.WithMinimumVersion("2.49.0").AppendMapItem(slice, "scrape_protocols", cpf.ScrapeProtocols)
|
||||
}
|
||||
|
||||
func (cg *ConfigGenerator) appendEvaluationInterval(slice yaml.MapSlice, evaluationInterval monitoringv1.Duration) yaml.MapSlice {
|
||||
return append(slice, yaml.MapItem{Key: "evaluation_interval", Value: evaluationInterval})
|
||||
}
|
||||
|
@ -2254,6 +2265,7 @@ func (cg *ConfigGenerator) GenerateAgentConfiguration(
|
|||
cfg := yaml.MapSlice{}
|
||||
globalItems := yaml.MapSlice{}
|
||||
globalItems = cg.appendScrapeIntervals(globalItems)
|
||||
globalItems = cg.appendScrapeProtocols(globalItems)
|
||||
globalItems = cg.appendExternalLabels(globalItems)
|
||||
globalItems = cg.appendScrapeLimits(globalItems)
|
||||
cfg = append(cfg, yaml.MapItem{Key: "global", Value: globalItems})
|
||||
|
@ -2379,6 +2391,10 @@ func (cg *ConfigGenerator) generateScrapeConfig(
|
|||
cfg = append(cfg, yaml.MapItem{Key: "scrape_timeout", Value: *sc.Spec.ScrapeTimeout})
|
||||
}
|
||||
|
||||
if len(sc.Spec.ScrapeProtocols) > 0 {
|
||||
cfg = cg.WithMinimumVersion("2.49.0").AppendMapItem(cfg, "scrape_protocols", sc.Spec.ScrapeProtocols)
|
||||
}
|
||||
|
||||
if sc.Spec.Scheme != nil {
|
||||
cfg = append(cfg, yaml.MapItem{Key: "scheme", Value: strings.ToLower(*sc.Spec.Scheme)})
|
||||
}
|
||||
|
|
|
@ -99,13 +99,18 @@ func TestConfigGeneration(t *testing.T) {
|
|||
|
||||
func TestGlobalSettings(t *testing.T) {
|
||||
var (
|
||||
expectedBodySizeLimit monitoringv1.ByteSize = "1000MB"
|
||||
expectedSampleLimit uint64 = 10000
|
||||
expectedTargetLimit uint64 = 1000
|
||||
expectedLabelLimit uint64 = 50
|
||||
expectedLabelNameLengthLimit uint64 = 40
|
||||
expectedLabelValueLengthLimit uint64 = 30
|
||||
expectedkeepDroppedTargets uint64 = 50
|
||||
expectedBodySizeLimit monitoringv1.ByteSize = "1000MB"
|
||||
expectedSampleLimit uint64 = 10000
|
||||
expectedTargetLimit uint64 = 1000
|
||||
expectedLabelLimit uint64 = 50
|
||||
expectedLabelNameLengthLimit uint64 = 40
|
||||
expectedLabelValueLengthLimit uint64 = 30
|
||||
expectedkeepDroppedTargets uint64 = 50
|
||||
expectedscrapeProtocols []monitoringv1.ScrapeProtocol = []monitoringv1.ScrapeProtocol{
|
||||
"OpenMetricsText1.0.0",
|
||||
"OpenMetricsText0.0.1",
|
||||
"PrometheusText0.0.4",
|
||||
}
|
||||
)
|
||||
|
||||
for _, tc := range []struct {
|
||||
|
@ -113,6 +118,7 @@ func TestGlobalSettings(t *testing.T) {
|
|||
EvaluationInterval monitoringv1.Duration
|
||||
ScrapeInterval monitoringv1.Duration
|
||||
ScrapeTimeout monitoringv1.Duration
|
||||
ScrapeProtocols []monitoringv1.ScrapeProtocol
|
||||
ExternalLabels map[string]string
|
||||
PrometheusExternalLabelName *string
|
||||
ReplicaExternalLabelName *string
|
||||
|
@ -215,6 +221,14 @@ func TestGlobalSettings(t *testing.T) {
|
|||
KeepDroppedTargets: &expectedkeepDroppedTargets,
|
||||
Golden: "valid_global_config_with_keep_dropped_targets.golden",
|
||||
},
|
||||
{
|
||||
Scenario: "valid global config with scrape protocols",
|
||||
Version: "v2.49.0",
|
||||
ScrapeInterval: "30s",
|
||||
EvaluationInterval: "30s",
|
||||
ScrapeProtocols: expectedscrapeProtocols,
|
||||
Golden: "valid_global_config_with_scrape_protocols.golden",
|
||||
},
|
||||
} {
|
||||
|
||||
p := &monitoringv1.Prometheus{
|
||||
|
@ -223,6 +237,7 @@ func TestGlobalSettings(t *testing.T) {
|
|||
CommonPrometheusFields: monitoringv1.CommonPrometheusFields{
|
||||
ScrapeInterval: tc.ScrapeInterval,
|
||||
ScrapeTimeout: tc.ScrapeTimeout,
|
||||
ScrapeProtocols: tc.ScrapeProtocols,
|
||||
ExternalLabels: tc.ExternalLabels,
|
||||
PrometheusExternalLabelName: tc.PrometheusExternalLabelName,
|
||||
ReplicaExternalLabelName: tc.ReplicaExternalLabelName,
|
||||
|
@ -5256,6 +5271,18 @@ func TestScrapeConfigSpecConfig(t *testing.T) {
|
|||
},
|
||||
golden: "ScrapeConfigSpecConfig_ScrapeTimeout.golden",
|
||||
},
|
||||
{
|
||||
name: "scrape_protocols",
|
||||
scSpec: monitoringv1alpha1.ScrapeConfigSpec{
|
||||
ScrapeProtocols: []monitoringv1.ScrapeProtocol{
|
||||
monitoringv1.ScrapeProtocol("PrometheusProto"),
|
||||
monitoringv1.ScrapeProtocol("OpenMetricsText1.0.0"),
|
||||
monitoringv1.ScrapeProtocol("OpenMetricsText0.0.1"),
|
||||
monitoringv1.ScrapeProtocol("PrometheusText0.0.4"),
|
||||
},
|
||||
},
|
||||
golden: "ScrapeConfigSpecConfig_ScrapeProtocols.golden",
|
||||
},
|
||||
{
|
||||
name: "non_empty_metric_relabel_config",
|
||||
scSpec: monitoringv1alpha1.ScrapeConfigSpec{
|
||||
|
|
17
pkg/prometheus/testdata/ScrapeConfigSpecConfig_ScrapeProtocols.golden
generated
vendored
Normal file
17
pkg/prometheus/testdata/ScrapeConfigSpecConfig_ScrapeProtocols.golden
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
global:
|
||||
evaluation_interval: 30s
|
||||
scrape_interval: 30s
|
||||
external_labels:
|
||||
prometheus: default/test
|
||||
prometheus_replica: $(POD_NAME)
|
||||
scrape_configs:
|
||||
- job_name: scrapeConfig/default/testscrapeconfig1
|
||||
scrape_protocols:
|
||||
- PrometheusProto
|
||||
- OpenMetricsText1.0.0
|
||||
- OpenMetricsText0.0.1
|
||||
- PrometheusText0.0.4
|
||||
relabel_configs:
|
||||
- source_labels:
|
||||
- job
|
||||
target_label: __tmp_prometheus_job_name
|
11
pkg/prometheus/testdata/valid_global_config_with_scrape_protocols.golden
generated
vendored
Normal file
11
pkg/prometheus/testdata/valid_global_config_with_scrape_protocols.golden
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
global:
|
||||
evaluation_interval: 30s
|
||||
scrape_interval: 30s
|
||||
scrape_protocols:
|
||||
- OpenMetricsText1.0.0
|
||||
- OpenMetricsText0.0.1
|
||||
- PrometheusText0.0.4
|
||||
external_labels:
|
||||
prometheus: /
|
||||
prometheus_replica: $(POD_NAME)
|
||||
scrape_configs: []
|
Loading…
Add table
Reference in a new issue