Skip to content

cold start tracing (python) #299

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 13 commits into from
Feb 13, 2023
Merged

cold start tracing (python) #299

merged 13 commits into from
Feb 13, 2023

Conversation

joeyzhao2018
Copy link
Contributor

@joeyzhao2018 joeyzhao2018 commented Feb 12, 2023

What does this PR do?

Add Cold Start Tracing feature to Datadog lambda python layer.
This feature is already available in datadog-lambda-js layer and this is its PR link.

Motivation

Showing the spans to indicate the time consumed by loading each modules can help users better understand the cold start causes.

Testing Guidelines

Deployed in a testing lambda.

  1. Check the spans show up as expected. Screenshot 2023-02-13 at 10 14 30 AM
  2. Invoke it multiple times to see non-cold-start cases.Screenshot 2023-02-13 at 10 18 02 AM
  3. Tested with the inferred-spans-python setup, which has one lambda triggering following lambdas via SQS/SNS etc. Screenshot 2023-02-13 at 3 34 44 PM
  4. Change the env variables to see they are working as expected.
    • with DD_COLD_START_TRACING=false Screenshot 2023-02-13 at 10 20 47 AM
    • with DD_MIN_COLD_START_DURATION=80Screenshot 2023-02-13 at 10 26 37 AM
    • with DD_COLD_START_TRACE_SKIP_LIB=ddtrace.internal.sampling,jsonschemaScreenshot 2023-02-13 at 10 27 56 AM

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)

@joeyzhao2018 joeyzhao2018 requested a review from a team as a code owner February 12, 2023 20:00
Copy link
Contributor

@astuyve astuyve left a comment

Choose a reason for hiding this comment

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

Great work on this Joey. I think overall it's ready to go, just two comments.

@astuyve
Copy link
Contributor

astuyve commented Feb 13, 2023

Ship it! :shipit:

@joeyzhao2018 joeyzhao2018 merged commit 3e09ff4 into main Feb 13, 2023
@joeyzhao2018 joeyzhao2018 deleted the joey/coldstart branch February 13, 2023 20:39
@PierreKiwi
Copy link

Hello,
Is this feature documented anywhere ? Because it appears to be a significant change (not sure about the billing aspect).

@astuyve
Copy link
Contributor

astuyve commented Mar 7, 2023

Hi @PierreKiwi - there's a blog post here and environment variables controlling the granularity of this feature are documented here for now, which will expand as we roll out support to new runtimes and integrations.

Also if you have specific questions, feel free to ping me in our open slack: https://chat.datadoghq.com/

@PierreKiwi
Copy link

PierreKiwi commented Mar 7, 2023

Thanks @astuyve !
I saw the blog so I connected the dots eventually. I was googling DD_COLD_START_TRACING but it did not lead me anywhere :)
Also, I am using the CDK construct v2 where the new options are not yet available.

@astuyve
Copy link
Contributor

astuyve commented Mar 7, 2023

No problem, it's great to hear from our users either way!

Sorry for that, I'm working with our technical writers to further document these features more centrally. And yes, CDK is next on my list.

If you've got specific questions, definitely reach out in slack and I'm happy to help answer anything specifically.

I hope this helps you!

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.

3 participants