WSO2: StatisticsClient

2019-09-08 15:29发布

问题:

How can i use StatisticsAdmin of Application Server

My scenario is : i want to get responsetime of a service that deploy on a server(AppServer/DataServer..) and probed by ESB using discoveryproxy of governance regidtry. if is it possible how can i implement it? otherwise i should be get service response time from AppServer in direct using service name. i can create a proxy of ServerAdminMBean using this package and interface

import org.wso2.carbon.server.admin.service.ServerAdminMBean

but i need to use attributes and method of StatisticsAdmin type. how can i implement it?

回答1:

you dont need to do your own implementation. it is already in the service statistics page. You can find the service stat details in the monitor-->System Statistics page. If you need more fine grained details about your service,you might need to integrate BAM with AS.



回答2:

Once you deploy any service, there's a log message prints in server back end console.(you may noticed that before). That message handled by the "LoggingAdmin" admin service. In that admin service there's a operation called "getSystemLog" and this operation sends all log messages one by one. you can create simple java class to call that admin service and get the deployed time stamp of each of the service you are deployed. if you know the service deployment start time, with above admin service you can get time taken to each of the service deployment.



回答3:

You can use JMX to access those information. There is StatisticAdmin MBena available for monitoring in . You can refer this to get an idea how to invoke them using Java.