summaryrefslogtreecommitdiff
path: root/zuul
diff options
context:
space:
mode:
Diffstat (limited to 'zuul')
-rw-r--r--zuul/connection/__init__.py10
-rw-r--r--zuul/driver/gerrit/gerritconnection.py2
-rw-r--r--zuul/driver/github/githubconnection.py2
-rw-r--r--zuul/scheduler.py17
4 files changed, 17 insertions, 14 deletions
diff --git a/zuul/connection/__init__.py b/zuul/connection/__init__.py
index ff0807dac..23c776aca 100644
--- a/zuul/connection/__init__.py
+++ b/zuul/connection/__init__.py
@@ -14,6 +14,8 @@
import abc
+from zuul.lib.logutil import get_annotated_logger
+
class BaseConnection(object, metaclass=abc.ABCMeta):
"""Base class for connections.
@@ -42,10 +44,10 @@ class BaseConnection(object, metaclass=abc.ABCMeta):
self.connection_config = connection_config
def logEvent(self, event):
- self.log.debug(
- 'Scheduling event from {connection}: {event}'.format(
- connection=self.connection_name,
- event=event))
+ log = get_annotated_logger(self.log, event.zuul_event_id)
+ log.debug('Scheduling event from {connection}: {event}'.format(
+ connection=self.connection_name,
+ event=event))
try:
if self.sched.statsd:
self.sched.statsd.incr(
diff --git a/zuul/driver/gerrit/gerritconnection.py b/zuul/driver/gerrit/gerritconnection.py
index 08e17d440..337097ce5 100644
--- a/zuul/driver/gerrit/gerritconnection.py
+++ b/zuul/driver/gerrit/gerritconnection.py
@@ -682,7 +682,7 @@ class GerritConnection(BaseConnection):
needed_by_changes.add(dep)
change.compat_needed_by_changes = compat_needed_by_changes
- self.sched.onChangeUpdated(change)
+ self.sched.onChangeUpdated(change, event)
return change
diff --git a/zuul/driver/github/githubconnection.py b/zuul/driver/github/githubconnection.py
index 720da21f4..078de68ab 100644
--- a/zuul/driver/github/githubconnection.py
+++ b/zuul/driver/github/githubconnection.py
@@ -1038,7 +1038,7 @@ class GithubConnection(BaseConnection):
]
if self.sched:
- self.sched.onChangeUpdated(change)
+ self.sched.onChangeUpdated(change, event)
return change
diff --git a/zuul/scheduler.py b/zuul/scheduler.py
index 1d7d9c7b6..84378c6e3 100644
--- a/zuul/scheduler.py
+++ b/zuul/scheduler.py
@@ -35,6 +35,7 @@ from zuul.lib import commandsocket
from zuul.lib.ansible import AnsibleManager
from zuul.lib.config import get_default
from zuul.lib.gear_utils import getGearmanFunctions
+from zuul.lib.logutil import get_annotated_logger
from zuul.lib.statsd import get_statsd
import zuul.lib.queue
from zuul.model import Build
@@ -1056,7 +1057,8 @@ class Scheduler(threading.Thread):
def process_event_queue(self):
self.log.debug("Fetching trigger event")
event = self.trigger_event_queue.get()
- self.log.debug("Processing trigger event %s" % event)
+ log = get_annotated_logger(self.log, event.zuul_event_id)
+ log.debug("Processing trigger event %s" % event)
try:
full_project_name = ('/'.join([event.project_hostname,
event.project_name]))
@@ -1067,9 +1069,8 @@ class Scheduler(threading.Thread):
try:
change = project.source.getChange(event)
except exceptions.ChangeNotFound as e:
- self.log.debug("Unable to get change %s from "
- "source %s",
- e.change, project.source)
+ log.debug("Unable to get change %s from source %s",
+ e.change, project.source)
continue
reconfigure_tenant = False
if ((event.branch_updated and
@@ -1398,7 +1399,7 @@ class Scheduler(threading.Thread):
pipelines.append(pipeline.formatStatusJSON(websocket_url))
return json.dumps(data)
- def onChangeUpdated(self, change):
+ def onChangeUpdated(self, change, event):
"""Remove stale dependency references on change update.
When a change is updated with a new patchset, other changes in
@@ -1408,9 +1409,9 @@ class Scheduler(threading.Thread):
them to be refreshed the next time the queue processor
examines them.
"""
-
- self.log.debug("Change %s has been updated, clearing dependent "
- "change caches", change)
+ log = get_annotated_logger(self.log, event)
+ log.debug("Change %s has been updated, clearing dependent "
+ "change caches", change)
for source in self.connections.getSources():
for other_change in source.getCachedChanges():
if other_change.commit_needs_changes is None: