← Back to team overview

graphite-dev team mailing list archive

Re: [Question #254901]: Stats normalize to 0 or 1, maybe conditional

 

Question #254901 on Graphite changed:
https://answers.launchpad.net/graphite/+question/254901

    Status: Open => Answered

Jason Dixon proposed the following answer:
This is a bit of a hack, but you could do something like this:

transformNull(
    offset(
        scale(
            removeBelowValue(foo.bar,1)
        ,0)
    ,1)
,0)

I start by removing everything below the value of 1, converting them to
nulls. You may need to adjust this to something like 0.0001 if you're
storing decimal values less than 1.

I then zero the remaining values and increment them to 1 (our "true"
values).

Lastly, I transform the null values back to 0 (our "false" values).

-- 
You received this question notification because you are a member of
graphite-dev, which is an answer contact for Graphite.