minimise the use of hmac
- computing a signature from hmac requires significant overhead. don't compute it for each pipeline. - also adds in missing support to verify signature at pipeline. Change-Id: Idfec6dfb645d581f6bc55264a042f6792c26df75 Partial-Bug: #1436077
This commit is contained in:
parent
529297e60d
commit
f75a050910
@ -80,12 +80,13 @@ class EventsNotificationEndpoint(object):
|
||||
event = self.event_converter.to_event(notification)
|
||||
if event is not None:
|
||||
if self.requeue:
|
||||
serialized_event = utils.message_from_event(
|
||||
event, cfg.CONF.publisher.telemetry_secret)
|
||||
for notifier in self.transporter:
|
||||
notifier.sample(
|
||||
self.ctxt.to_dict(),
|
||||
event_type='pipeline.event',
|
||||
payload=[utils.message_from_event(
|
||||
event, cfg.CONF.publisher.telemetry_secret)])
|
||||
payload=[serialized_event])
|
||||
else:
|
||||
with self.transporter.publisher(self.ctxt) as p:
|
||||
p(event)
|
||||
|
@ -30,6 +30,7 @@ from ceilometer.event.storage import models
|
||||
from ceilometer.i18n import _
|
||||
from ceilometer.openstack.common import log
|
||||
from ceilometer import publisher
|
||||
from ceilometer.publisher import utils as publisher_utils
|
||||
from ceilometer import sample as sample_util
|
||||
from ceilometer import transformer as xformer
|
||||
|
||||
@ -83,7 +84,8 @@ class SamplePipelineEndpoint(PipelineEndpoint):
|
||||
timestamp=s['timestamp'],
|
||||
resource_metadata=s['resource_metadata'],
|
||||
source=s.get('source'))
|
||||
for s in payload
|
||||
for s in payload if publisher_utils.verify_signature(
|
||||
s, cfg.CONF.publisher.telemetry_secret)
|
||||
]
|
||||
with self.publish_context as p:
|
||||
p(samples)
|
||||
@ -101,7 +103,8 @@ class EventPipelineEndpoint(PipelineEndpoint):
|
||||
models.Trait.convert_value(dtype, value))
|
||||
for name, dtype, value in ev['traits']],
|
||||
raw=ev.get('raw', {}))
|
||||
for ev in payload
|
||||
for ev in payload if publisher_utils.verify_signature(
|
||||
ev, cfg.CONF.publisher.telemetry_secret)
|
||||
]
|
||||
with self.publish_context as p:
|
||||
p(events)
|
||||
|
Loading…
x
Reference in New Issue
Block a user