在Azure功能应用程序中为应用程序见解配置云角色名称 [英] Configure Cloud Role Name for Application Insights in an Azure Function App

查看:79
本文介绍了在Azure功能应用程序中为应用程序见解配置云角色名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设置从Azure功能应用程序(v2)发送的遥测的cloud_rolename,该遥测名称发送到应用程序见解.

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

host.json中的AI配置如下:

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?

推荐答案

您应该可以通过注册自定义TelemetryInitializer来做到这一点.请参阅此处: https://github.com/Microsoft/Application/Insights-aspnetcore/issues/759#issuecomment-426687852 .

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?

这篇关于在Azure功能应用程序中为应用程序见解配置云角色名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆