在本文件中:
https://docs.microsoft.com/en-us/azure/azure-functions/functions-monitoring#custom-telemetry-in-c-functions
它明确指出:
private static string key = TelemetryConfiguration.Active.InstrumentationKey =
System.Environment.GetEnvironmentVariable(
"APPINSIGHTS_INSTRUMENTATIONKEY", EnvironmentVariableTarget.Process);
TelemetryConfiguration
再也不用了。。。这个
key
InstumentationKey
创建
TelemetryClient()
private static TelemetryClient telemetryClient =
new TelemetryClient() { InstrumentationKey = key };
这是有道理的,但是遥测配置到底做了什么?!
关于:函数,我想做的是有一个中央日志助手类,我可以有一个静态遥测客户端,然后为每个使用它的函数设置以下内容。。。
x.Context.Cloud.RoleName = "myRole";
x.Context.Operation.Id = executionContext.InvocationId.ToString();
TelemetryClient
对象,或实际
Telemetry
正在记录的对象。。