summary refs log tree commit diff
path: root/synapse/logging/tracing.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/logging/tracing.py')
-rw-r--r--synapse/logging/tracing.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/synapse/logging/tracing.py b/synapse/logging/tracing.py

index 1b509ffdcd..38521d18df 100644 --- a/synapse/logging/tracing.py +++ b/synapse/logging/tracing.py
@@ -166,6 +166,7 @@ from functools import wraps from typing import ( TYPE_CHECKING, Any, + Awaitable, Callable, ContextManager, Dict, @@ -280,6 +281,16 @@ class SynapseTags: # The name of the external cache CACHE_NAME = "cache.name" + # Used to tag function arguments + # + # Tag a named arg. The name of the argument should be appended to this + # prefix + FUNC_ARG_PREFIX = "ARG." + # Tag extra variadic number of positional arguments (`def foo(first, second, *extras)`) + FUNC_ARGS = "args" + # Tag keyword args + FUNC_KWARGS = "kwargs" + class SynapseBaggage: FORCE_TRACING = "synapse-force-tracing" @@ -796,7 +807,6 @@ def _custom_sync_async_decorator( """ Decorates a function that is sync or async (coroutines), or that returns a Twisted `Deferred`. The custom business logic of the decorator goes in `wrapping_logic`. - Example usage: ```py # Decorator to time the function and log it out @@ -812,7 +822,6 @@ def _custom_sync_async_decorator( logger.info("%s took %s seconds", func.__name__, duration) return _custom_sync_async_decorator(func, _wrapping_logic) ``` - Args: func: The function to be decorated wrapping_logic: The business logic of your custom decorator. @@ -898,9 +907,7 @@ def trace_with_opname( def trace(func: Callable[P, R]) -> Callable[P, R]: """ Decorator to trace a function. - Sets the operation name to that of the function's name. - See the module's doc string for usage examples. """