Skip to content
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

[SVLS-4422] Support for metrics with timestamps when the Extension is present #480

Merged
merged 2 commits into from
May 9, 2024

Conversation

DylanLovesCoffee
Copy link
Contributor

@DylanLovesCoffee DylanLovesCoffee commented Apr 26, 2024

What does this PR do?

Adds support for metrics with timestamps (AKA historical metrics) when using the Extension. Dogstatsd does not support historical distribution metrics yet, so we must use the Datadog API client.

We were lazy loading the DD API module when the Extension was not present, so I've tried to be careful not to undo that work. Even with these changes, we should only initialize the API client once per Lambda environment if a timestamp parameter is detected when using lambda_metric.

Screenshot 2024-04-26 at 10 50 31 AM

Flame graph of imported modules on a cold start:

Screenshot 2024-04-29 at 11 05 53 AM

Motivation

#398

Testing Guidelines

Added a simple unit test + manual testing.

Additional Notes

Sister PR for NodeJS: DataDog/datadog-lambda-js#522

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)

@DylanLovesCoffee DylanLovesCoffee requested a review from a team as a code owner April 26, 2024 15:05
Copy link
Contributor

@duncanista duncanista left a comment

Choose a reason for hiding this comment

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

Amazing work Dylan – thanks for lazy loading and improving the code!

Could we add a screenshot to the PR showing a flamegraph with the overhead implications of this change for customers using the extension + timestamp metrics?

@DylanLovesCoffee
Copy link
Contributor Author

Dismissing reviews for now since I'm running into an issue with this this PR where all spans in a cold start have different trace IDs :( will tackle after the weekend

Copy link
Contributor

@joeyzhao2018 joeyzhao2018 left a comment

Choose a reason for hiding this comment

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

LGTM

@DylanLovesCoffee DylanLovesCoffee merged commit dc03756 into main May 9, 2024
51 checks passed
@DylanLovesCoffee DylanLovesCoffee deleted the dylan/dist-metric-timestamp branch May 9, 2024 19:55
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