Eclipse JPetShop和Azure应用程序洞察

Eclipse JPetShop和Azure应用程序洞察,eclipse,spring,azure-application-insights,Eclipse,Spring,Azure Application Insights,我想测试Microsoft Azure的Application Insight工具。 因此,我使用了一个Spring应用程序jpetshop(),并尝试按照以下指南在其上设置应用程序洞察: 我添加了Maven依赖项和存储库,多亏了Eclipse,我用InstrumentationKey创建了ApplicationInsights.xml文件。我唯一不确定的是如何在这个应用程序上添加HTTP过滤器 我以这种方式修改了web.xml: <?xml version="1.0" encod

我想测试Microsoft Azure的Application Insight工具。 因此,我使用了一个Spring应用程序jpetshop(),并尝试按照以下指南在其上设置应用程序洞察:

我添加了Maven依赖项和存储库,多亏了Eclipse,我用InstrumentationKey创建了ApplicationInsights.xml文件。我唯一不确定的是如何在这个应用程序上添加HTTP过滤器

我以这种方式修改了web.xml:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5">
    <display-name>JPetStore</display-name>
    <description>Online Pet Store Sample Application</description>
    <context-param>
        <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
        <param-value>StripesResources</param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <filter>
        <display-name>Stripes Filter</display-name>
        <filter-name>StripesFilter</filter-name>
        <filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class>
        <init-param>
            <param-name>ActionResolver.Packages</param-name>
            <param-value>org.mybatis.jpetstore.web</param-value>
        </init-param>
        <init-param>
            <param-name>Extension.Packages</param-name>
            <param-value>net.sourceforge.stripes.integration.spring</param-value>
        </init-param>

        <init-param>
            <param-name>ApplicationInsightsRequestNameInterceptor</param-name>
            <param-value>com.microsoft.applicationinsights.web.struts.RequestNameInterceptor</param-value>
        </init-param>     

    </filter>
    <filter-mapping>
        <filter-name>StripesFilter</filter-name>
        <servlet-name>StripesDispatcher</servlet-name>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <servlet>
        <servlet-name>StripesDispatcher</servlet-name>
        <servlet-class>net.sourceforge.stripes.controller.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>StripesDispatcher</servlet-name>
        <url-pattern>*.action</url-pattern>
    </servlet-mapping>
</web-app>

JPetStore
网上宠物店示例应用程序
javax.servlet.jsp.jstl.fmt.localizationContext
条纹资源
org.springframework.web.context.ContextLoaderListener
条纹滤光片
条纹滤光片
net.sourceforge.stripes.controller.StripesFilter
ActionResolver.Packages
org.mybatis.jpetstore.web
扩展包
net.sourceforge.strips.integration.spring
ApplicationInsightsRequestNameInterceptor
com.microsoft.applicationinsights.web.struts.RequestNameInterceptor
条纹滤光片
条带调度器
要求
条带调度器
net.sourceforge.stripes.controller.DispatcherServlet
1.
条带调度器
*.行动
但是,如果我按照指南中所示更改过滤器映射器字段,应用程序将不再工作

由于jpetshop应用程序使用Spring框架,因此我还想修改*-servlet.xml文件。但是,此项目中不存在此文件

您知道如何使Azure Application Insight在此应用程序上工作吗?
谢谢

我想您错过了需要定义ApplicationInsights过滤器的部分:

<filter>
  <filter-name>ApplicationInsightsWebFilter</filter-name>
  <filter-class>
    com.microsoft.applicationinsights.web.internal.WebRequestTrackingFilter
  </filter-class>
</filter>
<filter-mapping>
   <filter-name>ApplicationInsightsWebFilter</filter-name>
   <url-pattern>/*</url-pattern>
</filter-mapping>

应用说明SWebfilter
com.microsoft.applicationinsights.web.internal.WebRequestTrackingFilter
应用说明SWebfilter
/*