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

fix hello route hit too early #147

Merged
merged 3 commits into from Jun 21, 2021
Merged

Conversation

maxday
Copy link
Contributor

@maxday maxday commented Jun 16, 2021

What does this PR do?

Call the /hello route at the right moment

Motivation

Consistency in metric tagging with the extension

Testing Guidelines

With integration testing

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)

@maxday maxday requested a review from a team as a code owner June 16, 2021 17:47
@nhinsch
Copy link
Contributor

nhinsch commented Jun 16, 2021

Would you mind explaining the old behavior, why it was wrong, and what the new behavior is? From the diff, I couldn't quite follow how this changed the timing of the /hello route.

@maxday
Copy link
Contributor Author

maxday commented Jun 16, 2021

Sure !
Old behaviour : the code responsible to call the hello route was located at the root of the metry.py. So as soon as this file gets imported, the code executes. This file is imported in wrapper.py so the code will be executed before the actual invocation. This results in hitting the /hello route before setting the extra tags since tags extraction is done once we received the actual invocation.
New behaviour : the code is within a dedicated function which is triggered after that we have notified the extension of an invocation event, so the extension can set the tag properly and metrics sent from the layer to the extension can be properly enhanced with extra tags.

Copy link
Contributor

@nhinsch nhinsch left a comment

Choose a reason for hiding this comment

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

LGTM
Is this possible to test in the library, or will we rely on integration tests for this?

@maxday maxday merged commit 37369f1 into main Jun 21, 2021
@maxday maxday deleted the maxday/fix-hello-route-hit-too-early branch June 21, 2021 13:47
@maxday
Copy link
Contributor Author

maxday commented Jun 21, 2021

I think integration tests is a good fit for this one as there are already some unit tests on this part

@yury-sannikov
Copy link

Well, it seems it's breaking tons of code.

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.

None yet

3 participants