尝试在Application Insights中创建自定义事件,但该事件未显示在Azure Portal上。所有其他事件(如请求,依赖项,异常)都是可见的。
我已经在dotnet core中尝试过,并且可以在调试日志中看到以下内容,但是门户中仍然没有事件,即使自定义事件表为空:
Application Insights Telemetry: {"name":"Microsoft.ApplicationInsights.Dev.<instrumentkey>.Event","time":"2019-12-05T19:16:34.1373921Z","iKey":"<instrument key>","tags":{"ai.application.ver":"1.0.0.0","ai.cloud.roleInstance":"<role>","ai.session.id":"<session>","ai.user.id":"<user>","ai.operation.id":"<operation>","ai.operation.parentId":"|<some ids>","ai.operation.name":"GET /auth/login","ai.location.ip":"::1","ai.internal.sdkVersion":"dotnetc:2.11.0-21474","ai.internal.nodeName":"<subscription>"},"data":{"baseType":"EventData","baseData":{"ver":2,"name":"SAML_Authentication_Initiated","properties":{"DeveloperMode":"true","AspNetCoreEnvironment":"Local"}}}}
也尝试过使用javascript,可以在浏览器控制台中看到以下成功的发布请求:
POST https://dc.services.visualstudio.com/v2/track
[{"time":"2019-12-05T19:00:21.781Z","iKey":"<instrumentkey>","name":"Microsoft.ApplicationInsights.<instrumentkey>.Event","tags":{"ai.user.id":"<user>","ai.session.id":"<session>","ai.device.id":"browser","ai.device.type":"Browser","ai.operation.name":"/public","ai.operation.id":"<operationid>","ai.internal.sdkVersion":"javascript:2.3.1"},"data":{"baseType":"EventData","baseData":{"ver":2,"name":"CustomEvent","properties":{},"measurements":{}}}}]
响应
{"itemsReceived":1,"itemsAccepted":1,"errors":[],"appId":"<application id>"}
不确定Azure需要多少时间来处理自定义事件,还是应该创建支持通知单,否则最终会出错。
答案 0 :(得分:0)
应用洞察通常需要3-5分钟,数据才能开始出现在门户中,请参阅本official doc的注释部分。
如果您担心数据丢失,可以使用Flush()方法。
如果始终需要5分钟以上的时间才能在门户中显示数据,则应考虑opening a support ticket以获得专业帮助。