Giter Club home page Giter Club logo

Comments (7)

kyrmand-sv avatar kyrmand-sv commented on July 21, 2024 2

Hi! I have "properly" fixed this by manually adding the apparently missing labels for category, sloth_id, sloth_service and sloth_slo.
A "properly" generated recording rule looks like this:

record: slo:sli_error:ratio_rate3d
expr: |
some expression
labels:
category: latency
sloth_id: api-lb-requests-latency-rest
sloth_service: api-lb
sloth_slo: requests-latency-rest
sloth_window: 3d

For some reason, for the 30d/4w time window (the largest time window corresponding to the default-slo-period) these labels are not being generated. And this happens consistently like so:

record: slo:sli_error:ratio_rate4w
expr: |
some expression
labels:
sloth_window: 4w

Without looking at the code, my guess would be that label generation is handled differently for a recording rule corresponding to the default slo-period, be that 30 days or 4 weeks.

IMHO this is worth fixing. If one uses more than one file containing recording rules or a large number of recording rules the output can easily get cluttered due to the verbose output and spotting a true issue can become cumbersome.

from sloth.

slok avatar slok commented on July 21, 2024 1

Hello there!

Seeing that now the promtool warnings are no longer warnings, I did some tests in Prom, and seems that doesn't complain anymore at runtime about labels being replaced on the same recording rule (the ones calculated by the rule, are replaced by the ones set on the rule configuration). I've merged a PR that ads the labels on the one type of SLI rule that was missing (the optimized one).

Best,

from sloth.

slok avatar slok commented on July 21, 2024

Hi @kbudde!

In this case, is telling you that depending on the query executed by recording rule, you could have a conflict (maybe not). The thing is that Prometheus, at runtime (while executing the recording rule), will tell you if it is really a problem or not, at a static validation level, it can't be sure (that's why the warning).

The resulting recording rule will not collide (Sloth already handles this) because it will have unique labels (sloth_id and sloth_slo) those labels are inherited from the query (as you can see it discards sloth_window but not the other labels).

If you are having duplicated rules at runtime, is very likely that is not because of the generated rules and is more related with 2 Sloth instances running at the same time handling the same SLOs or similar stuff.

Hope this helps! If you have collision at runtime, please write in this same issue :)

best,

from sloth.

kbudde avatar kbudde commented on July 21, 2024

Hi @slok,
it's clear to me that the linter is not pointing to a real issue in this case as it is already implicitly by sloth.

The question is would you accept a PR which adds the the labels (sloth_id, sloth_slo) explicitly to generated recording rules?
The generated rule would be the same; just the definition would be more verbose to satisfy the linter.

from sloth.

hfgbarrigas avatar hfgbarrigas commented on July 21, 2024

I can verify the same behaviour, the 30d recording doesn't inherit the labels.

from sloth.

Limess avatar Limess commented on July 21, 2024

Worth noting that duplicate rools reported by promtool now failf by default in Prometheus 2.35.0:

prometheus/prometheus#10435

from sloth.

kyrmand-sv avatar kyrmand-sv commented on July 21, 2024

Thanks for correcting this!

from sloth.

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.