[ 
https://issues.apache.org/jira/browse/IGNITE-9333?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16603164#comment-16603164
 ] 

ASF GitHub Bot commented on IGNITE-9333:
----------------------------------------

akalash commented on a change in pull request #3: IGNITE-9333 Add statistics 
page
URL: https://github.com/apache/ignite-teamcity-bot/pull/3#discussion_r214727827
 
 

 ##########
 File path: 
ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java
 ##########
 @@ -149,4 +155,69 @@ public TestFailuresSummary getBuildTestFails(
 
         return res;
     }
+
+    @GET
+    @Path("history")
+    public BuildStatisticsSummary[] getBuildsHistory(
+        @Nullable @QueryParam("server") String server,
+        @Nullable @QueryParam("buildType") String buildType,
+        @Nullable @QueryParam("branch") String branch,
+        @Nullable @QueryParam("count") Integer count)
+        throws ServiceUnauthorizedException {
+
+        String srvId = isNullOrEmpty(server) ? "apache" : server;
+        String buildTypeId = isNullOrEmpty(buildType) ? 
"IgniteTests24Java8_RunAll" : buildType;
+        String branchName = isNullOrEmpty(branch) ? "refs/heads/master" : 
branch;
+        int cnt = count == null ? 50 : count;
+
+        final BackgroundUpdater updater = 
CtxListener.getBackgroundUpdater(context);
+
+        final ITcHelper tcHelper = CtxListener.getTcHelper(context);
+
+        final ICredentialsProv prov = ICredentialsProv.get(req);
+
+        try (IAnalyticsEnabledTeamcity teamcity = tcHelper.server(srvId, 
prov)) {
+
+            int[] finishedBuilds = 
teamcity.getBuildNumbersFromHistory(buildTypeId, branchName, cnt);
+
+            BuildStatisticsSummary[] buildsStatistics = new 
BuildStatisticsSummary[finishedBuilds.length];
+
+            for (int i = 0; i < finishedBuilds.length; i++) {
+                int buildId = finishedBuilds[i];
+
+                FullQueryParams param = new FullQueryParams();
+                param.setBuildId(buildId);
+                param.setBranch(branchName);
+                param.setServerId(srvId);
+
+                buildsStatistics[finishedBuilds.length - 1 - i] = updater.get(
+                    BUILDS_STATISTICS_SUMMARY_CACHE_NAME, prov, param,
+                    (k) -> getBuildStatisticsSummaryNoCache(srvId, buildId), 
false);
+            }
+
+            return buildsStatistics;
+        }
+    }
+
+
+    @GET
+    @Path("historyNoCache")
 
 Review comment:
   Looks like this endpoint is not required. It can be just simple method.

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


> Adding page with simple statistic for last 50 runs.
> ---------------------------------------------------
>
>                 Key: IGNITE-9333
>                 URL: https://issues.apache.org/jira/browse/IGNITE-9333
>             Project: Ignite
>          Issue Type: Sub-task
>            Reporter: Eduard Shangareev
>            Assignee: Nikolai Kulagin
>            Priority: Major
>
> Ok, I am proposing to add a new page which would be named "Statistic".
> It should show last 50 "Run All" for master, the columns:
> ||Id||Total tests||Failed tests||Ignored tests|| Muted tests||Total issues 
> (count and the list of TC configurations with links)  || Total run time || 
> Also, we need to calculate the statistic. 
> Totals (all unique tests with issues), average issues/fails per run, median, 
> max, min.
> Total issues = Exit codes + JVM Crashes + OOMs + other issues which caused TC 
> configuration fail



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to