Skip to content

Commit

Permalink
make tracing key _baselime
Browse files Browse the repository at this point in the history
  • Loading branch information
Ankcorn committed Mar 28, 2024
1 parent afededa commit 2b983b9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

* make tracing key _baselime for step-functions

## [0.5.1] - 2024-03-28

* Improve step function tracing
Expand Down
6 changes: 5 additions & 1 deletion src/lambda/parse-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ function detectService(event: any) {
return "eventbridge";
}

if (process.env.BASELIME_TRACE_STEP_FUNCTION === "true" || event.Payload?.baselime?.traceparent || (Array.isArray(event) && event[0]?.Payload?.baselime?.traceparent)) {
if (
process.env.BASELIME_TRACE_STEP_FUNCTION === "true" ||
event.Payload?._baselime?.traceparent || event._baselime?.traceparent ||
(Array.isArray(event) && (event[0]?.Payload?.baselime?.traceparent || event[0]?._baselime?.traceparent))
) {
return "step-function";
}
return 'unknown'
Expand Down
3 changes: 2 additions & 1 deletion src/lambda/propation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ export function extractContext(service: string, event: any): { parent?: Context,
}).filter(el => el)
}
}
const traceparent = event._baselime?.traceparent || event.Payload?._baselime.traceparent;

return {
parent: propagation.extract(context.active(), event?.baselime || event.Payload?.baselime, headerGetter)
parent: propagation.extract(context.active(), { traceparent }, headerGetter)
}
default:
return {
Expand Down

0 comments on commit 2b983b9

Please sign in to comment.