OpenFunction / functions-framework

functions-framework for multi-runtime, multi-type functions, and multi-language support
10 stars 6 forks source link

Add plug-in mechanism(interface) for functions-framework #8

Closed tpiperatgod closed 2 years ago

tpiperatgod commented 3 years ago

Feature request

We need to add an interface (similar to the lifecycle management standard) to the Functions-Framework. This interface will be used to provide standards for plug-in access and also to execute these plug-ins before the function is run.

User case

This interface can be used by projects like go2sky to set anchor points in functions.

Refer issue #146

ForeverArt commented 2 years ago

For the end span in skywalking, post-run is needed as well. Maybe the onion architecture is a great choice for further plugins/middlewares.

Besides, most Functions need same plugins to make things right. Maybe a control plane is needed for openfunction-controller? We may diff global plugins and function plugins for that.

Really interested in what plugin architecture OpenFunction would use and what changes it would bring to building and serving stages.

tpiperatgod commented 2 years ago

@ForeverArt Thank you for the suggestion! I will refer to the Onion Architecture.

I'm considering some detailed proposals that include a plugin mechanism for implementing OpenFunction in the form of a lifecycle of buildpacks.

And I hope to be able to abstract more generic parts of it so that it can be implemented in the same language, which would reduce the cost of dealing with functions-framework in different languages.

Feel free to join the #9. We can discuss the implementation proposals for the plugin mechanism here.

benjaminhuo commented 2 years ago

Proposal for plugin mechanism to function framework by @tpiperatgod https://hackmd.io/XwHWmAJwQWeCu18zQ97s_A?view=

benjaminhuo commented 2 years ago

Proposal created for this: https://github.com/OpenFunction/OpenFunction/blob/main/docs/proposals/202112_functions_framework_refactoring.md

benjaminhuo commented 2 years ago

close this via https://github.com/OpenFunction/functions-framework-go/pull/22