如何使用 Terraform 启用 Application Insights?
How to enable Application Insights using Terraform?
使用 Terraform,如何为
启用基于 Application Insights 代理的监视
Azure 应用服务(.NET 核心 2.x)
Azure 函数应用程序 (.NET Core 2.x)
要为 Azure App Service (.NET Core 2.x) Azure Function App (.NET Core 2.x) 启用 Application Insights agent-based 监控,您只需添加应用程序设置中用于应用程序洞察的环境变量,如下所示:
在 Azure 门户中:
在地形中:
app_settings = {
"APPINSIGHTS_INSTRUMENTATIONKEY" = "${azurerm_application_insights.example.instrumentation_key}"
}
结果显示函数 "functioninsighttest":
的日志
显然,到 2021 年,有两种方法可以做到这一点。
第二个是:
app_settings = {
"MSDEPLOY_RENAME_LOCKED_FILES" = "1"
"WEBSITE_HEALTHCHECK_MAXPINGFAILURES" = "10"
"ASPNETCORE_ENVIRONMENT" = "Development"
"APPINSIGHTS_INSTRUMENTATIONKEY" = azurerm_application_insights.appi1.instrumentation_key
"APPLICATIONINSIGHTS_CONNECTION_STRING" = azurerm_application_insights.appi1.connection_string
"APPINSIGHTS_PROFILERFEATURE_VERSION" = "1.0.0"
"APPINSIGHTS_SNAPSHOTFEATURE_VERSION" = "1.0.0"
"ApplicationInsightsAgent_EXTENSION_VERSION" = "~2"
"DiagnosticServices_EXTENSION_VERSION" = "~3"
"InstrumentationEngine_EXTENSION_VERSION" = "disabled"
"SnapshotDebugger_EXTENSION_VERSION" = "disabled"
"XDT_MicrosoftApplicationInsights_BaseExtensions" = "disabled"
"XDT_MicrosoftApplicationInsights_Java" = "1"
"XDT_MicrosoftApplicationInsights_Mode" = "recommended"
"XDT_MicrosoftApplicationInsights_NodeJS" = "1"
"XDT_MicrosoftApplicationInsights_PreemptSdk" = "disabled"
}
使用 Terraform,如何为
启用基于 Application Insights 代理的监视Azure 应用服务(.NET 核心 2.x) Azure 函数应用程序 (.NET Core 2.x)
要为 Azure App Service (.NET Core 2.x) Azure Function App (.NET Core 2.x) 启用 Application Insights agent-based 监控,您只需添加应用程序设置中用于应用程序洞察的环境变量,如下所示:
在 Azure 门户中:
在地形中:
app_settings = {
"APPINSIGHTS_INSTRUMENTATIONKEY" = "${azurerm_application_insights.example.instrumentation_key}"
}
结果显示函数 "functioninsighttest":
的日志显然,到 2021 年,有两种方法可以做到这一点。
第二个是:
app_settings = {
"MSDEPLOY_RENAME_LOCKED_FILES" = "1"
"WEBSITE_HEALTHCHECK_MAXPINGFAILURES" = "10"
"ASPNETCORE_ENVIRONMENT" = "Development"
"APPINSIGHTS_INSTRUMENTATIONKEY" = azurerm_application_insights.appi1.instrumentation_key
"APPLICATIONINSIGHTS_CONNECTION_STRING" = azurerm_application_insights.appi1.connection_string
"APPINSIGHTS_PROFILERFEATURE_VERSION" = "1.0.0"
"APPINSIGHTS_SNAPSHOTFEATURE_VERSION" = "1.0.0"
"ApplicationInsightsAgent_EXTENSION_VERSION" = "~2"
"DiagnosticServices_EXTENSION_VERSION" = "~3"
"InstrumentationEngine_EXTENSION_VERSION" = "disabled"
"SnapshotDebugger_EXTENSION_VERSION" = "disabled"
"XDT_MicrosoftApplicationInsights_BaseExtensions" = "disabled"
"XDT_MicrosoftApplicationInsights_Java" = "1"
"XDT_MicrosoftApplicationInsights_Mode" = "recommended"
"XDT_MicrosoftApplicationInsights_NodeJS" = "1"
"XDT_MicrosoftApplicationInsights_PreemptSdk" = "disabled"
}