How to Troubleshoot WSO2 Products — 1. How to get Average TPS with API Manager Analytics

define stream countRequestStream(count long);
define stream countFaultStream(count long);
define stream countThrottleStream(count long);
@sink(type='log')
define stream requestLogStream(count long);
@sink(type='log')
define stream faultLogStream(count long);
@sink(type='log')
define stream throttleLogStream(count long);
from InComingRequestStream
select count() as count
insert into countRequestStream;
from FaultStream
select count() as count
insert into countFaultStream;
from ThrottledOutStream
select count() as count
insert into countThrottleStream;
from countRequestStream[count == 1 or count % 10000 == 0]
select count
insert into requestLogStream;
from countFaultStream[count == 1 or count % 500 == 0]
select count
insert into faultLogStream;
from countThrottleStream[count == 1 or count % 500 == 0]
select count
insert into throttleLogStream;
from InComingRequestStream
select count() as count
insert into countRequestStream;
from countRequestStream[count == 1 or count % 10000 == 0]
select count
insert into requestLogStream;
[2020–04–24 00:03:56,695] INFO {org.wso2.siddhi.core.stream.output.sink.LogSink} — APIM_EVENT_RECEIVER : throttleLogStream : Event{timestamp=1587666836693, data=[1], isExpired=false}[2020–04–24 00:03:56,704] INFO {org.wso2.siddhi.core.stream.output.sink.LogSink} — APIM_EVENT_RECEIVER : requestLogStream : Event{timestamp=1587666836704, data=[1], isExpired=false}[2020–04–24 00:03:56,710] INFO {org.wso2.siddhi.core.stream.output.sink.LogSink} — APIM_EVENT_RECEIVER : faultLogStream : Event{timestamp=1587666836710, data=[1], isExpired=false}[2020–04–27 00:03:54,065] INFO {org.wso2.siddhi.core.stream.output.sink.LogSink} — APIM_EVENT_RECEIVER : faultLogStream : Event{timestamp=1587945834065, data=[1000], isExpired=false}[2020–04–27 00:03:55,626] INFO {org.wso2.siddhi.core.stream.output.sink.LogSink} — APIM_EVENT_RECEIVER : throttleLogStream : Event{timestamp=1587945835626, data=[2500], isExpired=false}[2020–04–27 00:04:28,125] INFO {org.wso2.siddhi.core.stream.output.sink.LogSink} — APIM_EVENT_RECEIVER : requestLogStream : Event{timestamp=1587945868125, data=[35000000], isExpired=false}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store