def wrapper(self, *args, **kwargs): """ Call wrapped function getting cid from RPC call """ cid = kwargs.pop("cid", str(uuid4())) locals.set_cid(cid) return function(self, *args, **kwargs)
def wrapper(self, cid, *args, **kwargs): """ Call wrapped function getting cid from RPC call """ locals.set_cid(cid) return function(self, *args, **kwargs)
def test_set_cid(self): self.assertIsNone(get_cid()) set_cid(self.cid) self.assertEqual(self.cid, get_cid())
def _process_request(self, request): upstream_cid = request.META.get(self.cid_request_header, None) cid = generate_new_cid(upstream_cid) request.correlation_id = cid set_cid(cid) return request
def wrapper(self, event_data): """ Function wrapper """ # get the CID off of the event data and set it on the local thread locals.set_cid(event_data.pop("cid")) return function(self, event_data)