Git Product home page Git Product logo

Comments (6)

machine424 avatar machine424 commented on June 4, 2024

Thanks for reporting this. /flags returns the flags the user has set and the defaults as known to kingpin (the flags parser we use)

boilerplateFlags := kingpin.New("", "").Version("")
for _, f := range a.Model().Flags {
if boilerplateFlags.GetFlag(f.Name) != nil {
continue
}
cfg.web.Flags[f.Name] = f.Value.String()
}

For --storage.tsdb.retention.time, the default value we inform kingpin about is indeed 0s:

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)

as the zero value of
newFlagRetentionDuration model.Duration

15d is only used when neither --storage.tsdb.retention.time nor --storage.tsdb.retention.size is set. It's done here:

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

outside of kingpin (as it doesnโ€™t seem to support such advanced dependencies/conditions)

What we can do, is make https://prometheus.io/docs/prometheus/latest/storage/#operational-aspects as explicit as the description in

newFlagRetentionDuration model.Duration
and maybe add a sentence on the /flags page about how we consider the defaults.


We could set newFlagRetentionDuration as well to defaultRetentionDuration in

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)
}
to make kingpin know about the "real/final" default, but I don't think it's a good idea.

from prometheus.

jonathan-dev avatar jonathan-dev commented on June 4, 2024

Thanks a lot for the quick and detailed answer. The reason I noticed this behavior was because the cloudflare pint tool was complaining about my retention time being 0s and thus being shorter than some of the ranges that I was querying (like 2m). After that I was a bit confused whats going on because when I was running a query it seemed like that there was a history kept but I was not able to validate that it was the 15days claimed or just the cleanup running infrequently. After checking I just noticed that the /status endpoint shows me the 15d retention time when I do not use the flags which is kind of what I was looking for. Noting it under the operational aspects probably would also helpful I think.

from prometheus.

machine424 avatar machine424 commented on June 4, 2024

Let's start by making https://prometheus.io/docs/prometheus/latest/storage/#operational-aspects as clera as

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)
then.

from prometheus.

tesla59 avatar tesla59 commented on June 4, 2024

Let's start by making https://prometheus.io/docs/prometheus/latest/storage/#operational-aspects as clera as

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)

then.

Hi @machine424,
I have updated the doc as mentioned by u in the PR #13982
I'd like to further work on this task. Will work on this and let u know

from prometheus.

kushalShukla-web avatar kushalShukla-web commented on June 4, 2024

/assign

from prometheus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.