gpt4 book ai didi

C# Application Insights - TelemetryClient 的多个实例

转载 作者:行者123 更新时间:2023-12-03 04:46:21 26 4
gpt4 key购买 nike

我想将 Application Insights 遥测数据记录到我自己的帐户和客户的帐户中。

使用 TelemetryClient 的多个实例将相同的数据记录到两个不同的 Application Insights 检测 key 是否存在任何问题?或者有更好的方法吗?

最佳答案

您可以在 TelemetryClient 级别指定 InstrumentationKey:

    this.Client = new TelemetryClient();
this.Client.InstrumentationKey = "<your ikey>";

或者直接在单个项目级别:

    public void ModifyItem(ITelemetry item)
{
// Replace ikey
item.Context.InstrumentationKey = this.ikey;
}

如果您要将自动收集的数据发送到不同的 ikey,那么您可以在 TelemetryInitializer 中修改检测 key ,甚至可以使用 TelemetryProcessor 自己直接发送数据。

关于C# Application Insights - TelemetryClient 的多个实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50849460/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com