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

[Issue #3207] Update to use newrelic.agent.background_task #3208

Merged
merged 10 commits into from
Dec 16, 2024

Conversation

mikehgrantsgov
Copy link
Collaborator

@mikehgrantsgov mikehgrantsgov commented Dec 13, 2024

Summary

Fixes #3207

Time to review: 5 mins

Changes proposed

Init NR code in ECS background tasks.

Context for reviewers

ECS Background tasks need NR initialization as well.

@@ -47,8 +49,12 @@ def entrypoint(db_session: db.Session):
def decorator(f: Callable[P, T]) -> Callable[P, T]:
@wraps(f)
def wrapper(*args: P.args, **kwargs: P.kwargs) -> T:
# Initialize New Relic at the start of any task
init_newrelic()
Copy link
Collaborator

Choose a reason for hiding this comment

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

We'd still keep init where it was, create_app gets called when we start up the API as a service and for background tasks already, and all that happens well before this for background tasks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Makes sense, thanks

Copy link
Collaborator

Choose a reason for hiding this comment

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

We shouldn't need this here - create_app already is called so init_newrelic was already called well before this

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Got it -- forgot that create_app is called on every task well

mikehgrantsgov and others added 5 commits December 13, 2024 12:08
Co-authored-by: Michael Chouinard <[email protected]>
…ithub.com/HHS/simpler-grants-gov into mikehgrantsgov/3207-update-new-relic-init
@mikehgrantsgov mikehgrantsgov changed the title Update to use newrelic.agent.background_task [Issue #3207] Update to use newrelic.agent.background_task Dec 13, 2024
@mikehgrantsgov mikehgrantsgov marked this pull request as ready for review December 13, 2024 18:46
…ithub.com/HHS/simpler-grants-gov into mikehgrantsgov/3207-update-new-relic-init
@mikehgrantsgov mikehgrantsgov merged commit b05225b into main Dec 16, 2024
2 checks passed
@mikehgrantsgov mikehgrantsgov deleted the mikehgrantsgov/3207-update-new-relic-init branch December 16, 2024 15:02
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.

Update New Relic Initialization for ECS background tasks
2 participants