【问题标题】:Link event to dependency?将事件链接到依赖项?
【发布时间】:2020-05-07 01:18:49
【问题描述】:

我正在使用 TelemetryClient.TrackEvent 记录我的 .NET Core/C# Web 服务中的文件上传及其持续时间和吞吐量。

我还使用 DependencyTelemetry 将我的事件处理的各个阶段连接在一起:

        using var dop = TelemetryClient.StartOperation<DependencyTelemetry>("Upload file event", correlationId);

但是,我看不到将自定义事件连接到依赖项的方法,因此它显示在 Application Insights 性能页面中。我看到我的请求和子依赖项,但没有自定义事件。很高兴看到从我的依赖项中生成的自定义事件全部链接在一起。

这可能吗?

【问题讨论】:

    标签: c# azure-application-insights


    【解决方案1】:

    想通了,现在我正在获取链接到请求/依赖项的跟踪。还展示了如何在 TelemetryClient 上设置自定义角色名称。

    var tconfiguration = new TelemetryConfiguration
            {
                InstrumentationKey = Configuration.GetSection("ApplicationInsights")?["InstrumentationKey"]
            };
            tconfiguration.TelemetryInitializers.Add(new OperationCorrelationTelemetryInitializer());
            this.TelemetryClient = new TelemetryClient(tconfiguration);
            TelemetryClient.Context.Cloud.RoleName = Configuration.GetSection("ApplicationInsights")?["RoleName"];
    

    【讨论】:

      猜你喜欢
      • 2019-03-18
      • 2014-11-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多