Evaluation of archive_policy_rules is unspecified
Bug #1501344 reported by
Julien Danjou
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Gnocchi |
Fix Released
|
Medium
|
gordon chung |
Bug Description
It's not written in the doc so we don't know if the code has any check on that.
Could be useful to know if we want to use an archive_policy_rule with '*' as metric_pattern.
Changed in gnocchi: | |
status: | New → Triaged |
importance: | Undecided → Medium |
Changed in gnocchi: | |
assignee: | nobody → gordon chung (chungg) |
Changed in gnocchi: | |
milestone: | none → 1.3.0 |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
here's our fix to the issue, and to define a default rule to match everything that doesnt match previous criteria.
the result is as follow ( sorting the policy rules by metric_pattern ) in a way that a rule with "*" will allways analyzed at the end acting as DEFAULT rule.
+------ ----+-- ------- ------- -----+- ------- ------- -+ ----+-- ------- ------- -----+- ------- ------- -+ ----+-- ------- ------- -----+- ------- ------- -+
| name | archive_policy_name | metric_pattern |
+------
| test_mem | test_mem | mem* |
| test54 | maximo1 | disk.usage.* |
| test_io | test_io | disk* |
| test55 | alejandrito1 | cpu.idle.* |
| test_cpu | test_cpu | cpu* |
| default | default | * |
+------
The proposed change is to change line :
https:/ /github. com/openstack/ gnocchi/ blob/master/ gnocchi/ indexer/ sqlalchemy. py#L166
and replace
aps = session. query(ArchivePo licyRule) .all()
by
aps = session. query(ArchivePo licyRule) .order_ by(ArchivePolic yRule.metric_ pattern. desc()) .all()