You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When executed, your middleware name will [appear in AWS X-Ray Trace details as](../core/tracer.md)`## middleware_name`.
75
44
76
45
For advanced use cases, you can instantiate [Tracer](../core/tracer.md) inside your middleware, and add annotations as well as metadata for additional operational insights.
77
46
78
-
```python hl_lines="6-8" title="Add custom tracing insights before/after in your middlware"
79
-
from aws_lambda_powertools.middleware_factory import lambda_handler_decorator
80
-
from aws_lambda_powertools import Tracer
81
-
82
-
@lambda_handler_decorator(trace_execution=True)
83
-
defmiddleware_name(handler, event, context):
84
-
# tracer = Tracer() # Takes a copy of an existing tracer instance
85
-
# tracer.add_annotation...
86
-
# tracer.add_metadata...
87
-
return handler(event, context)
47
+
```python hl_lines="7-9" title="Add custom tracing insights before/after in your middlware"
0 commit comments