【问题标题】:Why do Dialog classes have a TelemetryClient property?为什么 Dialog 类有 TelemetryClient 属性?
【发布时间】:2019-10-07 19:16:14
【问题描述】:
【问题讨论】:
标签:
javascript
c#
node.js
botframework
【解决方案1】:
对话框具有 TelemetryClient 类通过显示最常用的功能、检测不需要的行为并提供对可用性、性能和使用情况的可见性来深入了解您的机器人。遥测日志记录使机器人应用程序能够将事件数据发送到遥测服务,例如 Application Insights。
TelemetryLoggerMiddleware、TelemetryLuisRecognizer、TelemetryQnAMaker 和 SkillConfiguration 使用 Microsoft.ApplicationInsights.TelemetryClient。建议从依赖注入容器中获取 TelemetryClient 的实例。 TelemetryClient 是线程安全的。 TelemetryClient 类将事件、指标和其他遥测数据发送到 Application Insights 服务。 TelemetryClient() 初始化 TelemetryClient 类的新实例。您可以使用活动配置发送遥测数据,通常从 ApplicationInsights.config 加载。
TelemetryClient 实例用于报告自动生成的遥测数据。用于发送所有类型遥测的遥测客户端。 它是与 Application Insights 服务交互的主要入口点。使用 .UseApplicationInsights() 或 AddApplicationInsights() 方法配置 Application Insights 时,TelemetryClient 会自动注入 DI。您可以使用构造函数注入来获取 TelemetryClient 实例。 Application Insights 遥测客户端有一个内存缓冲区和一个刷新间隔(默认为 1 分钟),用于将缓冲的遥测数据发送到 AI 端点。
Bot Framework 提供 TelemetryClient,但也允许用户提供自己的,以便他们可以更改记录的内容。
希望这会有所帮助。