Annotate logs around reporting

It's useful to annotate the logs around reporting with the event id
that caused the action.

Change-Id: I282c28fb0156070696f3d231a2a28f8f62deffca
This commit is contained in:
Tobias Henkel
2019-05-26 19:37:50 +02:00
parent a703f42c24
commit 1078d767ac
11 changed files with 138 additions and 106 deletions

View File

@@ -18,6 +18,7 @@ import logging
import time
import voluptuous as v
from zuul.lib.logutil import get_annotated_logger
from zuul.reporter import BaseReporter
from zuul.lib.artifacts import get_artifacts_from_result_data
@@ -30,9 +31,10 @@ class SQLReporter(BaseReporter):
def report(self, item):
"""Create an entry into a database."""
log = get_annotated_logger(self.log, item.event)
if not self.connection.tables_established:
self.log.warn("SQL reporter (%s) is disabled " % self)
log.warning("SQL reporter (%s) is disabled ", self)
return
with self.connection.getSession() as db: