Are evaluation periods on alarms being calculated correctly?

Asked by Eoghan Glynn

The evaluation period calculation:

https://github.com/spcs/synaps/blob/master/synaps-storm/multilang/resources/put_metric_bolt.py#L278

        now = utils.utcnow()
        end_idx = now.replace(second=0, microsecond=0)
        start_idx = end_idx - evaluation_periods * datetools.Minute()
        start_ana_idx = start_idx - datetools.Minute() * period

appears suspect, in particular the start index being set to now - evaluation_periods * datetools.Minute().

Shouldn't the factor on evaluation_periods be the period length as opposed to a constant one minute?

Question information

Language:
English Edit question
Status:
Solved
For:
Synaps Edit question
Assignee:
No assignee Edit question
Solved by:
Eoghan Glynn
Solved:
Last query:
Last reply:
Revision history for this message
June Yi (gochist) said :
#1

Yes, they are calculated correctly.

Regarding the evaluation periods, Synaps works differently than the AWS CW does.
Because it uses rolling statistics.

For example, if we have dataframe as below,

Timestamp / Average
2012-10-23 00:00:00 / 12.0
2012-10-23 00:01:00 / 9.0
2012-10-23 00:02:00 / 10.0
2012-10-23 00:03:00 / 10.5
2012-10-23 00:04:00 / 11.0
2012-10-23 00:05:00 / 20.0
2012-10-23 00:06:00 / 16.0

and alarm of which attributes is as below,

- periods: 120 (sec)
- evalutaion periods: 3 (times)

Synaps evaluates following datapoints rolled up at 2012-10-23 00:06:00,

2012-10-23 00:04:00 / 11.25 (= (10.5 + 11.0) / 2)
2012-10-23 00:05:00 / 15.5 (= (11.0 + 20.0) / 2)
2012-10-23 00:06:00 / 18.0 (= (20.0 + 16.0) / 2)

while AWS CW might evaluate the alarm at 2012-10-23 00:06:00.

2012-10-23 00:02:00 / 18.0 (= (9.0 + 10.0) / 2)
2012-10-23 00:04:00 / 15.25 (= (10.5 + 11.0) / 2)
2012-10-23 00:06:00 / 18.0 (= (20.0 + 16.0) / 2)

I hope it would be an answer for your question.

Revision history for this message
Eoghan Glynn (eglynn) said :
#2

Thanks for your patience June Yi and the excellent explantion!

So I now understand how the Synaps concept of evaluation_periods differs semantically from that of CW, i.e. it treats evaluation periods as over-lapping moving-average-style windows, as opposed to serial & disjoint time extents.

My concern though would be that this is a fundamentally different semantic, that is likely to confuse users familiar with AWS.

In general with AWS APIs cloned in openstack, we try to provide both API-level *and* semantic consistency ... i.e. if an API is known to behave in a certain way in AWS, we try to replicate that behavior as far as possible in openstack. Think of it as the principle of least astonishment ;)

At the very least this divergence in behavior would need to be well-flagged in the user documentation. But even so, I worry that it might become a blocker to wider Synaps adoption.

Revision history for this message
Joonwon Lee (joonwon) said :
#3

We definitely agree with your opinion about semantic consistency. What we should do is to define a new API (or extend CW API) for the rolling statistics of Synaps, and we want to do that with the help of OpenStack community.

We also appreciate your point about user documentation and will prepare them relevantly.

Revision history for this message
Josh (pacesysjosh) said :
#4

@June:

Trying to make sense of your sample data. Was this line a typo?

2012-10-23 00:04:00 / 11.25 (= (10.5 + 11.0) / 2)

Should it be:

2012-10-23 00:04:00 / 10.75 (= (10.5 + 11.0) / 2) ?

Cheers,
Josh

Revision history for this message
June Yi (gochist) said :
#5

@Josh:

You are right. It was a typo.

But current WIP version of Synaps is working differently as bp:aws-concept-evaluation-periods has been implemented.

Thank you,
June