Configure Cloud Role Name for Application Insights in an Azure Function App

非 Y 不嫁゛ 提交于 2020-01-06 07:15:12

问题


I would like to set the cloud_rolename of the telemetry sent from my Azure Function App (v2) that is sent to application insights.

The AI configuration in my host.json looks like this:

 "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?


回答1:


You should be able to do this by registering a custom TelemetryInitializer. See here: 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.

Can I ask what your scenario is that you'd want to override it?



来源:https://stackoverflow.com/questions/53042476/configure-cloud-role-name-for-application-insights-in-an-azure-function-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!