Skip to content

Commit 3a40dd9

Browse files
feat: add chunkEncoding field to TSDBSpec for runtime float encoding selection (prometheus-operator#8675)
* add chunk encoding Signed-off-by: dongjiang <dongjiang1989@126.com> * make generate Signed-off-by: dongjiang <dongjiang1989@126.com> * update by code review Signed-off-by: dongjiang <dongjiang1989@126.com> * update Signed-off-by: dongjiang <dongjiang1989@126.com> --------- Signed-off-by: dongjiang <dongjiang1989@126.com>
1 parent 7b97bc9 commit 3a40dd9

21 files changed

Lines changed: 667 additions & 20 deletions

Documentation/api-reference/api.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8302,6 +8302,64 @@ authentication.</p>
83028302
<p>ByteSize is a valid memory size type based on powers-of-2, so 1KB is 1024B.
83038303
Supported units: B, KB, KiB, MB, MiB, GB, GiB, TB, TiB, PB, PiB, EB, EiB Ex: <code>512MB</code>.</p>
83048304
</div>
8305+
<h3 id="monitoring.coreos.com/v1.ChunkEncodingFloats">ChunkEncodingFloats
8306+
(<code>string</code> alias)</h3>
8307+
<p>
8308+
(<em>Appears on:</em><a href="#monitoring.coreos.com/v1.ChunkEncodingSpec">ChunkEncodingSpec</a>)
8309+
</p>
8310+
<div>
8311+
</div>
8312+
<table>
8313+
<thead>
8314+
<tr>
8315+
<th>Value</th>
8316+
<th>Description</th>
8317+
</tr>
8318+
</thead>
8319+
<tbody><tr><td><p>&#34;Xor&#34;</p></td>
8320+
<td></td>
8321+
</tr><tr><td><p>&#34;Xor2&#34;</p></td>
8322+
<td></td>
8323+
</tr></tbody>
8324+
</table>
8325+
<h3 id="monitoring.coreos.com/v1.ChunkEncodingSpec">ChunkEncodingSpec
8326+
</h3>
8327+
<p>
8328+
(<em>Appears on:</em><a href="#monitoring.coreos.com/v1.TSDBSpec">TSDBSpec</a>)
8329+
</p>
8330+
<div>
8331+
<p>ChunkEncodingSpec configures per-chunk-type encoding overrides.</p>
8332+
</div>
8333+
<table>
8334+
<thead>
8335+
<tr>
8336+
<th>Field</th>
8337+
<th>Description</th>
8338+
</tr>
8339+
</thead>
8340+
<tbody>
8341+
<tr>
8342+
<td>
8343+
<code>floats</code><br/>
8344+
<em>
8345+
<a href="#monitoring.coreos.com/v1.ChunkEncodingFloats">
8346+
ChunkEncodingFloats
8347+
</a>
8348+
</em>
8349+
</td>
8350+
<td>
8351+
<em>(Optional)</em>
8352+
<p>floats selects the encoding used for float chunks.
8353+
Valid values are &ldquo;Xor&rdquo; and &ldquo;Xor2&rdquo;.</p>
8354+
<p>Notice:
8355+
* Setting &ldquo;Xor&rdquo; is incompatible with &ndash;enable-feature=st-storage
8356+
(XOR chunks do not store start timestamps).
8357+
* Setting &ldquo;Xor2&rdquo; automatically adds the <code>xor2-encoding</code> feature flag.</p>
8358+
<p>It requires Prometheus &gt;= v3.13.0.</p>
8359+
</td>
8360+
</tr>
8361+
</tbody>
8362+
</table>
83058363
<h3 id="monitoring.coreos.com/v1.ClusterTLSConfig">ClusterTLSConfig
83068364
</h3>
83078365
<p>
@@ -20590,6 +20648,23 @@ is about to happen soon.</p>
2059020648
<p>It requires Prometheus &gt;= v3.10.0.</p>
2059120649
</td>
2059220650
</tr>
20651+
<tr>
20652+
<td>
20653+
<code>chunkEncoding</code><br/>
20654+
<em>
20655+
<a href="#monitoring.coreos.com/v1.ChunkEncodingSpec">
20656+
ChunkEncodingSpec
20657+
</a>
20658+
</em>
20659+
</td>
20660+
<td>
20661+
<em>(Optional)</em>
20662+
<p>chunkEncoding configures per-chunk-type encoding overrides.</p>
20663+
<p>It requires Prometheus &gt;= v3.13.0.</p>
20664+
<p>Notice: Setting &ldquo;Xor&rdquo; is incompatible with &ndash;enable-feature=st-storage
20665+
(XOR chunks do not store start timestamps).</p>
20666+
</td>
20667+
</tr>
2059320668
</tbody>
2059420669
</table>
2059520670
<h3 id="monitoring.coreos.com/v1.ThanosRulerSpec">ThanosRulerSpec

bundle.yaml

Lines changed: 50 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/prometheus-operator-crd-full/monitoring.coreos.com_prometheusagents.yaml

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/prometheus-operator-crd-full/monitoring.coreos.com_prometheuses.yaml

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/prometheus-operator-crd/monitoring.coreos.com_prometheusagents.yaml

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/prometheus-operator-crd/monitoring.coreos.com_prometheuses.yaml

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jsonnet/prometheus-operator/prometheusagents-crd.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7461,6 +7461,20 @@
74617461
"tsdb": {
74627462
"description": "tsdb defines the runtime reloadable configuration of the timeseries database(TSDB).\nIt requires Prometheus >= v2.39.0 or PrometheusAgent >= v2.54.0.",
74637463
"properties": {
7464+
"chunkEncoding": {
7465+
"description": "chunkEncoding configures per-chunk-type encoding overrides.\n\nIt requires Prometheus >= v3.13.0.\n\nNotice: Setting \"Xor\" is incompatible with --enable-feature=st-storage\n(XOR chunks do not store start timestamps).",
7466+
"properties": {
7467+
"floats": {
7468+
"description": "floats selects the encoding used for float chunks.\nValid values are \"Xor\" and \"Xor2\".\n\nNotice:\n * Setting \"Xor\" is incompatible with --enable-feature=st-storage\n(XOR chunks do not store start timestamps).\n * Setting \"Xor2\" automatically adds the `xor2-encoding` feature flag.\n\nIt requires Prometheus >= v3.13.0.",
7469+
"enum": [
7470+
"Xor",
7471+
"Xor2"
7472+
],
7473+
"type": "string"
7474+
}
7475+
},
7476+
"type": "object"
7477+
},
74647478
"outOfOrderTimeWindow": {
74657479
"description": "outOfOrderTimeWindow defines how old an out-of-order/out-of-bounds sample can be with\nrespect to the TSDB max time.\n\nAn out-of-order/out-of-bounds sample is ingested into the TSDB as long as\nthe timestamp of the sample is >= (TSDB.MaxTime - outOfOrderTimeWindow).\n\nThis is an *experimental feature*, it may change in any upcoming release\nin a breaking way.\n\nIt requires Prometheus >= v2.39.0 or PrometheusAgent >= v2.54.0.",
74667480
"pattern": "^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$",

jsonnet/prometheus-operator/prometheuses-crd.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9483,6 +9483,20 @@
94839483
"tsdb": {
94849484
"description": "tsdb defines the runtime reloadable configuration of the timeseries database(TSDB).\nIt requires Prometheus >= v2.39.0 or PrometheusAgent >= v2.54.0.",
94859485
"properties": {
9486+
"chunkEncoding": {
9487+
"description": "chunkEncoding configures per-chunk-type encoding overrides.\n\nIt requires Prometheus >= v3.13.0.\n\nNotice: Setting \"Xor\" is incompatible with --enable-feature=st-storage\n(XOR chunks do not store start timestamps).",
9488+
"properties": {
9489+
"floats": {
9490+
"description": "floats selects the encoding used for float chunks.\nValid values are \"Xor\" and \"Xor2\".\n\nNotice:\n * Setting \"Xor\" is incompatible with --enable-feature=st-storage\n(XOR chunks do not store start timestamps).\n * Setting \"Xor2\" automatically adds the `xor2-encoding` feature flag.\n\nIt requires Prometheus >= v3.13.0.",
9491+
"enum": [
9492+
"Xor",
9493+
"Xor2"
9494+
],
9495+
"type": "string"
9496+
}
9497+
},
9498+
"type": "object"
9499+
},
94869500
"outOfOrderTimeWindow": {
94879501
"description": "outOfOrderTimeWindow defines how old an out-of-order/out-of-bounds sample can be with\nrespect to the TSDB max time.\n\nAn out-of-order/out-of-bounds sample is ingested into the TSDB as long as\nthe timestamp of the sample is >= (TSDB.MaxTime - outOfOrderTimeWindow).\n\nThis is an *experimental feature*, it may change in any upcoming release\nin a breaking way.\n\nIt requires Prometheus >= v2.39.0 or PrometheusAgent >= v2.54.0.",
94889502
"pattern": "^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$",

pkg/apis/monitoring/v1/prometheus_types.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2508,6 +2508,15 @@ type TSDBSpec struct {
25082508
// It requires Prometheus >= v3.10.0.
25092509
// +optional
25102510
StaleSeriesCompactionThreshold *resource.Quantity `json:"staleSeriesCompactionThreshold,omitempty"`
2511+
2512+
// chunkEncoding configures per-chunk-type encoding overrides.
2513+
//
2514+
// It requires Prometheus >= v3.13.0.
2515+
//
2516+
// Notice: Setting "Xor" is incompatible with --enable-feature=st-storage
2517+
// (XOR chunks do not store start timestamps).
2518+
// +optional
2519+
ChunkEncoding *ChunkEncodingSpec `json:"chunkEncoding,omitempty"`
25112520
}
25122521

25132522
// Validate semantically validates the given TSDBSpec.
@@ -2523,6 +2532,29 @@ func (ts *TSDBSpec) Validate() error {
25232532
return nil
25242533
}
25252534

2535+
// +kubebuilder:validation:Enum=Xor;Xor2
2536+
type ChunkEncodingFloats string
2537+
2538+
const (
2539+
ChunkEncodingFloatsXor ChunkEncodingFloats = "Xor"
2540+
ChunkEncodingFloatsXor2 ChunkEncodingFloats = "Xor2"
2541+
)
2542+
2543+
// ChunkEncodingSpec configures per-chunk-type encoding overrides.
2544+
type ChunkEncodingSpec struct {
2545+
// floats selects the encoding used for float chunks.
2546+
// Valid values are "Xor" and "Xor2".
2547+
//
2548+
// Notice:
2549+
// * Setting "Xor" is incompatible with --enable-feature=st-storage
2550+
// (XOR chunks do not store start timestamps).
2551+
// * Setting "Xor2" automatically adds the `xor2-encoding` feature flag.
2552+
//
2553+
// It requires Prometheus >= v3.13.0.
2554+
// +optional
2555+
Floats *ChunkEncodingFloats `json:"floats,omitempty"`
2556+
}
2557+
25262558
type Exemplars struct {
25272559
// maxSize defines the maximum number of exemplars stored in memory for all series.
25282560
//

0 commit comments

Comments
 (0)