sampler
sampler copied to clipboard
Why $label rotation in conditions?
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?
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.
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.
Thank you, I like the suggestion for the dot notation. Will consider to implement that.