Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why $label rotation in conditions? #108

Open
ghost opened this issue Dec 28, 2021 · 3 comments
Open

Why $label rotation in conditions? #108

ghost opened this issue Dec 28, 2021 · 3 comments
Labels
maybe later Non-critical enhancement or suggestion

Comments

@ghost
Copy link

ghost commented Dec 28, 2021

What's the reasoning behind having $label rotate through "cur", "min", "max", and provide $cur and $prev samples only relative to the label, when a condition is evaluated?

I'd like to be able to use all of the cur & prev sample values for "cur", "min", "max" in a single condition, which seems impossible right now. Am I missing something?

@sqshq
Copy link
Owner

sqshq commented Jan 3, 2022

A trigger condition was intended to be examined right after the particular value update. The values for all labels are updated independently, so the trigger conditions are independent as well. I don't think there is a good way to implement what you are asking in a backward-compatible way and not sure if it is a popular use case. But since triggers execute an arbitrary script, you can always save the most recent value for each label as an env variable, for example.

@ghost
Copy link
Author

ghost commented Jan 3, 2022

I see. Well, since min and max are both sampled, too, there is no direct way to calculate a percentage: cur.$lastknownsample * 100 / max.$lastknownsample; or the distance from the mean value: (max.$lastknownsample+min.$lastknownsample)/2 - cur.$lastknownsample.

Of course, rate-ms introduces a time offset between the sampled values, but I am thinking more about stuff that changes slowly, like file system space (quota changes; backup drives of different sizes swapped, and always mounted to the same mount point, etc.).

My suggestion would be a convenient naming for the dot notation that I have used in the above, like "cur.$last", or so.

@sqshq
Copy link
Owner

sqshq commented Jan 3, 2022

Thank you, I like the suggestion for the dot notation. Will consider to implement that.

@sqshq sqshq added the maybe later Non-critical enhancement or suggestion label Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maybe later Non-critical enhancement or suggestion
Projects
None yet
Development

No branches or pull requests

1 participant