Skip to content

Update Step Function Context Parsing #325

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

Merged
merged 6 commits into from
Dec 12, 2022

Conversation

kimi-p
Copy link
Contributor

@kimi-p kimi-p commented Dec 9, 2022

What does this PR do?

Update Step Function context parsing. Other PRs to use this Step Function context will be added in later weeks.

Motivation

The original event format with additional dd field in the payload was added back in 2019 for one private beta customer. The current event format looks like this:

AWS Step Functions context object doc: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-contextobject.html

{
    "Execution": {
        "Id": "arn:aws:states:sa-east-1:425362996713:express:logs-to-traces-sequential:774c6ee3-5f13-2fd9-1b7a-ac145d303a00:2de41e71-7adb-457c-a8b1-f323d7c49788",
        "Input": {
            "Comment": "Insert your JSON here"
        },
        "Name": "774c6ee3-5f13-2fd9-1b7a-ac145d303a00",
        "RoleArn": "arn:aws:iam::425362996713:role/service-role/StepFunctions-logs-to-traces-sequential-role-ccd69c03",
        "StartTime": "2022-12-09T16:10:28.936Z"
    },
    "StateMachine": {
        "Id": "arn:aws:states:sa-east-1:425362996713:stateMachine:logs-to-traces-sequential",
        "Name": "logs-to-traces-sequential"
    },
    "State": {
        "Name": "Lambda Invoke - First",
        "EnteredTime": "2022-12-09T16:10:28.941Z",
        "RetryCount": 0
    }
}

Testing Guidelines

Only unit test needed as no lambda has Step Functions context now.

Additional Notes

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)

@kimi-p kimi-p requested a review from a team as a code owner December 9, 2022 20:28
@codecov-commenter
Copy link

codecov-commenter commented Dec 9, 2022

Codecov Report

Merging #325 (f322331) into main (d44d456) will decrease coverage by 8.96%.
The diff coverage is 68.87%.

❗ Current head f322331 differs from pull request most recent head 6cd1236. Consider uploading reports for the commit 6cd1236 to get more accurate results

@@            Coverage Diff             @@
##             main     #325      +/-   ##
==========================================
- Coverage   87.65%   78.68%   -8.97%     
==========================================
  Files          29       36       +7     
  Lines         972     1783     +811     
  Branches      169      414     +245     
==========================================
+ Hits          852     1403     +551     
- Misses         82      327     +245     
- Partials       38       53      +15     
Impacted Files Coverage Δ
src/runtime/errors.ts 0.00% <0.00%> (ø)
src/runtime/index.ts 0.00% <0.00%> (ø)
src/runtime/user-function.ts 0.00% <0.00%> (ø)
src/trace/listener.ts 68.18% <49.23%> (-23.76%) ⬇️
src/trace/span-wrapper.ts 50.00% <50.00%> (ø)
src/trace/tracer-wrapper.ts 80.48% <53.33%> (-12.62%) ⬇️
src/metrics/kms-service.ts 63.15% <56.25%> (+19.40%) ⬆️
src/metrics/listener.ts 85.36% <61.90%> (+15.62%) ⬆️
src/trace/trace-context-service.ts 83.87% <64.28%> (-13.43%) ⬇️
src/trace/context.ts 78.30% <74.07%> (-12.52%) ⬇️
... and 27 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link

@nine5two7 nine5two7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

This reverts commit 6cd1236, reversing
changes made to 86f72ff.
Copy link

@nine5two7 nine5two7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kimi-p kimi-p merged commit 9e1957e into main Dec 12, 2022
@kimi-p kimi-p deleted the kimi.update_step_function_context_parsing branch December 12, 2022 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants