getServiceTPSTrend:
1. Change the parameter name: Start -> startTimeBucket End -> endTimeBucket 2. Calculate callsPerSec metric.
This commit is contained in:
parent
96b5b20398
commit
c33ac107e2
|
|
@ -65,16 +65,19 @@ public class ServiceQuery implements Query {
|
|||
}
|
||||
|
||||
public ResponseTimeTrend getServiceResponseTimeTrend(int serviceId, Duration duration) throws ParseException {
|
||||
long start = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getStart());
|
||||
long end = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getEnd());
|
||||
return getServiceNameService().getServiceResponseTimeTrend(serviceId, duration.getStep(), start, end);
|
||||
long startTimeBucket = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getStart());
|
||||
long endTimeBucket = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getEnd());
|
||||
return getServiceNameService().getServiceResponseTimeTrend(serviceId, duration.getStep(), startTimeBucket, endTimeBucket);
|
||||
}
|
||||
|
||||
public ThroughputTrend getServiceTPSTrend(int serviceId, Duration duration) throws ParseException {
|
||||
long start = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getStart());
|
||||
long end = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getEnd());
|
||||
long startTimeBucket = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getStart());
|
||||
long endTimeBucket = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getEnd());
|
||||
|
||||
return getServiceNameService().getServiceTPSTrend(serviceId, duration.getStep(), start, end);
|
||||
long startSecondTimeBucket = DurationUtils.INSTANCE.durationToSecondTimeBucket(duration.getStep(), duration.getStart());
|
||||
long endSecondTimeBucket = DurationUtils.INSTANCE.durationToSecondTimeBucket(duration.getStep(), duration.getEnd());
|
||||
|
||||
return getServiceNameService().getServiceTPSTrend(serviceId, duration.getStep(), startTimeBucket, endTimeBucket, startSecondTimeBucket, endSecondTimeBucket);
|
||||
}
|
||||
|
||||
public SLATrend getServiceSLATrend(int serviceId, Duration duration) throws ParseException {
|
||||
|
|
|
|||
|
|
@ -66,21 +66,23 @@ public class ServiceNameService {
|
|||
return serviceNameServiceUIDAO.searchService(keyword, topN);
|
||||
}
|
||||
|
||||
public ThroughputTrend getServiceTPSTrend(int serviceId, Step step, long start, long end) throws ParseException {
|
||||
public ThroughputTrend getServiceTPSTrend(int serviceId, Step step, long startTimeBucket,
|
||||
long endTimeBucket, long startSecondTimeBucket, long endSecondTimeBucket) throws ParseException {
|
||||
ThroughputTrend throughputTrend = new ThroughputTrend();
|
||||
List<DurationPoint> durationPoints = DurationUtils.INSTANCE.getDurationPoints(step, start, end);
|
||||
List<DurationPoint> durationPoints = DurationUtils.INSTANCE.getDurationPoints(step, startTimeBucket, endTimeBucket);
|
||||
List<Integer> callsTrends = serviceMetricUIDAO.getServiceTPSTrend(serviceId, step, durationPoints);
|
||||
|
||||
//TODO
|
||||
callsTrends.forEach(calls -> throughputTrend.getTrendList().add(calls / 1000));
|
||||
ServiceName serviceName = serviceNameCacheService.get(serviceId);
|
||||
int secondBetween = secondBetweenService.calculate(serviceName.getApplicationId(), startSecondTimeBucket, endSecondTimeBucket);
|
||||
callsTrends.forEach(calls -> throughputTrend.getTrendList().add(calls / secondBetween));
|
||||
|
||||
return throughputTrend;
|
||||
}
|
||||
|
||||
public ResponseTimeTrend getServiceResponseTimeTrend(int serviceId, Step step, long start,
|
||||
long end) throws ParseException {
|
||||
public ResponseTimeTrend getServiceResponseTimeTrend(int serviceId, Step step, long startTimeBucket,
|
||||
long endTimeBucket) throws ParseException {
|
||||
ResponseTimeTrend responseTimeTrend = new ResponseTimeTrend();
|
||||
List<DurationPoint> durationPoints = DurationUtils.INSTANCE.getDurationPoints(step, start, end);
|
||||
List<DurationPoint> durationPoints = DurationUtils.INSTANCE.getDurationPoints(step, startTimeBucket, endTimeBucket);
|
||||
responseTimeTrend.setTrendList(serviceMetricUIDAO.getServiceResponseTimeTrend(serviceId, step, durationPoints));
|
||||
return responseTimeTrend;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue