-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[SVLS-6367] Update Step Function Trace Context #34264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4833a25
a9379c1
c38f03b
16eec2a
aa3b8c3
dd3006f
cc53759
bbd05f9
1854f2b
12c3cbd
ed49e06
af1f3b7
2c0042e
66521d5
6724b32
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,7 +46,6 @@ type LifecycleProcessor struct { | |
| // inferred spans may contain a secondary inferred span in certain cases like SNS from SQS | ||
| type RequestHandler struct { | ||
| executionInfo *ExecutionStartInfo | ||
| event interface{} | ||
| inferredSpans [2]*inferredspan.InferredSpan | ||
| triggerTags map[string]string | ||
| triggerMetrics map[string]float64 | ||
|
|
@@ -68,13 +67,6 @@ func (r *RequestHandler) SetMetricsTag(tag string, value float64) { | |
| r.triggerMetrics[tag] = value | ||
| } | ||
|
|
||
| // Event returns the invocation event parsed by the LifecycleProcessor. It is nil if the event type is not supported | ||
| // yet. The actual event type can be figured out thanks to a Go type switch on the event types of the package | ||
| // github.com/aws/aws-lambda-go/events | ||
| func (r *RequestHandler) Event() interface{} { | ||
| return r.event | ||
| } | ||
|
|
||
| // SetSamplingPriority sets the trace priority | ||
| func (r *RequestHandler) SetSamplingPriority(priority sampler.SamplingPriority) { | ||
| r.executionInfo.SamplingPriority = priority | ||
|
|
@@ -230,21 +222,47 @@ func (lp *LifecycleProcessor) OnInvokeStart(startDetails *InvocationStartDetails | |
| ev = event | ||
| lp.initFromLambdaFunctionURLEvent(event, region, account, resource) | ||
| case trigger.LegacyStepFunctionEvent: | ||
| var event events.StepFunctionEvent | ||
| var event events.StepFunctionEvent[events.StepFunctionPayload] | ||
| if err := json.Unmarshal(payloadBytes, &event); err != nil { | ||
| log.Debugf("Failed to unmarshal %s event: %s", stepFunction, err) | ||
| break | ||
| } | ||
| ev = event.Payload | ||
| lp.initFromStepFunctionPayload(event.Payload) | ||
| case trigger.StepFunctionEvent: | ||
| var eventPayload events.StepFunctionPayload | ||
| if err := json.Unmarshal(payloadBytes, &eventPayload); err != nil { | ||
| log.Debugf("Failed to unmarshal %s event: %s", stepFunction, err) | ||
| break | ||
| } | ||
| ev = eventPayload | ||
| lp.initFromStepFunctionPayload(eventPayload) | ||
| case trigger.LegacyNestedStepFunctionEvent: | ||
| var event events.StepFunctionEvent[events.NestedStepFunctionPayload] | ||
| if err := json.Unmarshal(payloadBytes, &event); err != nil { | ||
| log.Debugf("Failed to unmarshal %s event: %s", stepFunction, err) | ||
| break | ||
| } | ||
| ev = event.Payload | ||
| case trigger.NestedStepFunctionEvent: | ||
| var eventPayload events.NestedStepFunctionPayload | ||
| if err := json.Unmarshal(payloadBytes, &eventPayload); err != nil { | ||
| log.Debugf("Failed to unmarshal %s event: %s", stepFunction, err) | ||
| break | ||
| } | ||
| ev = eventPayload | ||
| case trigger.LegacyLambdaRootStepFunctionEvent: | ||
| var event events.StepFunctionEvent[events.LambdaRootStepFunctionPayload] | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It felt a little repetitive to repeat the whole case for every "legacy lambda" case when in reality the only difference is the whole payload is wrapped in a But the alternative was to parse out this |
||
| if err := json.Unmarshal(payloadBytes, &event); err != nil { | ||
| log.Debugf("Failed to unmarshal %s event: %s", stepFunction, err) | ||
| break | ||
| } | ||
| ev = event.Payload | ||
| case trigger.LambdaRootStepFunctionEvent: | ||
| var eventPayload events.LambdaRootStepFunctionPayload | ||
| if err := json.Unmarshal(payloadBytes, &eventPayload); err != nil { | ||
| log.Debugf("Failed to unmarshal %s event: %s", stepFunction, err) | ||
| break | ||
| } | ||
| ev = eventPayload | ||
| default: | ||
| log.Debug("Skipping adding trigger types and inferred spans as a non-supported payload was received.") | ||
| } | ||
|
|
@@ -347,7 +365,6 @@ func (lp *LifecycleProcessor) newRequest(lambdaPayloadString []byte, startTime t | |
| if lp.requestHandler == nil { | ||
| lp.requestHandler = &RequestHandler{} | ||
| } | ||
| lp.requestHandler.event = nil | ||
| lp.requestHandler.executionInfo = &ExecutionStartInfo{ | ||
| requestPayload: lambdaPayloadString, | ||
| startTime: startTime, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This value is never being used, the
Event() interface{}inlifecycle.gowas probably used by something before but not anymore so I removed both