summaryrefslogtreecommitdiff
path: root/ceilometer/sample.py
diff options
context:
space:
mode:
authorgordon chung <gord@live.ca>2016-02-03 09:59:55 -0500
committergordon chung <gord@live.ca>2016-09-09 13:03:04 +0000
commit5750fddf288c749cacfc825753928f66e755758d (patch)
tree765b1bac0cc476f3816bf740950f1bdc635b11a5 /ceilometer/sample.py
parentf78849c9660b8e73aa2a65b12775804eced2ecdb (diff)
downloadceilometer-5750fddf288c749cacfc825753928f66e755758d.tar.gz
improve notification processing
this patches does multiple things: - it ignores batching when pulling from main queue to maintain as much ordering as possible. this avoids related messages split across multiple batches and one batch starting much farther along than another - it sets pipeline processing listeners to single thread. at this stage, the pipeline queue contains less messages and therefore very likely, thread1 and thread2 will grab related messages and race to set cache - adds sorting to pipeline queue so if batching is enabled, we can further ensure that messages are in order before processing. - enables batching by default. (one thread per listener grabbing one message at a time will be slow.) - offers better batching for direct to db dispatcher as resources are grouped Change-Id: Iac5b552bae1e73f93cbfc830b1e83510b1aceb9e
Diffstat (limited to 'ceilometer/sample.py')
-rw-r--r--ceilometer/sample.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/ceilometer/sample.py b/ceilometer/sample.py
index 933bc948..0f8e54e3 100644
--- a/ceilometer/sample.py
+++ b/ceilometer/sample.py
@@ -24,7 +24,7 @@ import copy
import uuid
from oslo_config import cfg
-
+from oslo_utils import timeutils
OPTS = [
cfg.StrOpt('sample_source',
@@ -99,6 +99,10 @@ class Sample(object):
def set_timestamp(self, timestamp):
self.timestamp = timestamp
+ def get_iso_timestamp(self):
+ return timeutils.parse_isotime(self.timestamp)
+
+
TYPE_GAUGE = 'gauge'
TYPE_DELTA = 'delta'
TYPE_CUMULATIVE = 'cumulative'