Monitoring Integration Transactions Counts¶
A Transaction in WSO2 Micro Integrator is typically defined as an inbound request (a request coming to the server). That is, any inbound request to a REST API, Proxy service, or Inbound Endpoint is considered as one transaction.
However, when the Micro Integrator is configured as both the message producer and consumer to handle asynchronous messaging scenarios, the two requests (listening request and sending request) are considered as a single transaction.
If you need to track the number of transactions in your Micro Integrator deployment, you can enable the transaction counter component in each Micro Integrator instance of your deployment. Currently, the transaction counter is responsible for counting all requests received via the HTTP Passthru and JMS transports and for persisting the summary of the transaction count in a database for future use.
Follow the instructions given below.
Step 1 - Enabling the transaction counter¶
Configure a relational database to persist transaction count information and then enable the Transaction Counter component from the deployment.toml
file (stored in the <MI_HOME>/conf
folder).
-
Select the preferred database type from the list given below and follow the relevant link to set up a database.
-
Once you have set up the database, verify that the
deployment.toml
file of your Micro Integrator contains the relevant datasource configurations:[[datasource]] id = "WSO2_TRANSACTION_DB" url= "jdbc:mysql://localhost:3306/transactiondb" username="root" password="root" driver="com.mysql.jdbc.Driver" pool_options.maxActive=50 pool_options.maxWait = 60000 pool_options.testOnBorrow = true
[[datasource]] id = "WSO2_TRANSACTION_DB" url= "jdbc:sqlserver://<IP>:1433;databaseName=transactiondb;SendStringParametersAsUnicode=false" username="root" password="root" driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" pool_options.maxActive=50 pool_options.maxWait = 60000 pool_options.testOnBorrow = true
[[datasource]] id = "WSO2_TRANSACTION_DB" url= "jdbc:oracle:thin:@SERVER_NAME:PORT/SID" username="root" password="root" driver="oracle.jdbc.OracleDriver" pool_options.maxActive=50 pool_options.maxWait = 60000 pool_options.testOnBorrow = true
[[datasource]] id = "WSO2_TRANSACTION_DB" url= "jdbc:postgresql://localhost:5432/transactiondb" username="root" password="root" driver="org.postgresql.Driver" pool_options.maxActive=50 pool_options.maxWait = 60000 pool_options.testOnBorrow = true
[[datasource]] id = "WSO2_TRANSACTION_DB" url="jdbc:db2://SERVER_NAME:PORT/transactiondb" username="root" password="root" driver="com.ibm.db2.jcc.DB2Driver" pool_options.maxActive=50 pool_options.maxWait = 60000 pool_options.testOnBorrow = true
-
Add the parameters given below to the
deployment.toml
file and update the values.[transaction_counter] enable = true data_source = "WSO2_TRANSACTION_DB" update_interval = 2
Parameters used above are explained below.
Parameter Description enable
This paramter is used for enabling the Transaction Counter. Default value if 'false'. data_source
The ID of the datasource. This refers the datasource ID configured under the datasource configuration. update_interval
The transaction count is stored in the database with an interval (specified by this parameter, which will be taken as the number of minutes) between the insert queries. The default update interval is one minute.
Step 2 - Getting the transaction count¶
You can get the transaction count for a particular month or period. This data can be viewed or saved to a report. There are two ways to get transaction count data:
-
Start the APICTL and use the mi transaction option.
-
Directly access the Management API resources and invoke the /transaction/count and /transaction/report resources.