将事件链接到依赖关系?

问题描述 投票:0回答:1

我正在使用TelemetryClient.TrackEvent来记录我的.NET CoreC# web服务中的文件上传,以及它们的持续时间和吞吐量。

我也在使用DependencyTelemetry来连接事件处理的各个阶段。

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

然而,我没有看到将自定义事件连接到依赖关系的方法,所以它显示在Application Insights性能页面。 我看到了我的请求和子依赖,但没有自定义事件。 如果能看到从我的依赖关系中产生的自定义事件,并且所有事件都链接在一起,那就太好了。

这可能吗?

c# azure-application-insights
1个回答
0
投票

解决了这个问题,现在我得到了链接到requestsdependencies的痕迹。 同时也展示了如何在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"];
© www.soinside.com 2019 - 2024. All rights reserved.