diff options
author | Boris Pavlovic <boris@pavlovic.me> | 2014-05-09 23:16:33 +0400 |
---|---|---|
committer | Boris Pavlovic <boris@pavlovic.me> | 2014-05-09 23:16:33 +0400 |
commit | 3dc7c225458fae37a15c622063386a1107491dd4 (patch) | |
tree | 40e74712f6c17d2deb90c720fc91fa723fe6225e | |
parent | 9762127dbe3305777cbd95724b730598b34f1e52 (diff) | |
download | osprofiler-0.0.1.tar.gz |
Add work around if not all messages were consumed by ceilometer0.0.1
If some ceilometer messages were lost we should set duration to 0ms.
-rw-r--r-- | osprofiler/notifier.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/osprofiler/notifier.py b/osprofiler/notifier.py index 763766b..48488ba 100644 --- a/osprofiler/notifier.py +++ b/osprofiler/notifier.py @@ -123,6 +123,13 @@ def parse_notifications(notifications): return (int)(deltatime.total_seconds() * 1000) for r in result.itervalues(): + # NOTE(boris-42): We are not able to guarantee that ceilometer consumed + # all messages => so we should at make duration 0ms. + if "started" not in r["info"]: + r["info"]["started"] = r["info"]["finished"] + if "finished" not in r["info"]: + r["info"]["finished"] = r["info"]["started"] + r["info"]["started"] = msec(r["info"]["started"] - started_at) r["info"]["finished"] = msec(r["info"]["finished"] - started_at) |