This document describes how to enable APIM analytics with wso2 DAS using a file. Note that in order to configure analytics using XML, APIM should be started or restart after the configuration done.
In 1.10.x analytics can be configured using both UI and XML based. UI configuration is straightforward and the document can be found from here. To configure using XML follow steps mentioned here
<!-- For APIM implemented Statistic client for DAS REST API --> <StatisticClientProvider>org.wso2.carbon.apimgt.usage.client.impl.APIUsageStatisticsRestClientImpl</StatisticClientProvider>
<datasource> <name>WSO2AM_STATS_DB</name> <description>The datasource used for registry and user manager</description> <jndiConfig> <name>jdbc/WSO2AM_STATS_DB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://localhost:3306/APIM_STAT?autoReconnect=true&</url> <username>root</username> <password>pass</password> <driverClassName>com.mysql.jdbc.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> <defaultAutoCommit>false</defaultAutoCommit> </configuration> </definition> </datasource>
<!-- API usage tracker configuration used by the DAS data publisher and Google Analytics publisher in API gateway. --> <APIUsageTracking> <!-- Below property is used to enable API Manager analytics configuration via api-manager.xml Enabling analytics via a configuration file can be useful in scenarios such as automated deployments where UI integration is inconvenient. If you uncomment this property, analytics configurations added via admin-dashboard UI will get overwritten by tha configuration details provided below when you restart the server. --> <Enabled>true</Enabled> <!-- Server URL of the remote DAS/CEP server used to collect statistics. Must be specified in protocol://hostname:port/ format. An event can also be published to multiple Receiver Groups each having 1 or more receivers. Receiver Groups are delimited by curly braces whereas receivers are delimited by commas. Ex - Multiple Receivers within a single group tcp://localhost:7612/,tcp://localhost:7613/,tcp://localhost:7614/ Ex - Multiple Receiver Groups with two receivers each {tcp://localhost:7612/,tcp://localhost:7613},{tcp://localhost:7712/,tcp://localhost:7713/} --> <DASServerURL>{tcp://localhost:7612/}</DASServerURL> <!-- Administrator username to login to the remote DAS server. --> <DASUsername>admin</DASUsername> <!-- Administrator password to login to the remote DAS server. --> <DASPassword>admin</DASPassword> <!-- DAS REST API configuration Set the values if .'org.wso2.carbon.apimgt.usage.client.impl.APIUsageStatisticsRestClientImpl' is used as Statistic Client --> <DASRestApiURL>https://localhost:9444</DASRestApiURL> <DASRestApiUsername>admin</DASRestApiUsername> <DASRestApiPassword>admin</DASRestApiPassword> <!-- Below property is used to skip trying to connect to event receiver nodes when publishing events even if the stats enabled flag is set to true. --> <SkipEventReceiverConnection>false</SkipEventReceiverConnection> <!-- API Usage Data Publisher. --> <PublisherClass>org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageDataBridgeDataPublisher</PublisherClass> <!-- If below property set to true,then the response message size will be calculated and publish with each successful API invocation event. --> <PublishResponseMessageSize>false</PublishResponseMessageSize> <!-- Data publishing stream names and versions of API requests, responses and faults. If the default values are changed, the toolbox also needs to be changed accordingly. --> <Streams> <Request> <Name>org.wso2.apimgt.statistics.request</Name> <Version>1.0.0</Version> </Request> <Response> <Name>org.wso2.apimgt.statistics.response</Name> <Version>1.0.0</Version> </Response> <Fault> <Name>org.wso2.apimgt.statistics.fault</Name> <Version>1.0.0</Version> </Fault> <Destination> <Name>org_wso2_apimgt_statistics_destination</Name> <Version>1.0.0</Version> <BAMProfileName>bam-profile</BAMProfileName> </Destination> <Throttle> <Name>org.wso2.apimgt.statistics.throttle</Name> <Version>1.0.0</Version> </Throttle> <Workflow> <Name>org.wso2.apimgt.statistics.workflow</Name> <Version>1.0.0</Version> </Workflow> </Streams> </APIUsageTracking> <!-- For APIM implemented Statistic client for DAS REST API --> <StatisticClientProvider>org.wso2.carbon.apimgt.usage.client.impl.APIUsageStatisticsRestClientImpl</StatisticClientProvider> <!-- For APIM implemented Statistic client for RDBMS --> <!--StatisticClientProvider>org.wso2.carbon.apimgt.usage.client.impl.APIUsageStatisticsRdbmsClientImpl</StatisticClientProvider-->
<!-- For APIM implemented Statistic client for DAS REST API --> <StatsProviderImpl>org.wso2.carbon.apimgt.usage.client.impl.APIUsageStatisticsRestClientImpl</StatsProviderImpl>
<datasource> <name>WSO2AM_STATS_DB</name> <description>The datasource used for registry and user manager</description> <jndiConfig> <name>jdbc/WSO2AM_STATS_DB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://localhost:3306/APIM_STAT?autoReconnect=true&</url> <username>root</username> <password>pass</password> <driverClassName>com.mysql.jdbc.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> <defaultAutoCommit>false</defaultAutoCommit> </configuration> </definition> </datasource>
<!-- API usage tracker configuration used by the DAS data publisher and Google Analytics publisher in API gateway. --> <Analytics> <!-- Enable Analytics for API Manager --> <Enabled>false</Enabled> <!-- Server URL of the remote DAS/CEP server used to collect statistics. Must be specified in protocol://hostname:port/ format. An event can also be published to multiple Receiver Groups each having 1 or more receivers. Receiver Groups are delimited by curly braces whereas receivers are delimited by commas. Ex - Multiple Receivers within a single group tcp://localhost:7612/,tcp://localhost:7613/,tcp://localhost:7614/ Ex - Multiple Receiver Groups with two receivers each {tcp://localhost:7612/,tcp://localhost:7613},{tcp://localhost:7712/,tcp://localhost:7713/} --> <DASServerURL>{tcp://localhost:7612}</DASServerURL> <!-- Administrator username to login to the remote DAS server. --> <DASUsername>admin</DASUsername> <!-- Administrator password to login to the remote DAS server. --> <DASPassword>admin</DASPassword> <!-- For APIM implemented Statistic client for DAS REST API --> <StatsProviderImpl>org.wso2.carbon.apimgt.usage.client.impl.APIUsageStatisticsRestClientImpl</StatsProviderImpl> <!-- For APIM implemented Statistic client for RDBMS --> <!--StatsProviderImpl>org.wso2.carbon.apimgt.usage.client.impl.APIUsageStatisticsRdbmsClientImpl</StatsProviderImpl--> <!-- DAS REST API configuration Set the values if .'org.wso2.carbon.apimgt.usage.client.impl.APIUsageStatisticsRestClientImpl' is used as Statistic Client --> <DASRestApiURL>https://localhost:9444</DASRestApiURL> <DASRestApiUsername>admin</DASRestApiUsername> <DASRestApiPassword>admin</DASRestApiPassword> <!-- Below property is used to skip trying to connect to event receiver nodes when publishing events even if the stats enabled flag is set to true. --> <SkipEventReceiverConnection>false</SkipEventReceiverConnection> <!-- API Usage Data Publisher. --> <PublisherClass>org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageDataBridgeDataPublisher</PublisherClass> <!-- If below property set to true,then the response message size will be calculated and publish with each successful API invocation event. --> <PublishResponseMessageSize>false</PublishResponseMessageSize> <!-- Data publishing stream names and versions of API requests, responses and faults. If the default values are changed, the toolbox also needs to be changed accordingly. --> <Streams> <Request> <Name>org.wso2.apimgt.statistics.request</Name> <Version>1.1.0</Version> </Request> <Response> <Name>org.wso2.apimgt.statistics.response</Name> <Version>1.1.0</Version> </Response> <Fault> <Name>org.wso2.apimgt.statistics.fault</Name> <Version>1.0.0</Version> </Fault> <Destination> <Name>org_wso2_apimgt_statistics_destination</Name> <Version>1.0.0</Version> <BAMProfileName>bam-profile</BAMProfileName> </Destination> <Throttle> <Name>org.wso2.apimgt.statistics.throttle</Name> <Version>1.0.0</Version> </Throttle> <Workflow> <Name>org.wso2.apimgt.statistics.workflow</Name> <Version>1.0.0</Version> </Workflow> <ExecutionTime> <Name>org.wso2.apimgt.statistics.execution.time</Name> <Version>1.0.0</Version> </ExecutionTime> <AlertTypes> <Name>org.wso2.analytics.apim.alertStakeholderInfo</Name> <Version>1.0.0</Version> </AlertTypes> </Streams> </Analytics>
Add Comment
Comments (0)