coolbeevip commented on a change in pull request #531: [SCB 1411] Add alpha-ui 
module to provide a simple Web GUI
URL: https://github.com/apache/servicecomb-pack/pull/531#discussion_r312522418
 
 

 ##########
 File path: 
alpha/alpha-server/src/main/java/org/apache/servicecomb/pack/alpha/server/api/APIv1Controller.java
 ##########
 @@ -31,33 +32,36 @@
 
 @RestController
 @RequestMapping("/alpha/api/v1")
-public class APIControllerV1 {
+public class APIv1Controller {
 
   @Autowired
-  AlphaMetrics AlphaMetrics;
-
-  @Autowired(required = false)
-  TransactionRepository transactionRepository;
+  APIv1Impl APIv1Impl;
 
   @GetMapping(value = "/metrics")
   ResponseEntity<AlphaMetrics> metrics() {
-    return ResponseEntity.ok(AlphaMetrics);
+    return ResponseEntity.ok(APIv1Impl.getMetrics());
   }
 
   @GetMapping(value = "/transaction/{globalTxId}")
   ResponseEntity<GlobalTransaction> getTransactionByGlobalTxId(@PathVariable 
String globalTxId)
       throws Exception {
-    GlobalTransaction globalTransaction = transactionRepository
-        .getGlobalTransactionByGlobalTxId(globalTxId);
-    return ResponseEntity.ok(globalTransaction);
+    return ResponseEntity.ok(APIv1Impl.getTransactionByGlobalTxId(globalTxId));
   }
 
   @GetMapping(value = "/transaction")
   ResponseEntity<PagingGlobalTransactions> getTransactions(@RequestParam(value 
= "page", required = false, defaultValue = "0") int page,
       @RequestParam(value = "size", required = false, defaultValue = "50") int 
size)
       throws Exception {
-    PagingGlobalTransactions pagingGlobalTransactions = transactionRepository
-        .getGlobalTransactions(page, size);
-    return ResponseEntity.ok(pagingGlobalTransactions);
+    return ResponseEntity.ok(APIv1Impl.getTransactions(null,page,size));
+  }
+
+  @GetMapping(value = "/transaction/statistics")
+  ResponseEntity<Map<String,Long>> getTransactionStatistics() {
+    return ResponseEntity.ok(APIv1Impl.getTransactionStatistics());
+  }
+
+  @GetMapping(value = "/transaction/slow")
+  ResponseEntity<List<GlobalTransaction>> getSlowTransactions() {
+    return ResponseEntity.ok(APIv1Impl.getSlowTransactions());
 
 Review comment:
   > Do you need to add the number to the slow transactions?
   
   Yes, I better add a size parameter default value is 10

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to