Merge "Include enqueue and report timestamps in MQTT msg"
This commit is contained in:
commit
47de21ae22
|
@ -492,6 +492,8 @@ class TestMQTTConnection(ZuulTestCase):
|
||||||
'test')
|
'test')
|
||||||
self.assertEquals(mqtt_payload['buildset']['builds'][0]['result'],
|
self.assertEquals(mqtt_payload['buildset']['builds'][0]['result'],
|
||||||
'SUCCESS')
|
'SUCCESS')
|
||||||
|
self.assertIn('timestamp', mqtt_payload)
|
||||||
|
self.assertIn('enqueue_time', mqtt_payload)
|
||||||
|
|
||||||
def test_mqtt_invalid_topic(self):
|
def test_mqtt_invalid_topic(self):
|
||||||
in_repo_conf = textwrap.dedent(
|
in_repo_conf = textwrap.dedent(
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import time
|
||||||
import voluptuous as v
|
import voluptuous as v
|
||||||
|
|
||||||
from zuul.reporter import BaseReporter
|
from zuul.reporter import BaseReporter
|
||||||
|
@ -28,6 +29,7 @@ class MQTTReporter(BaseReporter):
|
||||||
self.log.debug("Report change %s, params %s" %
|
self.log.debug("Report change %s, params %s" %
|
||||||
(item.change, self.config))
|
(item.change, self.config))
|
||||||
message = {
|
message = {
|
||||||
|
'timestamp': time.time(),
|
||||||
'action': self._action,
|
'action': self._action,
|
||||||
'tenant': item.pipeline.tenant.name,
|
'tenant': item.pipeline.tenant.name,
|
||||||
'zuul_ref': item.current_build_set.ref,
|
'zuul_ref': item.current_build_set.ref,
|
||||||
|
@ -40,6 +42,7 @@ class MQTTReporter(BaseReporter):
|
||||||
'ref': getattr(item.change, 'ref', ''),
|
'ref': getattr(item.change, 'ref', ''),
|
||||||
'message': self._formatItemReport(
|
'message': self._formatItemReport(
|
||||||
item, with_jobs=False),
|
item, with_jobs=False),
|
||||||
|
'enqueue_time': item.enqueue_time,
|
||||||
'buildset': {
|
'buildset': {
|
||||||
'uuid': item.current_build_set.uuid,
|
'uuid': item.current_build_set.uuid,
|
||||||
'builds': []
|
'builds': []
|
||||||
|
|
Loading…
Reference in New Issue