)]}'
{"doc/source/reference/monitoring.rst":[{"author":{"_account_id":4146,"name":"Clark Boylan","email":"cboylan@sapwetik.org","username":"cboylan"},"change_message_id":"0ec7d37b4488d8b4fa04b29af50eaeca0747fd75","unresolved":true,"context_lines":[{"line_number":52,"context_line":".. stat:: zuul.tenant.\u003ctenant\u003e.management_events"},{"line_number":53,"context_line":"   :type: gauge"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"   The size of the tenant\u0027s management event queue."},{"line_number":56,"context_line":""},{"line_number":57,"context_line":".. stat:: zuul.tenant.\u003ctenant\u003e.trigger_events"},{"line_number":58,"context_line":"   :type: gauge"}],"source_content_type":"text/x-rst","patch_set":12,"id":"af50255c_a1c56fd9","line":55,"updated":"2021-07-01 00:05:23.000000000","message":"When we report this value via the rest api we report it with the reconfiguration event queue added into the tenant management queue. But statsd is only reporting the tenant management queue.\n\nShould we try to sync those up?","commit_id":"4aa8462d0818cffd77d34c85d614c02b00e90278"},{"author":{"_account_id":27582,"name":"Simon Westphahl","email":"simon.westphahl@bmw.de","username":"simon.westphahl"},"change_message_id":"08d1b3724e05a7d311033131c1264a4394c4848c","unresolved":true,"context_lines":[{"line_number":52,"context_line":".. stat:: zuul.tenant.\u003ctenant\u003e.management_events"},{"line_number":53,"context_line":"   :type: gauge"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"   The size of the tenant\u0027s management event queue."},{"line_number":56,"context_line":""},{"line_number":57,"context_line":".. stat:: zuul.tenant.\u003ctenant\u003e.trigger_events"},{"line_number":58,"context_line":"   :type: gauge"}],"source_content_type":"text/x-rst","patch_set":12,"id":"cf6f9ed7_7f20b7b2","line":55,"in_reply_to":"af50255c_a1c56fd9","updated":"2021-07-01 05:35:52.000000000","message":"I\u0027d say no. The length of the reconfig event queue is only added in the REST API for backward compatibility. E.g. some of our users use that value in order to see if there is a reconfiguration ongoing.","commit_id":"4aa8462d0818cffd77d34c85d614c02b00e90278"},{"author":{"_account_id":4146,"name":"Clark Boylan","email":"cboylan@sapwetik.org","username":"cboylan"},"change_message_id":"0ec7d37b4488d8b4fa04b29af50eaeca0747fd75","unresolved":true,"context_lines":[{"line_number":482,"context_line":"      .. stat:: management"},{"line_number":483,"context_line":"         :type: gauge"},{"line_number":484,"context_line":""},{"line_number":485,"context_line":"         The size of the current management event queue."},{"line_number":486,"context_line":""},{"line_number":487,"context_line":"      .. stat:: connection.\u003cconnection-name\u003e"},{"line_number":488,"context_line":"         :type: gauge"}],"source_content_type":"text/x-rst","patch_set":12,"id":"f83bd194_2ff293ed","line":485,"updated":"2021-07-01 00:05:23.000000000","message":"This gauge continues to be reported but it is only the length of the reconfiguration events. We should probably update these docs.","commit_id":"4aa8462d0818cffd77d34c85d614c02b00e90278"},{"author":{"_account_id":27582,"name":"Simon Westphahl","email":"simon.westphahl@bmw.de","username":"simon.westphahl"},"change_message_id":"08d1b3724e05a7d311033131c1264a4394c4848c","unresolved":true,"context_lines":[{"line_number":482,"context_line":"      .. stat:: management"},{"line_number":483,"context_line":"         :type: gauge"},{"line_number":484,"context_line":""},{"line_number":485,"context_line":"         The size of the current management event queue."},{"line_number":486,"context_line":""},{"line_number":487,"context_line":"      .. stat:: connection.\u003cconnection-name\u003e"},{"line_number":488,"context_line":"         :type: gauge"}],"source_content_type":"text/x-rst","patch_set":12,"id":"7e5e06ff_77888ed0","line":485,"in_reply_to":"f83bd194_2ff293ed","updated":"2021-07-01 05:35:52.000000000","message":"Ack.","commit_id":"4aa8462d0818cffd77d34c85d614c02b00e90278"}],"tests/base.py":[{"author":{"_account_id":27582,"name":"Simon Westphahl","email":"simon.westphahl@bmw.de","username":"simon.westphahl"},"change_message_id":"0a036b9000a3d5a225595465ba86b201acad5a82","unresolved":true,"context_lines":[{"line_number":4075,"context_line":"        # events."},{"line_number":4076,"context_line":"        self.event_queues \u003d ["},{"line_number":4077,"context_line":"            self.sched.reconfigure_event_queue,"},{"line_number":4078,"context_line":"            self.sched.result_event_queue,"},{"line_number":4079,"context_line":"        ]"},{"line_number":4080,"context_line":""},{"line_number":4081,"context_line":"    def start(self, validate_tenants: list):"}],"source_content_type":"text/x-python","patch_set":3,"id":"0808d2db_fc58d6fd","line":4078,"updated":"2021-06-22 13:53:48.000000000","message":"Changing the order here in PS4 seems to have \"fixed\" two more test cases. Maybe there is also another race condition leading to the remaining failures.","commit_id":"b59631c48de446a83d1f5320206b7d67eeeb2290"},{"author":{"_account_id":27582,"name":"Simon Westphahl","email":"simon.westphahl@bmw.de","username":"simon.westphahl"},"change_message_id":"c4453b8c866fda83facce64caf19dc089fa68264","unresolved":true,"context_lines":[{"line_number":4075,"context_line":"        # events."},{"line_number":4076,"context_line":"        self.event_queues \u003d ["},{"line_number":4077,"context_line":"            self.sched.reconfigure_event_queue,"},{"line_number":4078,"context_line":"            self.sched.result_event_queue,"},{"line_number":4079,"context_line":"        ]"},{"line_number":4080,"context_line":""},{"line_number":4081,"context_line":"    def start(self, validate_tenants: list):"}],"source_content_type":"text/x-python","patch_set":3,"id":"704a0cb7_a55ee2b5","line":4078,"in_reply_to":"0808d2db_fc58d6fd","updated":"2021-06-22 13:54:13.000000000","message":"s/PS4/PS3/","commit_id":"b59631c48de446a83d1f5320206b7d67eeeb2290"}],"zuul/scheduler.py":[{"author":{"_account_id":27582,"name":"Simon Westphahl","email":"simon.westphahl@bmw.de","username":"simon.westphahl"},"change_message_id":"46a7bca33815e0d9b8ce2fdedb08c95dea3d5abd","unresolved":true,"context_lines":[{"line_number":398,"context_line":"            self.statsd.gauge(f\"zuul.tenant.{tenant.name}.management_events\","},{"line_number":399,"context_line":"                              len(self.management_events[tenant.name]))"},{"line_number":400,"context_line":"            self.statsd.gauge(f\"zuul.tenant.{tenant.name}.trigger_events\","},{"line_number":401,"context_line":"                              len(self.trigger_events[tenant.name]))"},{"line_number":402,"context_line":"            trigger_event_queues \u003d self.pipeline_trigger_events[tenant.name]"},{"line_number":403,"context_line":"            result_event_queues \u003d self.pipeline_result_events[tenant.name]"},{"line_number":404,"context_line":"            management_event_queues \u003d ("}],"source_content_type":"text/x-python","patch_set":6,"id":"dc445723_651515a2","line":401,"updated":"2021-06-23 10:09:13.000000000","message":"New gauges should be documented.","commit_id":"fd93c2eea064a7ec846c95bdf4fb1189d47f1710"},{"author":{"_account_id":27582,"name":"Simon Westphahl","email":"simon.westphahl@bmw.de","username":"simon.westphahl"},"change_message_id":"eabc8e13e53d77a39d2c27f59ccded0b614cf685","unresolved":false,"context_lines":[{"line_number":398,"context_line":"            self.statsd.gauge(f\"zuul.tenant.{tenant.name}.management_events\","},{"line_number":399,"context_line":"                              len(self.management_events[tenant.name]))"},{"line_number":400,"context_line":"            self.statsd.gauge(f\"zuul.tenant.{tenant.name}.trigger_events\","},{"line_number":401,"context_line":"                              len(self.trigger_events[tenant.name]))"},{"line_number":402,"context_line":"            trigger_event_queues \u003d self.pipeline_trigger_events[tenant.name]"},{"line_number":403,"context_line":"            result_event_queues \u003d self.pipeline_result_events[tenant.name]"},{"line_number":404,"context_line":"            management_event_queues \u003d ("}],"source_content_type":"text/x-python","patch_set":6,"id":"80050dd6_3d0311f3","line":401,"in_reply_to":"dc445723_651515a2","updated":"2021-06-23 11:16:52.000000000","message":"Done","commit_id":"fd93c2eea064a7ec846c95bdf4fb1189d47f1710"},{"author":{"_account_id":27582,"name":"Simon Westphahl","email":"simon.westphahl@bmw.de","username":"simon.westphahl"},"change_message_id":"46a7bca33815e0d9b8ce2fdedb08c95dea3d5abd","unresolved":true,"context_lines":[{"line_number":1944,"context_line":"        data[\u0027management_event_queue\u0027] \u003d {}"},{"line_number":1945,"context_line":"        data[\u0027management_event_queue\u0027][\u0027length\u0027] \u003d len("},{"line_number":1946,"context_line":"            self.management_events[tenant_name]"},{"line_number":1947,"context_line":"        )"},{"line_number":1948,"context_line":"        data[\u0027connection_event_queues\u0027] \u003d {}"},{"line_number":1949,"context_line":"        for connection in self.connections.connections.values():"},{"line_number":1950,"context_line":"            queue \u003d connection.getEventQueue()"}],"source_content_type":"text/x-python","patch_set":6,"id":"89948dc1_90db7624","line":1947,"updated":"2021-06-23 10:09:13.000000000","message":"I think this should be:\n\n    data[\u0027management_event_queue\u0027][\u0027length\u0027] \u003d len(\n        self.management_events[tenant_name]\n    ) + self.reconfigure_event_queue.qsize()","commit_id":"fd93c2eea064a7ec846c95bdf4fb1189d47f1710"},{"author":{"_account_id":27582,"name":"Simon Westphahl","email":"simon.westphahl@bmw.de","username":"simon.westphahl"},"change_message_id":"eabc8e13e53d77a39d2c27f59ccded0b614cf685","unresolved":false,"context_lines":[{"line_number":1944,"context_line":"        data[\u0027management_event_queue\u0027] \u003d {}"},{"line_number":1945,"context_line":"        data[\u0027management_event_queue\u0027][\u0027length\u0027] \u003d len("},{"line_number":1946,"context_line":"            self.management_events[tenant_name]"},{"line_number":1947,"context_line":"        )"},{"line_number":1948,"context_line":"        data[\u0027connection_event_queues\u0027] \u003d {}"},{"line_number":1949,"context_line":"        for connection in self.connections.connections.values():"},{"line_number":1950,"context_line":"            queue \u003d connection.getEventQueue()"}],"source_content_type":"text/x-python","patch_set":6,"id":"bc98cdd1_7ae16db8","line":1947,"in_reply_to":"89948dc1_90db7624","updated":"2021-06-23 11:16:52.000000000","message":"Done","commit_id":"fd93c2eea064a7ec846c95bdf4fb1189d47f1710"}],"zuul/zk/event_queues.py":[{"author":{"_account_id":1,"name":"James E. Blair","email":"jim@acmegating.com","username":"corvus"},"change_message_id":"b9b5d6142e85fd2c30b12c1e6c646e1ee01f54e8","unresolved":false,"context_lines":[{"line_number":97,"context_line":"            pipelines_path \u003d f\"{tenant_path}/pipelines\""},{"line_number":98,"context_line":"            self.kazoo_client.ensure_path(pipelines_path)"},{"line_number":99,"context_line":"            self.kazoo_client.ChildrenWatch("},{"line_number":100,"context_line":"                pipelines_path, lambda p: self._pipelineWatch(tenant_name, p))"},{"line_number":101,"context_line":""},{"line_number":102,"context_line":"            self.watched_tenants.add(tenant_path)"},{"line_number":103,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"077be6a4_e03d6505","line":100,"updated":"2021-06-22 21:32:45.000000000","message":"This is a common trap with lambdas: Python doesn\u0027t fix the value of tenant_name in the closure here, it fixes the name and scope, so we end up with an unexpected value of tenant_name in the lambda based on the state of loop iteration at the time.\n\nIf I had to distill this into what to look for to avoid, I\u0027d say: don\u0027t use lambdas to make a closure in a loop.  I think the current/old code suffered from this too, but unlikely to hit a race condition.  I\u0027ve gone through the rest of this file and double checked the other lambdas look okay.\n\nThere are ways to do this with lamdbas (default arguments, or lambdas within lambdas), but I think they are harder to understand than just adding a factory function to return a closure.  That\u0027s what I did in the executor api, so that\u0027s what I\u0027ll do here in the next ptachset to resolve the race conditions.  It\u0027s going to look like:\n\n    def _makePipelineWatcher(self, tenant_name):\n        def watch(children, event\u003dNone):\n            return self._pipelineWatch(tenant_name, children)\n        return watch\n\nBut could be simplified as:\n\n    def _makePipelineWatcher(self, tenant_name):\n        return lambda children: self._pipelineWatch(tenant_name, children)\n\nThat seems equally readable/maintainable to me -- the main thing is getting the closure its own scope by calling into a method.","commit_id":"b59631c48de446a83d1f5320206b7d67eeeb2290"},{"author":{"_account_id":27582,"name":"Simon Westphahl","email":"simon.westphahl@bmw.de","username":"simon.westphahl"},"change_message_id":"addba98792464fc2df9230f7426ccc401df89f96","unresolved":false,"context_lines":[{"line_number":97,"context_line":"            pipelines_path \u003d f\"{tenant_path}/pipelines\""},{"line_number":98,"context_line":"            self.kazoo_client.ensure_path(pipelines_path)"},{"line_number":99,"context_line":"            self.kazoo_client.ChildrenWatch("},{"line_number":100,"context_line":"                pipelines_path, lambda p: self._pipelineWatch(tenant_name, p))"},{"line_number":101,"context_line":""},{"line_number":102,"context_line":"            self.watched_tenants.add(tenant_path)"},{"line_number":103,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"b317ea04_556da5ed","line":100,"in_reply_to":"077be6a4_e03d6505","updated":"2021-06-23 06:08:12.000000000","message":"Thanks, for fixing this! I knew that late binding behavior would hit me at some point :D\n\nI think `functools.partial()` could also work here:\n\n     self.kazoo_client.ChildrenWatch(\n         pipelines_path,\n         functools.partial(self._pipelineWatch, tenant_name, p)\n     )","commit_id":"b59631c48de446a83d1f5320206b7d67eeeb2290"},{"author":{"_account_id":4146,"name":"Clark Boylan","email":"cboylan@sapwetik.org","username":"cboylan"},"change_message_id":"0ec7d37b4488d8b4fa04b29af50eaeca0747fd75","unresolved":true,"context_lines":[{"line_number":83,"context_line":"        self.kazoo_client.ChildrenWatch(TENANT_ROOT, self._tenantWatch)"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    def _makePipelineWatcher(self, tenant_name):"},{"line_number":86,"context_line":"        def watch(children, event\u003dNone):"},{"line_number":87,"context_line":"            return self._pipelineWatch(tenant_name, children)"},{"line_number":88,"context_line":"        return watch"},{"line_number":89,"context_line":""}],"source_content_type":"text/x-python","patch_set":12,"id":"b7c16359_6c3a6fb8","line":86,"range":{"start_line":86,"start_character":27,"end_line":86,"end_character":38},"updated":"2021-07-01 00:05:23.000000000","message":"Is this argument necessary if we aren\u0027t sending events?","commit_id":"4aa8462d0818cffd77d34c85d614c02b00e90278"},{"author":{"_account_id":1,"name":"James E. Blair","email":"jim@acmegating.com","username":"corvus"},"change_message_id":"cc6a89a775c84a9c08e51350393a6799b10e647a","unresolved":false,"context_lines":[{"line_number":83,"context_line":"        self.kazoo_client.ChildrenWatch(TENANT_ROOT, self._tenantWatch)"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    def _makePipelineWatcher(self, tenant_name):"},{"line_number":86,"context_line":"        def watch(children, event\u003dNone):"},{"line_number":87,"context_line":"            return self._pipelineWatch(tenant_name, children)"},{"line_number":88,"context_line":"        return watch"},{"line_number":89,"context_line":""}],"source_content_type":"text/x-python","patch_set":12,"id":"cfc38bb3_e20ff286","line":86,"updated":"2021-07-01 00:16:33.000000000","message":"It\u0027s not, but I liked having the full standard function signature so it doesn\u0027t matter.","commit_id":"4aa8462d0818cffd77d34c85d614c02b00e90278"},{"author":{"_account_id":4146,"name":"Clark Boylan","email":"cboylan@sapwetik.org","username":"cboylan"},"change_message_id":"0ec7d37b4488d8b4fa04b29af50eaeca0747fd75","unresolved":true,"context_lines":[{"line_number":524,"context_line":"    log \u003d logging.getLogger(\"zuul.zk.event_queues.TenantTriggerEventQueue\")"},{"line_number":525,"context_line":""},{"line_number":526,"context_line":"    def __init__(self, client, connections, tenant_name):"},{"line_number":527,"context_line":"        event_root \u003d \"/\".join((TENANT_ROOT, tenant_name, \"events\"))"},{"line_number":528,"context_line":"        super().__init__(client, event_root, connections)"},{"line_number":529,"context_line":""},{"line_number":530,"context_line":"    @classmethod"}],"source_content_type":"text/x-python","patch_set":12,"id":"7cbcd360_b069f035","line":527,"updated":"2021-07-01 00:05:23.000000000","message":"I know it was this way before but its a bit weird to have both trigger and management events in the same zookeeper path which is analogous to having them all in one queue there then we split them out here into two different queues.\n\nI guess we use a prefix on the znodes rather than separating them into different paths. Is there a specific reason we do that? This sort of thing might be worth calling out in the code?","commit_id":"4aa8462d0818cffd77d34c85d614c02b00e90278"},{"author":{"_account_id":27582,"name":"Simon Westphahl","email":"simon.westphahl@bmw.de","username":"simon.westphahl"},"change_message_id":"08d1b3724e05a7d311033131c1264a4394c4848c","unresolved":true,"context_lines":[{"line_number":524,"context_line":"    log \u003d logging.getLogger(\"zuul.zk.event_queues.TenantTriggerEventQueue\")"},{"line_number":525,"context_line":""},{"line_number":526,"context_line":"    def __init__(self, client, connections, tenant_name):"},{"line_number":527,"context_line":"        event_root \u003d \"/\".join((TENANT_ROOT, tenant_name, \"events\"))"},{"line_number":528,"context_line":"        super().__init__(client, event_root, connections)"},{"line_number":529,"context_line":""},{"line_number":530,"context_line":"    @classmethod"}],"source_content_type":"text/x-python","patch_set":12,"id":"f23354e7_8dcd2953","line":527,"in_reply_to":"7cbcd360_b069f035","updated":"2021-07-01 05:35:52.000000000","message":"Yes, the different event types are separated by using different prefixes. I guess the main reason was that it\u0027s described like this in the spec, but it also simplifies the watches. Otherwise we\u0027d need three instead of one data watch for every pipeline/tenant event queue.","commit_id":"4aa8462d0818cffd77d34c85d614c02b00e90278"},{"author":{"_account_id":4146,"name":"Clark Boylan","email":"cboylan@sapwetik.org","username":"cboylan"},"change_message_id":"eb731693df07cba61134d6c1103cac2bbc518f43","unresolved":true,"context_lines":[{"line_number":524,"context_line":"    log \u003d logging.getLogger(\"zuul.zk.event_queues.TenantTriggerEventQueue\")"},{"line_number":525,"context_line":""},{"line_number":526,"context_line":"    def __init__(self, client, connections, tenant_name):"},{"line_number":527,"context_line":"        event_root \u003d \"/\".join((TENANT_ROOT, tenant_name, \"events\"))"},{"line_number":528,"context_line":"        super().__init__(client, event_root, connections)"},{"line_number":529,"context_line":""},{"line_number":530,"context_line":"    @classmethod"}],"source_content_type":"text/x-python","patch_set":12,"id":"ee3d60cc_895aa4da","line":527,"in_reply_to":"f23354e7_8dcd2953","updated":"2021-07-01 14:26:41.000000000","message":"Thank you for confirming it is to simplify watches. I think that is a reasonable enough reason for the \"cohosting\" of the queues on the zookeeper side. It just jumped uot to me as potentially odd so wanted to call it out. Sounds like there is a good reason for it though.","commit_id":"4aa8462d0818cffd77d34c85d614c02b00e90278"}]}
