Azure门户不显示详细信息

时间:2019-06-25 06:09:21

标签: angular azure-application-insights

即使已完成集成,也无法在Azure Portal中查看适当的日志。

遵循了 https://louiseclark.tech/azure-application-insights/adding-application-insights-angular

需要查看Azure Portal中的所有详细信息,例如用户名,当前URL,名称。我需要自己传递所有参数,还是应用程序见解会自行捕获它。请帮助。

in app-insights-service
        constructor(private router: Router) {
            if (!AppInsights.config) { 
                AppInsights.downloadAndSetup(this.config);
            }
        }

        logPageView(name: string, url?: string, properties?: any, measurements?: any, duration?: number) {
            AppInsights.trackPageView(name, url, properties, measurements, duration);
        }


in app.component.ts, in constructor, I invoked these by
        this.appInsightsService.logPageView('Sequation-UI-PageView');

我是否需要传递这样的参数,否则Application Insight会自行捕获详细信息。

2 个答案:

答案 0 :(得分:1)

根据此doc,网址/名称应具有默认值,有关详细信息,请参见下面的屏幕截图。对于其他人的属性,您应该将它们手动添加到方法中的properties参数中。

enter image description here

答案 1 :(得分:0)

Azure Application Insights的所有自定义方法都可以使用,但是取决于调用这些方法的方式和位置。 对于页面名称,我从URL中获取了页面名称,并在app.component.ts中调用trackPageView()并从URL中传递了第一个参数。

对于用户名,我在用户登录后获取登录名,并在sigin服务中调用appInsight方法setAuthenticatedUserContext并将用户名作为参数暂停。

对于事件,我使用有角度的hostListener来获取事件,并调用appInsight方法trackEvent()并将传递的事件作为参数传递。

这对我有用。

相关问题