diff --git a/src/main/azure-functions-language-worker-protobuf/CODEOWNERS b/src/main/azure-functions-language-worker-protobuf/CODEOWNERS new file mode 100644 index 00000000..23847f14 --- /dev/null +++ b/src/main/azure-functions-language-worker-protobuf/CODEOWNERS @@ -0,0 +1,14 @@ +# See https://help.github.com/articles/about-codeowners/ +# for more info about CODEOWNERS file +# +# It uses the same pattern rule for gitignore file +# https://git-scm.com/docs/gitignore#_pattern_format + + + +# AZURE FUNCTIONS TEAM +# For all file changes, github would automatically +# include the following people in the PRs. +# Language owners should get notified of any new changes to the proto file. + +src/proto/FunctionRpc.proto @vrdmr @gavin-aguiar @YunchuWang @surgupta-msft @satvu @ejizba @alrod @anatolib @kaibocai @shreyas-gopalakrishna @amamounelsayed @Francisco-Gamino diff --git a/src/main/azure-functions-language-worker-protobuf/README.md b/src/main/azure-functions-language-worker-protobuf/README.md index 14c406e2..81deb0b9 100644 --- a/src/main/azure-functions-language-worker-protobuf/README.md +++ b/src/main/azure-functions-language-worker-protobuf/README.md @@ -36,14 +36,6 @@ From within the Azure Functions language worker repo: - `git commit -m "Updated subtree from https://github.com/azure/azure-functions-language-worker-protobuf. Tag: . Commit: "` - `git push` -## Releasing a Language Worker Protobuf version - -1. Draft a release in the GitHub UI - - Be sure to include details of the release -2. Create a release version, following semantic versioning guidelines ([semver.org](https://semver.org/)) -3. Tag the version with the pattern: `v..

-protofile` (example: `v1.1.0-protofile`) -3. Merge `dev` to `master` - ## Consuming FunctionRPC.proto *Note: Update versionNumber before running following commands* diff --git a/src/main/azure-functions-language-worker-protobuf/src/proto/FunctionRpc.proto b/src/main/azure-functions-language-worker-protobuf/src/proto/FunctionRpc.proto index 0a383b55..2c0e22d5 100644 --- a/src/main/azure-functions-language-worker-protobuf/src/proto/FunctionRpc.proto +++ b/src/main/azure-functions-language-worker-protobuf/src/proto/FunctionRpc.proto @@ -26,13 +26,13 @@ message StreamingMessage { oneof content { // Worker initiates stream - StartStream start_stream = 20; + StartStream start_stream = 20; // Host sends capabilities/init data to worker WorkerInitRequest worker_init_request = 17; // Worker responds after initializing with its capabilities & status WorkerInitResponse worker_init_response = 16; - + // Worker periodically sends empty heartbeat message to host WorkerHeartbeat worker_heartbeat = 15; @@ -40,7 +40,7 @@ message StreamingMessage { // Worker terminates if it can, otherwise host terminates after a grace period WorkerTerminate worker_terminate = 14; - // Add any worker relevant status to response + // Host periodically sends status request to the worker WorkerStatusRequest worker_status_request = 12; WorkerStatusResponse worker_status_response = 13; @@ -49,25 +49,25 @@ message StreamingMessage { // Worker requests a desired action (restart worker, reload function) WorkerActionResponse worker_action_response = 7; - + // Host sends required metadata to worker to load function FunctionLoadRequest function_load_request = 8; // Worker responds after loading with the load result FunctionLoadResponse function_load_response = 9; - + // Host requests a given invocation InvocationRequest invocation_request = 4; // Worker responds to a given invocation InvocationResponse invocation_response = 5; - // Host sends cancel message to attempt to cancel an invocation. + // Host sends cancel message to attempt to cancel an invocation. // If an invocation is cancelled, host will receive an invocation response with status cancelled. InvocationCancel invocation_cancel = 21; // Worker logs a message back to the host RpcLog rpc_log = 2; - + FunctionEnvironmentReloadRequest function_environment_reload_request = 25; FunctionEnvironmentReloadResponse function_environment_reload_response = 26; @@ -78,14 +78,20 @@ message StreamingMessage { // Worker indexing message types FunctionsMetadataRequest functions_metadata_request = 29; - FunctionMetadataResponses function_metadata_responses = 30; + FunctionMetadataResponse function_metadata_response = 30; + + // Host sends required metadata to worker to load functions + FunctionLoadRequestCollection function_load_request_collection = 31; + + // Host gets the list of function load responses + FunctionLoadResponseCollection function_load_response_collection = 32; } } // Process.Start required info // connection details // protocol type -// protocol version +// protocol version // Worker sends the host information identifying itself message StartStream { @@ -93,7 +99,7 @@ message StartStream { string worker_id = 2; } -// Host requests the worker to initialize itself +// Host requests the worker to initialize itself message WorkerInitRequest { // version of the host sending init request string host_version = 1; @@ -107,17 +113,42 @@ message WorkerInitRequest { // Full path of worker.config.json location string worker_directory = 4; + + // base directory for function app + string function_app_directory = 5; } // Worker responds with the result of initializing itself message WorkerInitResponse { - // Version of worker + // NOT USED + // TODO: Remove from protobuf during next breaking change release string worker_version = 1; + // A map of worker supported features/capabilities map capabilities = 2; // Status of the response StatusResult result = 3; + + // Worker metadata captured for telemetry purposes + WorkerMetadata worker_metadata = 4; +} + +message WorkerMetadata { + // The runtime/stack name + string runtime_name = 1; + + // The version of the runtime/stack + string runtime_version = 2; + + // The version of the worker + string worker_version = 3; + + // The worker bitness/architecture + string worker_bitness = 4; + + // Optional additional custom properties + map custom_properties = 5; } // Used by the host to determine success/failure/cancellation @@ -128,6 +159,7 @@ message StatusResult { Success = 1; Cancelled = 2; } + // Status for the given result Status status = 4; @@ -141,9 +173,8 @@ message StatusResult { repeated RpcLog logs = 3; } -// TODO: investigate grpc heartbeat - don't limit to grpc implemention - -// Message is empty by design - Will add more fields in future if needed +// NOT USED +// TODO: Remove from protobuf during next breaking change release message WorkerHeartbeat {} // Warning before killing the process after grace_period @@ -176,12 +207,12 @@ message FileChangeEventRequest { // Indicates whether worker reloaded successfully or needs a restart message WorkerActionResponse { - // indicates whether a restart is needed, or reload succesfully + // indicates whether a restart is needed, or reload successfully enum Action { Restart = 0; Reload = 1; } - + // action for this response Action action = 1; @@ -189,11 +220,12 @@ message WorkerActionResponse { string reason = 2; } -// NOT USED -message WorkerStatusRequest{ +// Used by the host to determine worker health +message WorkerStatusRequest { } -// NOT USED +// Worker responds with status message +// TODO: Add any worker relevant status to response message WorkerStatusResponse { } @@ -220,7 +252,17 @@ message CloseSharedMemoryResourcesResponse { map close_map_results = 1; } -// Host tells the worker to load a Function +// Host tells the worker to load a list of Functions +message FunctionLoadRequestCollection { + repeated FunctionLoadRequest function_load_requests = 1; +} + +// Host gets the list of function load responses +message FunctionLoadResponseCollection { + repeated FunctionLoadResponse function_load_responses = 1; +} + +// Load request of a single Function message FunctionLoadRequest { // unique function identifier (avoid name collisions, facilitate reload case) string function_id = 1; @@ -252,7 +294,7 @@ message RpcFunctionMetadata { // base directory for the Function string directory = 1; - + // Script file specified string script_file = 2; @@ -273,6 +315,17 @@ message RpcFunctionMetadata { // Raw binding info repeated string raw_bindings = 10; + + // unique function identifier (avoid name collisions, facilitate reload case) + string function_id = 13; + + // A flag indicating if managed dependency is enabled or not + bool managed_dependency_enabled = 14; + + // Properties for function metadata + // They're usually specific to a worker and largely passed along to the controller API for use + // outside the host + map Properties = 16; } // Host tells worker it is ready to receive metadata @@ -282,12 +335,15 @@ message FunctionsMetadataRequest { } // Worker sends function metadata back to host -message FunctionMetadataResponses { +message FunctionMetadataResponse { // list of function indexing responses - repeated FunctionLoadRequest function_load_requests_results = 1; + repeated RpcFunctionMetadata function_metadata_results = 1; // status of overall metadata request StatusResult result = 2; + + // if set to true then host will perform indexing + bool use_default_metadata_indexing = 3; } // Host requests worker to invoke a Function @@ -464,7 +520,7 @@ message BindingInfo { DataType data_type = 4; } -// Used to send logs back to the Host +// Used to send logs back to the Host message RpcLog { // Matching ILogger semantics // https://github.com/aspnet/Logging/blob/9506ccc3f3491488fe88010ef8b9eb64594abf95/src/Microsoft.Extensions.Logging/Logger.cs @@ -515,7 +571,7 @@ message RpcLog { map propertiesMap = 9; } -// Encapsulates an Exception +// Encapsulates an Exception message RpcException { // Source of the exception string source = 3; @@ -525,6 +581,14 @@ message RpcException { // Textual message describing the exception string message = 2; + + // Worker specifies whether exception is a user exception, + // for purpose of application insights logging. Defaults to false. + bool is_user_exception = 4; + + // Type of exception. If it's a user exception, the type is passed along to app insights. + // Otherwise, it's ignored for now. + string type = 5; } // Http cookie type. Note that only name and value are used for Http requests @@ -569,7 +633,7 @@ message RpcHttpCookie { // TODO - solidify this or remove it message RpcHttp { string method = 1; - string url = 2; + string url = 2; map headers = 3; TypedData body = 4; map params = 10;