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
docs(event_handler): demonstrate how to combine logger correlation ID and middleware (aws-powertools#3064)
* fix(parameters): make cache aware of single vs multiple calls
Signed-off-by: heitorlessa <[email protected]>
* chore: cleanup, add test for single and nested
Signed-off-by: heitorlessa <[email protected]>
* docs(event_handler): use correct correlation_id in logger.set_correlation_id example
* docs(event_handler): combine correlation id with logger for a more powerful example
* fix(parameters): make cache aware of single vs multiple calls
Signed-off-by: heitorlessa <[email protected]>
* chore: cleanup, add test for single and nested
Signed-off-by: heitorlessa <[email protected]>
* docs: remove Logger dependency on retrieval to address Simon's feedback
* docs: fix racing condition, more notes based on Simon's feedback
Signed-off-by: heitorlessa <[email protected]>
---------
Signed-off-by: heitorlessa <[email protected]>
Copy file name to clipboardExpand all lines: docs/core/event_handler/api_gateway.md
+6-4
Original file line number
Diff line number
Diff line change
@@ -406,10 +406,12 @@ Here's a sample middleware that extracts and injects correlation ID, using `APIG
406
406
```
407
407
408
408
1. You can access current request like you normally would.
409
-
2. [Shared context is available](#sharing-contextual-data) to any middleware, Router and App instances.
410
-
3. Get response from the next middleware (if any) or from `/todos` route.
411
-
4. You can manipulate headers, body, or status code before returning it.
412
-
5. Register one or more middlewares in order of execution.
409
+
2. Logger extracts it first in the request path, so we can use it. <br><br> If this was available before, we'd use `app.context.get("correlation_id")`.
410
+
3. [Shared context is available](#sharing-contextual-data) to any middleware, Router and App instances. <br><br> For example, another middleware can now use `app.context.get("correlation_id")` to retrieve it.
411
+
4. Get response from the next middleware (if any) or from `/todos` route.
412
+
5. You can manipulate headers, body, or status code before returning it.
413
+
6. Register one or more middlewares in order of execution.
414
+
7. Logger extracts correlation ID from header and makes it available under `correlation_id` key, and `get_correlation_id()` method.
0 commit comments