mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-15 11:28:09 +00:00
add flag to enable memory and cpu profilers (#2345)
Co-authored-by: stas <statis@microsoft.com>
This commit is contained in:
@ -10,6 +10,7 @@ param app_func_issuer string
|
||||
param app_func_audiences array
|
||||
param multi_tenant_domain string
|
||||
param enable_remote_debugging bool = false
|
||||
param enable_profiler bool = false
|
||||
|
||||
param location string = resourceGroup().location
|
||||
|
||||
@ -315,6 +316,7 @@ module pythonFunctionSettings 'bicep-templates/function-settings.bicep' = {
|
||||
multi_tenant_domain: multi_tenant_domain
|
||||
functions_disabled: python_functions_disabled
|
||||
use_dotnet_agent_functions: use_dotnet_agent_functions
|
||||
enable_profiler: false
|
||||
all_function_names: [
|
||||
'agent_can_schedule' //0
|
||||
'agent_commands' //1
|
||||
@ -380,6 +382,7 @@ module netFunctionSettings 'bicep-templates/function-settings.bicep' = {
|
||||
multi_tenant_domain: multi_tenant_domain
|
||||
functions_disabled: dotnet_functions_disabled
|
||||
use_dotnet_agent_functions: false // this doesn’t do anything on the .NET service
|
||||
enable_profiler: enable_profiler
|
||||
all_function_names: [
|
||||
'AgentCanSchedule' //0
|
||||
'AgentCommands' //1
|
||||
|
@ -31,6 +31,8 @@ param use_dotnet_agent_functions bool
|
||||
|
||||
param all_function_names array
|
||||
|
||||
param enable_profiler bool
|
||||
|
||||
var disabledFunctionName = 'disabledFunctions-${functions_worker_runtime}'
|
||||
|
||||
var telemetry = 'd7a73cf4-5a1a-4030-85e1-e5b25867e45a'
|
||||
@ -47,6 +49,11 @@ module disabledFunctions 'function-settings-disabled-apps.bicep' = {
|
||||
}
|
||||
}
|
||||
|
||||
var enable_profilers = enable_profiler ? {
|
||||
APPINSIGHTS_PROFILERFEATURE_VERSION : '1.0.0'
|
||||
DiagnosticServices_EXTENSION_VERSION: '~3'
|
||||
} : {}
|
||||
|
||||
resource functionSettings 'Microsoft.Web/sites/config@2021-03-01' = {
|
||||
parent: function
|
||||
name: 'appsettings'
|
||||
@ -72,5 +79,5 @@ resource functionSettings 'Microsoft.Web/sites/config@2021-03-01' = {
|
||||
ONEFUZZ_OWNER: owner
|
||||
ONEFUZZ_CLIENT_SECRET: client_secret
|
||||
ONEFUZZ_USE_DOTNET_AGENT_FUNCTIONS: use_dotnet_agent_functions ? '1' : '0'
|
||||
}, disabledFunctions.outputs.appSettings)
|
||||
}, disabledFunctions.outputs.appSettings, enable_profilers)
|
||||
}
|
||||
|
@ -164,6 +164,7 @@ class Client:
|
||||
cli_app_id: str,
|
||||
auto_create_cli_app: bool,
|
||||
host_dotnet_on_windows: bool,
|
||||
enable_profiler: bool,
|
||||
):
|
||||
self.subscription_id = subscription_id
|
||||
self.resource_group = resource_group
|
||||
@ -199,6 +200,7 @@ class Client:
|
||||
self.cli_app_id = cli_app_id
|
||||
self.auto_create_cli_app = auto_create_cli_app
|
||||
self.host_dotnet_on_windows = host_dotnet_on_windows
|
||||
self.enable_profiler = enable_profiler
|
||||
|
||||
self.cli_config: Dict[str, Union[str, UUID]] = {
|
||||
"client_id": self.cli_app_id,
|
||||
@ -637,6 +639,10 @@ class Client:
|
||||
self.host_dotnet_on_windows,
|
||||
)
|
||||
|
||||
logger.info(
|
||||
"template parameter enable_profiler is set to: %s", self.enable_profiler
|
||||
)
|
||||
|
||||
params = {
|
||||
"app_func_audiences": {"value": app_func_audiences},
|
||||
"name": {"value": self.application_name},
|
||||
@ -649,6 +655,7 @@ class Client:
|
||||
"workbookData": {"value": self.workbook_data},
|
||||
"use_dotnet_agent_functions": {"value": self.use_dotnet_agent_functions},
|
||||
"enable_remote_debugging": {"value": self.host_dotnet_on_windows},
|
||||
"enable_profiler": {"value": self.enable_profiler},
|
||||
}
|
||||
deployment = Deployment(
|
||||
properties=DeploymentProperties(
|
||||
@ -1422,6 +1429,12 @@ def main() -> None:
|
||||
action="store_true",
|
||||
help="Use windows runtime for hosting dotnet Azure Function",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--enable_profiler",
|
||||
action="store_true",
|
||||
help="Enable CPU and memory profiler in dotnet Azure Function",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
if shutil.which("func") is None:
|
||||
@ -1456,6 +1469,7 @@ def main() -> None:
|
||||
cli_app_id=args.cli_app_id,
|
||||
auto_create_cli_app=args.auto_create_cli_app,
|
||||
host_dotnet_on_windows=args.host_dotnet_on_windows,
|
||||
enable_profiler=args.enable_profiler,
|
||||
)
|
||||
if args.verbose:
|
||||
level = logging.DEBUG
|
||||
|
Reference in New Issue
Block a user