Azure functions Application Insights遥测配置。活动

Azure functions Application Insights遥测配置。活动,azure-functions,Azure Functions,有人能帮我弄清楚这房子到底是做什么的吗 关于本文件: 它明确指出: private static string key = TelemetryConfiguration.Active.InstrumentationKey = System.Environment.GetEnvironmentVariable( "APPINSIGHTS_INSTRUMENTATIONKEY", EnvironmentVariableTarget.Proc

有人能帮我弄清楚这房子到底是做什么的吗

关于本文件:

它明确指出:

 private static string key = TelemetryConfiguration.Active.InstrumentationKey = 
            System.Environment.GetEnvironmentVariable(
                "APPINSIGHTS_INSTRUMENTATIONKEY", EnvironmentVariableTarget.Process);
但是,
遥测配置
从此不再使用。。。
字符串为,因为这用于在创建
遥测客户端()时设置
仪器键

  private static TelemetryClient telemetryClient = 
            new TelemetryClient() { InstrumentationKey = key };
这是有道理的,但是遥测配置到底做了什么

Re:函数,我想做的是有一个中心日志帮助器类,我可以在其中有一个静态遥测客户端,然后为使用它的每个函数设置以下内容

x.Context.Cloud.RoleName = "myRole";
x.Context.Operation.Id = executionContext.InvocationId.ToString();
x应该设置在
遥测客户端
对象上,还是设置在正在记录的实际
遥测
对象上


Ty.

遥测配置。活动。当您使用默认遥测客户端而不是创建自己的遥测客户端时,将使用InstrumentationKey
。例如,默认的一个ILogger登录到。

好的,我想。。。但是在我的例子中,我是在
遥测客户端(TelemetryConfiguration.Active)
上设置RoleName属性,还是在
遥测
上设置RoleName属性?