-
Notifications
You must be signed in to change notification settings - Fork 44
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
Add app-level startup hooks #577
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hossam-nasr
changed the title
Add app-level startup and teardown hooks
Add app-level startup hooks
Jun 3, 2022
hossam-nasr
force-pushed
the
hossamnasr/app-hooks
branch
from
June 3, 2022 21:24
1bf177d
to
bc3ea5e
Compare
ejizba
reviewed
Jun 3, 2022
ejizba
reviewed
Jun 8, 2022
ejizba
reviewed
Jun 15, 2022
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.
I think we already discussed all of this offline, but just documenting what I think is left for the PR
hossam-nasr
force-pushed
the
hossamnasr/app-hooks
branch
from
June 24, 2022 01:00
2aa5cfe
to
32da711
Compare
Addressed most comments, should be ready for another pass :) |
ejizba
reviewed
Jun 24, 2022
ejizba
approved these changes
Jun 28, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Partially implements #539. This PR builds on the work to add invocation hooks (#548) and to support app-level code (#576), to provide the ability to register app startup hooks, which are run in
workerInitHandler
(orfunctionEnvironmentReloadHandler
in the specialization scenario).In addition, some additions/decisions in this PR, which may require more discussion:
worker_terminate
signal for elegant shutdown of the worker. This issue is currently being worker on in the host (Add support to gracefully shutdown language worker azure-functions-host#2308 and Added support to gracefully shutdown language worker azure-functions-host#8385). Once this issue is implemented, a handler for theworker_terminate
gRPC message can be added to add app teardown hooks.logger
property toHookContext
, which allows all hooks, including invocation and app startup hooks, to emit user logs to app insights.hookContext.invocationContext.log
. Duplicating properties is bad design.AppStartupContext
provided to app startup hooks also includes ahookData
property. ThathookData
property is copied to invocation hooks' contexts'hookData
property, but cannot be directly modified by each invocation.hookData
property can in the future be shared between app-level hooks, such as app teardown hook.