Skip to content

Commit 33712ed

Browse files
author
Martin Jesper Low Madsen
committed
Use handler name for XRay segment
1 parent f647624 commit 33712ed

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ const functionProxy = (functionBeingProxied, location, tracing) => ({
7575
}`,
7676
body: "$input.json('$')",
7777
targetHandler: functionBeingProxied.handler,
78+
handlerName: functionBeingProxied.name,
7879
tracing,
7980
}
8081
)

proxy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async function handler(event, context) {
2626
const ns = awsXRay.getNamespace();
2727
if (!ns.active) {
2828
const [Root, Parent, Sampled] = event.headers['X-Amzn-Trace-Id'].split(';');
29-
const segment = new awsXRay.Segment(targetHandlerFunction, Root.split('=')[1], Parent.split('=')[1]);
29+
const segment = new awsXRay.Segment(event.handlerName, Root.split('=')[1], Parent.split('=')[1]);
3030
targetHandler = ns.bind((event, context, callback) => {
3131
awsXRay.setSegment(segment);
3232
target[targetHandlerFunction](event, context, (error, result) => {

0 commit comments

Comments
 (0)