-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update query-metric service to generate HTML response via Spring MVC (#6
- Loading branch information
1 parent
10289d6
commit 1b56d17
Showing
30 changed files
with
1,063 additions
and
791 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
api/src/main/java/datawave/microservice/querymetric/PageMetricModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package datawave.microservice.querymetric; | ||
|
||
import java.text.NumberFormat; | ||
import java.text.SimpleDateFormat; | ||
import java.util.Date; | ||
|
||
public class PageMetricModel extends BaseQueryMetric.PageMetric { | ||
|
||
private NumberFormat nf = NumberFormat.getIntegerInstance(); | ||
private SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd HHmmss"); | ||
|
||
public PageMetricModel(BaseQueryMetric.PageMetric pageMetric) { | ||
super(pageMetric); | ||
} | ||
|
||
public String getPageNumberStr() { | ||
return numToString(getPageNumber(), 1); | ||
} | ||
|
||
public String getPageRequestedStr() { | ||
return getPageRequested() > 0 ? sdf.format(new Date(getPageRequested())) : ""; | ||
} | ||
|
||
public String getPageReturnedStr() { | ||
return getPageReturned() > 0 ? sdf.format(new Date(getPageReturned())) : ""; | ||
} | ||
|
||
public String getReturnTimeStr() { | ||
return nf.format(getReturnTime()); | ||
} | ||
|
||
public String getPageSizeStr() { | ||
return nf.format(getPagesize()); | ||
} | ||
|
||
public String getCallTimeStr() { | ||
return numToString(getCallTime(), 0); | ||
} | ||
|
||
public String getLoginTimeStr() { | ||
return numToString(getLoginTime(), 0); | ||
} | ||
|
||
public String getSerializationTimeStr() { | ||
return numToString(getSerializationTime(), 0); | ||
} | ||
|
||
public String getBytesWrittenStr() { | ||
return numToString(getBytesWritten(), 0); | ||
} | ||
|
||
private String numToString(long number, long minValue) { | ||
return number < minValue ? "" : nf.format(number); | ||
} | ||
} |
Oops, something went wrong.