File tree 1 file changed +32
-0
lines changed
1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,38 @@ context for an operation using any native object.
164
164
}
165
165
```
166
166
167
+ ## Override default object mapper
168
+
169
+ You can optionally choose to override default object mapper which is used to serialize method response and exceptions when enabled. You might
170
+ want to supply custom object mapper in order to control how serialisation is done, for example, when you want to log only
171
+ specific fields from received event due to security.
172
+
173
+ === "App.java"
174
+
175
+ ```java hl_lines="10-14"
176
+ import software.amazon.lambda.powertools.tracing.Tracing;
177
+ import software.amazon.lambda.powertools.tracing.TracingUtils;
178
+ import static software.amazon.lambda.powertools.tracing.CaptureMode.RESPONSE;
179
+
180
+ /**
181
+ * Handler for requests to Lambda function.
182
+ */
183
+ public class App implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
184
+ static {
185
+ ObjectMapper objectMapper = new ObjectMapper();
186
+ SimpleModule simpleModule = new SimpleModule();
187
+ objectMapper.registerModule(simpleModule);
188
+
189
+ TracingUtils.defaultObjectMapper(objectMapper);
190
+ }
191
+
192
+ @Tracing(captureMode = RESPONSE)
193
+ public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) {
194
+ ...
195
+ }
196
+ }
197
+ ```
198
+
167
199
## Utilities
168
200
169
201
Tracing modules comes with certain utility method when you don't want to use annotation for capturing a code block
You can’t perform that action at this time.
0 commit comments