[英]Configure Cloud Role Name for Application Insights in an Azure Function App
I would like to set the cloud_rolename of the telemetry sent from my Azure Function App (v2) that is sent to application insights.我想设置从我的 Azure Function App (v2) 发送到应用程序洞察的遥测的 cloud_rolename。
The AI configuration in my host.json looks like this:我的 host.json 中的 AI 配置如下所示:
"applicationInsights": {
"sampling": {
"isEnabled": true,
"maxTelemetryItemsPerSecond" : 1
}
}
I have been unable to find any documentation on where to set cloud rolename in function apps.我一直找不到关于在函数应用程序中设置云角色名称的位置的任何文档。 How should I go about this?
我应该怎么做?
You should be able to do this by registering a custom TelemetryInitializer
.您应该能够通过注册自定义
TelemetryInitializer
来做到这一点。 See here: https://github.com/Microsoft/ApplicationInsights-aspnetcore/issues/759#issuecomment-426687852 .请参阅此处: https : //github.com/Microsoft/ApplicationInsights-aspnetcore/issues/759#issuecomment-426687852 。
We currently set that role name in an initializer today here: https://github.com/Azure/azure-webjobs-sdk/blob/dev/src/Microsoft.Azure.WebJobs.Logging.ApplicationInsights/Initializers/WebJobsRoleEnvironmentTelmetryInitializer.cs .我们目前在今天的初始化程序中设置该角色名称: https : //github.com/Azure/azure-webjobs-sdk/blob/dev/src/Microsoft.Azure.WebJobs.Logging.ApplicationInsights/Initializers/WebJobsRoleEnvironmentTelmetryInitializer.cs 。
Can I ask what your scenario is that you'd want to override it?我能问一下你的情况是你想覆盖它吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.