为什么我无法看到在WSO2 API管理器存储统计数据?(Why am I unable to vie

2019-10-19 08:10发布

请大家注意,这个问题已更新为我最近有记录的工作。 在日志下面是原来的张贴与我的configs,而我看到的行为。 今天,WSO2 APIM继续发送到BAM接收其更新的统计数据库。 然而,当我点击任何在发布我得到的统计数据链接:

TID: [0] [AM] [2014-03-04 13:43:18,815] ERROR {org.wso2.carbon.apimgt.hostobjects.APIProviderHostObject} -  Error while invoking APIUsageStatisticsClient for ProviderAPIUsage {org.wso2.carbon.apimgt.hostobjects.APIProviderHostObject}
org.wso2.carbon.apimgt.usage.client.exception.APIMgtUsageQueryServiceClientException: Error occurred while querying from JDBC database
        at org.wso2.carbon.apimgt.usage.client.APIUsageStatisticsClient.queryFirstAccess(APIUsageStatisticsClient.java:1747)
        at org.wso2.carbon.apimgt.usage.client.APIUsageStatisticsClient.getFirstAccessTime(APIUsageStatisticsClient.java:1675)
        at org.wso2.carbon.apimgt.hostobjects.APIProviderHostObject.jsFunction_getFirstAccessTime(APIProviderHostObject.java:2911)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
        at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:386)
        at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
        at org.jaggeryjs.rhino.publisher.modules.statistics.c1._c_getFirstAccessTime_13(/publisher/modules/statistics/usage.jag:351)
        at org.jaggeryjs.rhino.publisher.modules.statistics.c1.call(/publisher/modules/statistics/usage.jag)
        at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2430)
        at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:269)
        at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:97)
        at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
        at org.jaggeryjs.rhino.publisher.modules.statistics.c0._c_anonymous_13(/publisher/modules/statistics/module.jag:29)
        at org.jaggeryjs.rhino.publisher.modules.statistics.c0.call(/publisher/modules/statistics/module.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
        at org.jaggeryjs.rhino.publisher.site.blocks.stats.ajax.c0._c_anonymous_1(/publisher/site/blocks/stats/ajax/stats.jag:220)
        at org.jaggeryjs.rhino.publisher.site.blocks.stats.ajax.c0.call(/publisher/site/blocks/stats/ajax/stats.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.call0(OptRuntime.java:23)
        at org.jaggeryjs.rhino.publisher.site.blocks.stats.ajax.c0._c_script_0(/publisher/site/blocks/stats/ajax/stats.jag:4)
        at org.jaggeryjs.rhino.publisher.site.blocks.stats.ajax.c0.call(/publisher/site/blocks/stats/ajax/stats.jag)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
        at org.jaggeryjs.rhino.publisher.site.blocks.stats.ajax.c0.call(/publisher/site/blocks/stats/ajax/stats.jag)
        at org.jaggeryjs.rhino.publisher.site.blocks.stats.ajax.c0.exec(/publisher/site/blocks/stats/ajax/stats.jag)
        at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:570)
        at org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:273)
        at org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:432)
        at org.jaggeryjs.jaggery.core.JaggeryServlet.doPost(JaggeryServlet.java:29)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
        at org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:21)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
        at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:178)
        at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
        at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:56)
        at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
        at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:141)
        at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
        at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:744)
Caused by: java.sql.SQLException: Incorrect syntax near 'limit'.
        at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)
        at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988)
        at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421)
        at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:671)
        at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:505)
        at net.sourceforge.jtds.jdbc.JtdsStatement.executeQuery(JtdsStatement.java:1427)
        at org.wso2.carbon.apimgt.usage.client.APIUsageStatisticsClient.queryFirstAccess(APIUsageStatisticsClient.java:1729)
        ... 63 more
TID: [0] [AM] [2014-03-04 13:43:18,836] ERROR {JAGGERY.modules.statistics.usage:jag} -  java.lang.NullPointerException: null {JAGGERY.modules.statistics.usage:jag}

我已经配置WSO2 API管理器1.6.0和2.4.0 BAM两者使用相同的数据源配置WSO2AM_STATS_DB。 对于商店是相匹配的BAM服务器(下),API-Manager.xml的条目被更新为一个单一的WSO2AM_STATS_DB条目:

  <APIUsageTracking>
        <Enabled>true</Enabled>
<PublisherClass>org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageDataBridgeDataPublisher</PublisherClass>
        <ThriftPort>7612</ThriftPort>
        <BAMServerURL>tcp://myBAMserver:7612/</BAMServerURL>
        <BAMUsername>user</BAMUsername>
        <BAMPassword>pwd</BAMPassword>
        <DataSourceName>jdbc/WSO2AM_STATS_DB</DataSourceName>
        <GoogleAnalyticsTracking>
             <Enabled>false</Enabled>
             <TrackingID>UA-XXXXXXXX-X</TrackingID>
       </GoogleAnalyticsTracking>
    </APIUsageTracking>

而现在的数据源的APIM:

<datasource>
    <name>WSO2AM_STATS_DB</name>
    <description>The datasource used for getting statistics to API Manager</description>
    <jndiConfig>
        <name>jdbc/WSO2AM_STATS_DB</name>
    </jndiConfig>
    <definition type="RDBMS">
        <configuration>
            <defaultAutoCommit>false</defaultAutoCommit>
            <url>jdbc:jtds:sqlserver://mydbserver:1433/wso2_apiStatsdb</url>
            <username>wso2storeuser</username>
            <password>storepwd</password>
            <driverClassName>net.sourceforge.jtds.jdbc.Driver</driverClassName>
            <maxActive>50</maxActive>
            <maxWait>60000</maxWait>
            <testOnBorrow>true</testOnBorrow>
            <validationQuery>SELECT 1</validationQuery>
            <validationInterval>30000</validationInterval>
        </configuration>
    </definition>
 </datasource>

对于BAM服务器这里有我的数据源:

<datasource>
        <name>WSO2_CARBON_DB</name>
        <description>The datasource used for API Manager database</description>
        <jndiConfig>
            <name>jdbc/WSO2CarbonDB</name>
        </jndiConfig>
        <definition type="RDBMS">
            <configuration>
                <defaultAutoCommit>false</defaultAutoCommit>
                <url>jdbc:jtds:sqlserver://mydbserver:1433/wso2_carbondb</url>
                <username>user</username>
                <password>pwd</password>
                <driverClassName>net.sourceforge.jtds.jdbc.Driver</driverClassName>
                <maxActive>50</maxActive>
                <maxWait>60000</maxWait>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1</validationQuery>
                <validationInterval>30000</validationInterval>
            </configuration>
        </definition>
    </datasource>

    <datasource>
        <name>WSO2AM_STATS_DB</name>
        <description>The datasource used for getting statistics to API Manager</description>
        <jndiConfig>
            <name>jdbc/WSO2AM_STATS_DB</name>
        </jndiConfig>
        <definition type="RDBMS">
            <configuration>
                <defaultAutoCommit>false</defaultAutoCommit>
                <url>jdbc:jtds:sqlserver://mydbserver:1433/wso2_apiStatsdb</url>
                <username>user</username>
                <password>pwd</password>
                <driverClassName>net.sourceforge.jtds.jdbc.Driver</driverClassName>
                <maxActive>50</maxActive>
                <maxWait>60000</maxWait>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1</validationQuery>
                <validationInterval>30000</validationInterval>
            </configuration>
        </definition>
     </datasource>

    <datasource>
        <name>WSO2BAM_DATASOURCE</name>
        <description>The datasource used for analyzer data</description>
        <definition type="RDBMS">
            <configuration>
                <defaultAutoCommit>false</defaultAutoCommit>
                <url>jdbc:jtds:sqlserver://mydbserver:1433/wso2_apiStatsdb</url>
                <username>user</username>
                <password>pwd</password>
                <driverClassName>net.sourceforge.jtds.jdbc.Driver</driverClassName>
                <maxActive>50</maxActive>
                <maxWait>60000</maxWait>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1</validationQuery>
                <validationInterval>30000</validationInterval>
            </configuration>
        </definition>
    </datasource>

        <datasource>
        <name>WSO2BAM_CASSANDRA_DATASOURCE</name>
        <description>The datasource used for Cassandra data</description>
        <definition type="RDBMS">
            <configuration>
                <url>jdbc:cassandra://localhost:9161/EVENT_KS</url>
                <username>admin</username>
                <password>admin</password>
            </configuration>
        </definition>
    </datasource>

    <datasource>
        <name>WSO2BAM_UTIL_DATASOURCE</name>
        <description>The datasource used for BAM utilities, such as message store etc..</description>
        <definition type="RDBMS">
            <configuration>
                <url>jdbc:cassandra://localhost:9161/BAM_UTIL_KS</url>
                <username>admin</username>
                <password>admin</password>
            </configuration>
        </definition>
    </datasource>

    <!-- The URL configs are loaded from cassandra-component.xml -->
    <datasource>
        <name>WSO2BAM_HIVE_INCREMENTAL_DATASOURCE</name>
        <definition type="RDBMS">
            <configuration>
                <username>admin</username>
                <password>admin</password>
                <dataSourceProps>
                    <property name="replicationFactor">1</property>
                    <property name="strategyClass">org.apache.cassandra.locator.SimpleStrategy</property>
                    <property name="readConsistencyLevel">QUORUM</property>
                    <property name="writeConsistencyLevel">QUORUM</property>
                    <property name="keyspaceName">HIVE_INCREMENTAL_KS</property>
                </dataSourceProps>
            </configuration>
        </definition>
    </datasource>

当我看着mydbserver / wso2_apiStatsdb我看到,创建下表,并已与数据更新:

API_REQUEST_SUMMARY,API_Resource_USAGE_SUMMARY更新:一些附加的表已被添加和更新... API_FAULT_SUMMARY,API_RESPONSE_SUMMARY,API_VERSION_USAGE_SUMMARY

然而,当我去到发布商网页,我得到:

至于我可以告诉我已经更新了发布/存储和网关/密钥管理器将数据发送到服务器BAM。 该BAM服务器似乎进程并在SQL Server数据库汇总数据。 我的条目为发布/存储配置和BAM服务器配置SQL Server数据库匹配。 有没有人有什么我失踪,使我看到了统计数据在发布时,任何想法?

Answer 1:

Gammonster,这已经想通了。 看来,魔鬼确实在细节 - 运行时试图执行使用SQL Server数据库的“限制”关键字的SQL查询和SQL Server不支持“限价”。 它有“顶”来代替。

会赞赏如果产品文档明确标识的SQL Server不为BAM首选数据库实例。



Answer 2:

u能请检查EnableBillingAndUsage设置为false 。 这是的conf / API-manager.xml可用

<EnableBillingAndUsage>false</EnableBillingAndUsage>


Answer 3:

您是否在使用BAM端口抵消1? 至于我可以看到你有一个不同的服务器上运行BAM。 尝试运行BAM与港口偏移1.在网站提供的默认配置是一个用例,其中API Manager和BAM与港口偏移在同一台服务器上运行(API中号-0和BAM -1)。 因此,所有相关的节俭端口由1默认的配置也增加。 因此,我建议你上偏移1运行BAM。

在此期间请检查是否MQSQL DB已经总结统计里面含有任何数据。



Answer 4:

如果你还没有在API管理器中正确配置汇总数据库,也会发生这种情况。 从你所提到的东西,API经理似乎正确发布的数据,但它无法获取汇总数据。 请看看你是否已经在主datasources.xml定义APIM目录内WSO2AM_STATS_DB。



文章来源: Why am I unable to view stats in the WSO2 API Manager Store?
标签: wso2 wso2bam