Git Product home page Git Product logo

Comments (4)

balbirthomas avatar balbirthomas commented on September 24, 2024

@sed-i The regular expression of the official docs is not something I would like to allow since this permits a "0s" time interval (apart from being rather verbose). If you can not find pressing reason why such durations should be allowed then I am inclined to close this ticket.

from prometheus-k8s-operator.

sed-i avatar sed-i commented on September 24, 2024

In the prometheus source for the client side I see both the long form and the short form being used

Didn't dive into go code.

from prometheus-k8s-operator.

balbirthomas avatar balbirthomas commented on September 24, 2024

In the prometheus source for the client side I see both the long form and the short form being used

That is a good observation. Though both their forms allow null values like "0s" and I am not aware of any reason why we would want to allow that. Hence I placed the restriction that leading digit must be non-zero. In any case we can always reopen this issue in the future if it crops up.

from prometheus-k8s-operator.

rbarry82 avatar rbarry82 commented on September 24, 2024

The duration must be greater than 0, which is actually sort-of at adds with the actual regex. Except that prometheus overtly checks for a return value of 0 (ok from the parser) and re-raises an error.

For the actual config, though, this is tricky. Which is actually checked from prometheus/common, so 0 is ok, (the type is declared here, and the SetValue() call here will call back out to Set in prometheus/common, which checks model.ParseDuration, which does allow zeros).

And even negative values... for some reason, the importance of either is actually verified later.

All of that is a long way of saying "the code paths were walked, 0 is ok, 5d1w is not", so despite the verbosity and allowing zero, the "long" regexp is the correct one.

from prometheus-k8s-operator.

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.