-
Notifications
You must be signed in to change notification settings - Fork 16
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
[Issue #3207] Update to use newrelic.agent.background_task #3208
Conversation
api/src/task/ecs_background_task.py
Outdated
@@ -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() |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, thanks
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
Co-authored-by: Michael Chouinard <[email protected]>
…ithub.com/HHS/simpler-grants-gov into mikehgrantsgov/3207-update-new-relic-init
…ithub.com/HHS/simpler-grants-gov into mikehgrantsgov/3207-update-new-relic-init
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.