diff --git a/common.py b/common.py index 51dc6b6a..f3da4eae 100644 --- a/common.py +++ b/common.py @@ -349,6 +349,7 @@ def create_task(queue, delay=None, **params): # return app.view_functions[endpoint](**args) body = urllib.parse.urlencode(sorted(params.items())).encode() + traceparent = request.headers.get('traceparent', '') task = { 'app_engine_http_request': { 'http_method': 'POST', @@ -359,7 +360,7 @@ def create_task(queue, delay=None, **params): # propagate trace id # https://cloud.google.com/trace/docs/trace-context#http-requests # https://stackoverflow.com/a/71343735/186123 - 'traceparent': request.headers.get('traceparent', ''), + 'traceparent': traceparent, }, }, } @@ -369,7 +370,8 @@ def create_task(queue, delay=None, **params): parent = tasks_client.queue_path(appengine_info.APP_ID, TASKS_LOCATION, queue) task = tasks_client.create_task(parent=parent, task=task) - msg = f'Added {queue} {task.name.split("/")[-1]}' + if not traceparent: + msg = f'Added {queue} {task.name.split("/")[-1]}' logger.info(msg) return msg, 202 diff --git a/protocol.py b/protocol.py index d1dd36fe..094a95fb 100644 --- a/protocol.py +++ b/protocol.py @@ -1665,7 +1665,7 @@ def check_supported(cls, obj): error(f"Bridgy Fed doesn't support DMs", status=204) -@cloud_tasks_only() +@cloud_tasks_only(log=None) def receive_task(): """Task handler for a newly received :class:`models.Object`. @@ -1717,7 +1717,7 @@ def receive_task(): error(e, status=304) -@cloud_tasks_only() +@cloud_tasks_only(log=None) def send_task(): """Task handler for sending an activity to a single specific destination. diff --git a/web.py b/web.py index 829d90dd..91b6aaed 100644 --- a/web.py +++ b/web.py @@ -854,7 +854,7 @@ def poll_feed(user, feed_url, rel_type): @app.post(f'/queue/poll-feed') -@cloud_tasks_only(log=False) +@cloud_tasks_only(log=None) def poll_feed_task(): """Task handler for polling a :class:`Web` user's feed. @@ -935,7 +935,7 @@ def clamp(delay): @app.post('/queue/webmention') -@cloud_tasks_only() +@cloud_tasks_only(log=None) def webmention_task(): """Handles inbound webmention task.