mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
Remove deprecated storage.tsdb.retention flag
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu> Signed-off-by: Julien <roidelapluie@o11y.eu>
This commit is contained in:
parent
8a5193d0e2
commit
7711cd5ab5
|
@ -251,11 +251,6 @@ func main() {
|
|||
runtime.SetMutexProfileFraction(20)
|
||||
}
|
||||
|
||||
var (
|
||||
oldFlagRetentionDuration model.Duration
|
||||
newFlagRetentionDuration model.Duration
|
||||
)
|
||||
|
||||
// Unregister the default GoCollector, and reregister with our defaults.
|
||||
if prometheus.Unregister(collectors.NewGoCollector()) {
|
||||
prometheus.MustRegister(
|
||||
|
@ -362,11 +357,8 @@ func main() {
|
|||
"Size at which to split the tsdb WAL segment files. Example: 100MB").
|
||||
Hidden().PlaceHolder("<bytes>").BytesVar(&cfg.tsdb.WALSegmentSize)
|
||||
|
||||
serverOnlyFlag(a, "storage.tsdb.retention", "[DEPRECATED] How long to retain samples in storage. This flag has been deprecated, use \"storage.tsdb.retention.time\" instead.").
|
||||
SetValue(&oldFlagRetentionDuration)
|
||||
|
||||
serverOnlyFlag(a, "storage.tsdb.retention.time", "How long to retain samples in storage. When this flag is set it overrides \"storage.tsdb.retention\". If neither this flag nor \"storage.tsdb.retention\" nor \"storage.tsdb.retention.size\" is set, the retention time defaults to "+defaultRetentionString+". Units Supported: y, w, d, h, m, s, ms.").
|
||||
SetValue(&newFlagRetentionDuration)
|
||||
serverOnlyFlag(a, "storage.tsdb.retention.time", "How long to retain samples in storage. If neither this flag nor \"storage.tsdb.retention.size\" is set, the retention time defaults to "+defaultRetentionString+". Units Supported: y, w, d, h, m, s, ms.").
|
||||
SetValue(&cfg.tsdb.RetentionDuration)
|
||||
|
||||
serverOnlyFlag(a, "storage.tsdb.retention.size", "Maximum number of bytes that can be stored for blocks. A unit is required, supported units: B, KB, MB, GB, TB, PB, EB. Ex: \"512MB\". Based on powers-of-2, so 1KB is 1024B.").
|
||||
BytesVar(&cfg.tsdb.MaxBytes)
|
||||
|
@ -571,17 +563,6 @@ func main() {
|
|||
cfg.web.RoutePrefix = "/" + strings.Trim(cfg.web.RoutePrefix, "/")
|
||||
|
||||
if !agentMode {
|
||||
// Time retention settings.
|
||||
if oldFlagRetentionDuration != 0 {
|
||||
level.Warn(logger).Log("deprecation_notice", "'storage.tsdb.retention' flag is deprecated use 'storage.tsdb.retention.time' instead.")
|
||||
cfg.tsdb.RetentionDuration = oldFlagRetentionDuration
|
||||
}
|
||||
|
||||
// When the new flag is set it takes precedence.
|
||||
if newFlagRetentionDuration != 0 {
|
||||
cfg.tsdb.RetentionDuration = newFlagRetentionDuration
|
||||
}
|
||||
|
||||
if cfg.tsdb.RetentionDuration == 0 && cfg.tsdb.MaxBytes == 0 {
|
||||
cfg.tsdb.RetentionDuration = defaultRetentionDuration
|
||||
level.Info(logger).Log("msg", "No time or size retention was set so using the default time retention", "duration", defaultRetentionDuration)
|
||||
|
|
|
@ -224,7 +224,7 @@
|
|||
"Args": [
|
||||
"--config.file=/etc/prometheus/prometheus.yml",
|
||||
"--storage.tsdb.path=/prometheus",
|
||||
"--storage.tsdb.retention=24h"
|
||||
"--storage.tsdb.retention.time=24h"
|
||||
],
|
||||
"Privileges": {
|
||||
"CredentialSpec": null,
|
||||
|
|
2
discovery/moby/testdata/swarmprom/tasks.json
vendored
2
discovery/moby/testdata/swarmprom/tasks.json
vendored
|
@ -973,7 +973,7 @@
|
|||
"Args": [
|
||||
"--config.file=/etc/prometheus/prometheus.yml",
|
||||
"--storage.tsdb.path=/prometheus",
|
||||
"--storage.tsdb.retention=24h"
|
||||
"--storage.tsdb.retention.time=24h"
|
||||
],
|
||||
"Privileges": {
|
||||
"CredentialSpec": null,
|
||||
|
|
|
@ -32,8 +32,7 @@ The Prometheus monitoring server
|
|||
| <code class="text-nowrap">--web.page-title</code> | Document title of Prometheus instance. | `Prometheus Time Series Collection and Processing Server` |
|
||||
| <code class="text-nowrap">--web.cors.origin</code> | Regex for CORS origin. It is fully anchored. Example: 'https?://(domain1\|domain2)\.com' | `.*` |
|
||||
| <code class="text-nowrap">--storage.tsdb.path</code> | Base path for metrics storage. Use with server mode only. | `data/` |
|
||||
| <code class="text-nowrap">--storage.tsdb.retention</code> | [DEPRECATED] How long to retain samples in storage. This flag has been deprecated, use "storage.tsdb.retention.time" instead. Use with server mode only. | |
|
||||
| <code class="text-nowrap">--storage.tsdb.retention.time</code> | How long to retain samples in storage. When this flag is set it overrides "storage.tsdb.retention". If neither this flag nor "storage.tsdb.retention" nor "storage.tsdb.retention.size" is set, the retention time defaults to 15d. Units Supported: y, w, d, h, m, s, ms. Use with server mode only. | |
|
||||
| <code class="text-nowrap">--storage.tsdb.retention.time</code> | How long to retain samples in storage. If neither this flag nor "storage.tsdb.retention.size" is set, the retention time defaults to 15d. Units Supported: y, w, d, h, m, s, ms. Use with server mode only. | |
|
||||
| <code class="text-nowrap">--storage.tsdb.retention.size</code> | Maximum number of bytes that can be stored for blocks. A unit is required, supported units: B, KB, MB, GB, TB, PB, EB. Ex: "512MB". Based on powers-of-2, so 1KB is 1024B. Use with server mode only. | |
|
||||
| <code class="text-nowrap">--storage.tsdb.no-lockfile</code> | Do not create lockfile in data directory. Use with server mode only. | `false` |
|
||||
| <code class="text-nowrap">--storage.tsdb.head-chunks-write-queue-size</code> | Size of the queue through which head chunks are written to the disk to be m-mapped, 0 disables the queue completely. Experimental. Use with server mode only. | `0` |
|
||||
|
|
|
@ -87,10 +87,9 @@ or 31 days, whichever is smaller.
|
|||
Prometheus has several flags that configure local storage. The most important are:
|
||||
|
||||
- `--storage.tsdb.path`: Where Prometheus writes its database. Defaults to `data/`.
|
||||
- `--storage.tsdb.retention.time`: How long to retain samples in storage. When this flag is
|
||||
set, it overrides `storage.tsdb.retention`. If neither this flag nor `storage.tsdb.retention`
|
||||
nor `storage.tsdb.retention.size` is set, the retention time defaults to `15d`.
|
||||
Supported units: y, w, d, h, m, s, ms.
|
||||
- `--storage.tsdb.retention.time`: How long to retain samples in storage. If neither
|
||||
this flag nor `storage.tsdb.retention.size` is set, the retention time defaults to
|
||||
`15d`. Supported units: y, w, d, h, m, s, ms.
|
||||
- `--storage.tsdb.retention.size`: The maximum number of bytes of storage blocks to retain.
|
||||
The oldest data will be removed first. Defaults to `0` or disabled. Units supported:
|
||||
B, KB, MB, GB, TB, PB, EB. Ex: "512MB". Based on powers-of-2, so 1KB is 1024B. Only
|
||||
|
@ -98,7 +97,6 @@ Prometheus has several flags that configure local storage. The most important ar
|
|||
chunks are counted in the total size. So the minimum requirement for the disk is the
|
||||
peak space taken by the `wal` (the WAL and Checkpoint) and `chunks_head`
|
||||
(m-mapped Head chunks) directory combined (peaks every 2 hours).
|
||||
- `--storage.tsdb.retention`: Deprecated in favor of `storage.tsdb.retention.time`.
|
||||
- `--storage.tsdb.wal-compression`: Enables compression of the write-ahead log (WAL).
|
||||
Depending on your data, you can expect the WAL size to be halved with little extra
|
||||
cpu load. This flag was introduced in 2.11.0 and enabled by default in 2.20.0.
|
||||
|
|
|
@ -26,7 +26,6 @@ const sampleFlagsResponse = {
|
|||
'storage.tsdb.min-block-duration': '2h',
|
||||
'storage.tsdb.no-lockfile': 'false',
|
||||
'storage.tsdb.path': 'data/',
|
||||
'storage.tsdb.retention': '0s',
|
||||
'storage.tsdb.retention.size': '0B',
|
||||
'storage.tsdb.retention.time': '0s',
|
||||
'storage.tsdb.wal-compression': 'false',
|
||||
|
|
|
@ -692,32 +692,6 @@ exports[`Flags should match snapshot 1`] = `
|
|||
/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
key="--storage.tsdb.retention"
|
||||
>
|
||||
<td
|
||||
className="flag-item"
|
||||
>
|
||||
<span
|
||||
dangerouslySetInnerHTML={
|
||||
Object {
|
||||
"__html": "--storage.tsdb.retention",
|
||||
}
|
||||
}
|
||||
/>
|
||||
</td>
|
||||
<td
|
||||
className="flag-value"
|
||||
>
|
||||
<span
|
||||
dangerouslySetInnerHTML={
|
||||
Object {
|
||||
"__html": "0s",
|
||||
}
|
||||
}
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
key="--storage.tsdb.retention.size"
|
||||
>
|
||||
|
|
Loading…
Reference in a new issue