Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure 事件详细信息中未显示RequestTelemetry上下文中的Application Insights设置用户_Azure_Azure Application Insights - Fatal编程技术网

Azure 事件详细信息中未显示RequestTelemetry上下文中的Application Insights设置用户

Azure 事件详细信息中未显示RequestTelemetry上下文中的Application Insights设置用户,azure,azure-application-insights,Azure,Azure Application Insights,我正在使用Application Insights跟踪我的应用程序的使用情况。在我的服务层中,我使用App Insights API手动跟踪请求和异常,并禁用了跟踪请求和异常的遥测初始值设定项和模块的默认集,以支持基于我使用的框架的一些自定义检测。但是,当我手动跟踪这样的请求时,在Application Insights仪表板上的请求详细信息中看不到任何用户信息 一个简化的版本,演示了我遇到的问题: Microsoft.ApplicationInsights.Extensibility.Tele

我正在使用Application Insights跟踪我的应用程序的使用情况。在我的服务层中,我使用App Insights API手动跟踪请求和异常,并禁用了跟踪请求和异常的遥测初始值设定项和模块的默认集,以支持基于我使用的框架的一些自定义检测。但是,当我手动跟踪这样的请求时,在Application Insights仪表板上的请求详细信息中看不到任何用户信息

一个简化的版本,演示了我遇到的问题:

Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.Active
.InstrumentationKey=“”;
var tc=新遥测客户端();
var request=newrequesttelemetry();
request.Context.User.Id=“1234”;
request.Name=“测试请求”;
tc.TrackRequest(请求);
2015年11月30日编辑


这是application insights门户中的一个bug。这件事已经解决了。

应该行得通,我也做过类似的事情。 为了澄清,您在仪表板中看到了自定义请求遥测,但在用户图表中没有看到任何数据?
您还可以尝试设置AuthenticatedUserId字段,看看是否有效。

除了Userid之外,还可以尝试设置SessionId。当sessionId为null时,我们会自动将Userid置为null,它应该可以工作。我们正在调查这个问题

我在这里创建了一个问题:

我最近发现,如果未在遥测上下文中设置UserAgent,则将忽略用户和会话数据。
尝试将Context.User.UserAgent设置为某个值(理想情况下是HttpContext.Request.UserAgent,但任何非空字符串都可以工作)。

尝试了AccountId,但没有更改。当我从搜索页面查看请求时,我甚至没有在请求属性的完整列表中看到UserId。在请求上设置
request.Context.Session.Id
似乎也不起作用。我应该遵循标识符的格式要求吗?为了查看SessionId、UserId或UserAgent,实际上需要设置所有3个。我将在github发行版@bret grinslade中报告这一点。