This is an automated email from the ASF dual-hosted git repository.

dpavlov pushed a commit to branch performance
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git


The following commit(s) were added to refs/heads/performance by this push:
     new 41edb41  Profiling of major TC connection
41edb41 is described below

commit 41edb41d086820a103f87e46b7dc33406962da34
Author: Dmitriy Pavlov <[email protected]>
AuthorDate: Mon Sep 17 14:20:08 2018 +0300

    Profiling of major TC connection
---
 .../ignite/ci/IAnalyticsEnabledTeamcity.java       |  2 +-
 .../main/java/org/apache/ignite/ci/ITeamcity.java  |  2 +
 .../apache/ignite/ci/IgnitePersistentTeamcity.java | 18 ++++--
 .../org/apache/ignite/ci/IgniteTeamcityHelper.java | 72 ++++++++++++++++++----
 .../org/apache/ignite/ci/di/IgniteTcBotModule.java | 25 +++++---
 .../apache/ignite/ci/di/ProfilingInterceptor.java  | 37 ++++++++---
 .../ignite/ci/web/rest/monitoring/HotSpot.java     |  8 ++-
 .../ci/web/rest/monitoring/MonitoringService.java  |  5 +-
 .../src/main/webapp/monitoring.html                | 64 +++++++++++++++++++
 9 files changed, 198 insertions(+), 35 deletions(-)

diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IAnalyticsEnabledTeamcity.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IAnalyticsEnabledTeamcity.java
index 91727ca..2499adc 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IAnalyticsEnabledTeamcity.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IAnalyticsEnabledTeamcity.java
@@ -21,5 +21,5 @@ package org.apache.ignite.ci;
  * Combination of REST data and persisted statistics.
  */
 public interface IAnalyticsEnabledTeamcity extends ITeamcity, ITcAnalytics {
-    public void init(IgniteTeamcityHelper teamcity);
+    public void init(ITeamcity conn);
 }
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/ITeamcity.java 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/ITeamcity.java
index 0fbe53d..4e9f9d6 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/ITeamcity.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/ITeamcity.java
@@ -307,4 +307,6 @@ public interface ITeamcity extends AutoCloseable {
      * @return List of teamcity agents.
      */
     List<Agent> agents(boolean connected, boolean authorized);
+
+    void init(String serverId);
 }
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgnitePersistentTeamcity.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgnitePersistentTeamcity.java
index 6625568..fcd7b56 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgnitePersistentTeamcity.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgnitePersistentTeamcity.java
@@ -106,7 +106,10 @@ public class IgnitePersistentTeamcity implements 
IAnalyticsEnabledTeamcity, ITea
 
     @Inject
     private Ignite ignite;
-    private IgniteTeamcityHelper teamcity;
+    /**
+     * Teamcity
+     */
+    private ITeamcity teamcity;
     private String serverId;
 
     /**
@@ -123,6 +126,7 @@ public class IgnitePersistentTeamcity implements 
IAnalyticsEnabledTeamcity, ITea
     //todo: not good code to keep it static
     private static long lastTriggerMs = System.currentTimeMillis();
 
+    @Deprecated
     public IgnitePersistentTeamcity(Ignite ignite, @Nullable String srvId) {
         this(ignite, new IgniteTeamcityHelper(srvId));
     }
@@ -136,11 +140,11 @@ public class IgnitePersistentTeamcity implements 
IAnalyticsEnabledTeamcity, ITea
         this.ignite = ignite;
     }
 
-    public void init(IgniteTeamcityHelper teamcity) {
-        this.teamcity = teamcity;
-        this.serverId = teamcity.serverId();
+    public void init(ITeamcity conn) {
+        this.teamcity = conn;
+        this.serverId = conn.serverId();
 
-        DbMigrations migrations = new DbMigrations(ignite, 
teamcity.serverId());
+        DbMigrations migrations = new DbMigrations(ignite, conn.serverId());
 
         migrations.dataMigration(
                 testOccurrencesCache(), this::addTestOccurrencesToStat,
@@ -154,6 +158,10 @@ public class IgnitePersistentTeamcity implements 
IAnalyticsEnabledTeamcity, ITea
                 buildHistIncFailedCache());
     }
 
+    @Override
+    public void init(String serverId) {
+        throw new UnsupportedOperationException();
+    }
     /**
      * Creates atomic cache with 32 parts.
      * @param name Cache name.
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityHelper.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityHelper.java
index f55222e..ba8a7d6 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityHelper.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityHelper.java
@@ -50,6 +50,7 @@ import org.apache.ignite.ci.analysis.LogCheckResult;
 import org.apache.ignite.ci.analysis.LogCheckTask;
 import org.apache.ignite.ci.analysis.MultBuildRunCtx;
 import org.apache.ignite.ci.analysis.SingleBuildRunCtx;
+import org.apache.ignite.ci.di.AutoProfiling;
 import org.apache.ignite.ci.github.PullRequest;
 import org.apache.ignite.ci.logs.BuildLogStreamChecker;
 import org.apache.ignite.ci.logs.LogsAnalyzer;
@@ -98,25 +99,33 @@ public class IgniteTeamcityHelper implements ITeamcity {
     private static final Logger logger = 
LoggerFactory.getLogger(IgniteTeamcityHelper.class);
 
     private Executor executor;
-    private final File logsDir;
+    private File logsDir;
     /** Normalized Host address, ends with '/'. */
-    private final String host;
+    private String host;
 
     /** TeamCity authorization token. */
     private String basicAuthTok;
 
-    /** GitHub authorization token. */
+    /** GitHub authorization token.  */
     private String gitAuthTok;
 
-    /** JIRA authorization token. */
+    /**  JIRA authorization token. */
     private String jiraBasicAuthTok;
 
-    private final String configName; //main properties file name
-    private final String tcName;
+    private String configName; //main properties file name
+    private String tcName;
 
     private ConcurrentHashMap<Integer, CompletableFuture<LogCheckTask>> 
buildLogProcessingRunning = new ConcurrentHashMap<>();
 
     public IgniteTeamcityHelper(@Nullable String tcName) {
+        init(tcName);
+    }
+
+    //for DI
+    public IgniteTeamcityHelper() {
+    }
+
+    public void init(@Nullable String tcName) {
         this.tcName = tcName;
         final File workDir = HelperConfig.resolveWorkDir();
 
@@ -176,6 +185,7 @@ public class IgniteTeamcityHelper implements ITeamcity {
     }
 
     /** {@inheritDoc} */
+    @AutoProfiling
     @Override public boolean sendJiraComment(String ticket, String comment) {
         try {
             String url = "https://issues.apache.org/jira/rest/api/2/issue/"; + 
ticket + "/comment";
@@ -192,6 +202,7 @@ public class IgniteTeamcityHelper implements ITeamcity {
     }
 
     /** {@inheritDoc} */
+    @AutoProfiling
     @Override public PullRequest getPullRequest(String branchForTc) {
         String id = null;
 
@@ -220,6 +231,7 @@ public class IgniteTeamcityHelper implements ITeamcity {
     }
 
     /** {@inheritDoc} */
+    @AutoProfiling
     @Override public boolean notifyGit(String url, String body) {
         try {
             HttpUtil.sendPostAsStringToGit(gitAuthTok, url, body);
@@ -234,6 +246,7 @@ public class IgniteTeamcityHelper implements ITeamcity {
     }
 
     /** {@inheritDoc} */
+    @AutoProfiling
     @Override public List<Agent> agents(boolean connected, boolean authorized) 
{
         String url = "app/rest/agents?locator=connected:" + connected + 
",authorized:" + authorized;
 
@@ -245,6 +258,7 @@ public class IgniteTeamcityHelper implements ITeamcity {
             .collect(Collectors.toList());
     }
 
+    @AutoProfiling
     public CompletableFuture<File> downloadBuildLogZip(int buildId) {
         boolean archive = true;
         Supplier<File> supplier = () -> {
@@ -271,6 +285,7 @@ public class IgniteTeamcityHelper implements ITeamcity {
         return supplyAsync(supplier, executor);
     }
 
+    @AutoProfiling
     @Override public CompletableFuture<LogCheckResult> analyzeBuildLog(Integer 
buildId, SingleBuildRunCtx ctx) {
         final Stopwatch started = Stopwatch.createStarted();
 
@@ -295,6 +310,7 @@ public class IgniteTeamcityHelper implements ITeamcity {
     }
 
     /** {@inheritDoc} */
+    @AutoProfiling
     @Override public Build triggerBuild(
         String buildTypeId,
         String branchName,
@@ -390,6 +406,7 @@ public class IgniteTeamcityHelper implements ITeamcity {
         }).thenApply(T2::get1);
     }
 
+    @AutoProfiling
     public CompletableFuture<File> unzipFirstFile(CompletableFuture<File> fut) 
{
         final CompletableFuture<List<File>> clearFileF = unzip(fut);
         return clearFileF.thenApplyAsync(files -> {
@@ -434,7 +451,7 @@ public class IgniteTeamcityHelper implements ITeamcity {
             try (InputStream inputStream = 
HttpUtil.sendGetWithBasicAuth(basicAuthTok, url)) {
                 final InputStreamReader reader = new 
InputStreamReader(inputStream);
 
-                return XmlUtil.load(rootElem, reader);
+                return loadXml(rootElem, reader);
             }
         }
         catch (IOException e) {
@@ -445,6 +462,11 @@ public class IgniteTeamcityHelper implements ITeamcity {
         }
     }
 
+    @AutoProfiling
+    protected  <T> T loadXml(Class<T> rootElem, InputStreamReader reader) 
throws JAXBException {
+        return XmlUtil.load(rootElem, reader);
+    }
+
     private List<BuildRef> getBuildHistory(@Nullable String buildTypeId,
         @Nullable String branchName,
         boolean dfltFilter,
@@ -472,15 +494,20 @@ public class IgniteTeamcityHelper implements ITeamcity {
             + ",count:" + cntFilter, Builds.class).getBuildsNonNull();
     }
 
+    @AutoProfiling
     public BuildTypeFull getBuildType(String buildTypeId) {
         return sendGetXmlParseJaxb(host + "app/rest/latest/buildTypes/id:" +
             buildTypeId, BuildTypeFull.class);
     }
 
+    @Override
+    @AutoProfiling
     public Build getBuild(String href) {
         return getJaxbUsingHref(href, Build.class);
     }
 
+    @Override
+    @AutoProfiling
     public ProblemOccurrences getProblems(Build build) {
         if (build.problemOccurrences != null) {
             ProblemOccurrences coll = 
getJaxbUsingHref(build.problemOccurrences.href, ProblemOccurrences.class);
@@ -493,26 +520,38 @@ public class IgniteTeamcityHelper implements ITeamcity {
             return new ProblemOccurrences();
     }
 
+    @Override
+    @AutoProfiling
     public TestOccurrences getTests(String href, String normalizedBranch) {
         return getJaxbUsingHref(href, TestOccurrences.class);
     }
 
+    @Override
+    @AutoProfiling
     public Statistics getBuildStatistics(String href) {
         return getJaxbUsingHref(href, Statistics.class);
     }
 
+    @Override
+    @AutoProfiling
     public CompletableFuture<TestOccurrenceFull> getTestFull(String href) {
         return supplyAsync(() -> getJaxbUsingHref(href, 
TestOccurrenceFull.class), executor);
     }
 
+    @Override
+    @AutoProfiling
     public Change getChange(String href) {
         return getJaxbUsingHref(href, Change.class);
     }
 
+    @Override
+    @AutoProfiling
     public ChangesList getChangesList(String href) {
         return getJaxbUsingHref(href, ChangesList.class);
     }
 
+    @Override
+    @AutoProfiling
     public IssuesUsagesList getIssuesUsagesList(String href) { return 
getJaxbUsingHref(href, IssuesUsagesList.class); }
 
     private <T> T getJaxbUsingHref(String href, Class<T> elem) {
@@ -523,6 +562,7 @@ public class IgniteTeamcityHelper implements ITeamcity {
     }
 
     /** {@inheritDoc} */
+    @AutoProfiling
     @Override public List<BuildRef> getFinishedBuilds(String projectId,
         String branch) {
 
@@ -530,6 +570,8 @@ public class IgniteTeamcityHelper implements ITeamcity {
     }
 
     /** {@inheritDoc} */
+    @Override
+    @AutoProfiling
     public List<BuildRef> getFinishedBuilds(String projectId,
         String branch, Long cnt) {
         List<BuildRef> finished = getBuildHistory(projectId,
@@ -541,22 +583,26 @@ public class IgniteTeamcityHelper implements ITeamcity {
     }
 
     /** {@inheritDoc} */
-    @Override public List<BuildRef> getFinishedBuildsIncludeSnDepFailed(String 
projectId, String branch) {
+    @Override
+    @AutoProfiling public List<BuildRef> 
getFinishedBuildsIncludeSnDepFailed(String projectId, String branch) {
         return getBuildsInState(projectId, branch, BuildRef.STATE_FINISHED, 
null);
     }
 
     /** {@inheritDoc} */
-    @Override public List<BuildRef> getFinishedBuildsIncludeSnDepFailed(String 
projectId, String branch, Long cnt) {
+    @Override
+    @AutoProfiling public List<BuildRef> 
getFinishedBuildsIncludeSnDepFailed(String projectId, String branch, Long cnt) {
         return getBuildsInState(projectId, branch, BuildRef.STATE_FINISHED, 
cnt);
     }
 
     /** {@inheritDoc} */
-    @Override public CompletableFuture<List<BuildRef>> 
getRunningBuilds(@Nullable String branch) {
+    @Override
+    @AutoProfiling public CompletableFuture<List<BuildRef>> 
getRunningBuilds(@Nullable String branch) {
         return supplyAsync(() -> getBuildsInState(null, branch, 
BuildRef.STATE_RUNNING), executor);
     }
 
     /** {@inheritDoc} */
-    @Override public CompletableFuture<List<BuildRef>> 
getQueuedBuilds(@Nullable String branch) {
+    @Override
+    @AutoProfiling public CompletableFuture<List<BuildRef>> 
getQueuedBuilds(@Nullable String branch) {
         return supplyAsync(() -> getBuildsInState(null, branch, 
BuildRef.STATE_QUEUED), executor);
     }
 
@@ -580,6 +626,7 @@ public class IgniteTeamcityHelper implements ITeamcity {
         return getBuildsInState(projectId, branch, state, null);
     }
 
+    @Override
     public String serverId() {
         return tcName;
     }
@@ -621,14 +668,17 @@ public class IgniteTeamcityHelper implements ITeamcity {
         return task;
     }
 
+    @Override
     public void setExecutor(ExecutorService executor) {
         this.executor = executor;
     }
 
+    @AutoProfiling
     public Users getUsers() {
         return getJaxbUsingHref("app/rest/latest/users", Users.class);
     }
 
+    @AutoProfiling
     public User getUserByUsername(String username) {
         return getJaxbUsingHref("app/rest/latest/users/username:" + username, 
User.class);
     }
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/IgniteTcBotModule.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/IgniteTcBotModule.java
index 07ae721..5b5b256 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/IgniteTcBotModule.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/IgniteTcBotModule.java
@@ -18,19 +18,22 @@ package org.apache.ignite.ci.di;
 
 import com.google.common.base.Strings;
 import com.google.inject.AbstractModule;
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-import com.google.inject.Provider;
 import com.google.inject.matcher.Matchers;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.ci.IAnalyticsEnabledTeamcity;
+import org.apache.ignite.ci.ITeamcity;
 import org.apache.ignite.ci.IgnitePersistentTeamcity;
 import org.apache.ignite.ci.IgniteTeamcityHelper;
 
+import javax.inject.Inject;
+import javax.inject.Provider;
+
 public class IgniteTcBotModule extends AbstractModule {
     @Deprecated
     private Ignite ignite;
 
+    /** {@inheritDoc} */
+    @Override
     protected void configure() {
         ProfilingInterceptor profilingInterceptor = new ProfilingInterceptor();
 
@@ -47,6 +50,9 @@ public class IgniteTcBotModule extends AbstractModule {
             }
         });
 
+        //Simple connection
+        bind(ITeamcity.class).to(IgniteTeamcityHelper.class);
+        //With REST persistence
         
bind(IAnalyticsEnabledTeamcity.class).to(IgnitePersistentTeamcity.class);
         bind(IServerProv.class).toInstance(
                 new MyIServerProv()
@@ -59,17 +65,20 @@ public class IgniteTcBotModule extends AbstractModule {
         this.ignite = ignite;
     }
 
-    private class MyIServerProv implements IServerProv {
+    private static class MyIServerProv implements IServerProv {
         @Inject
-        Injector injector;
+        Provider<IAnalyticsEnabledTeamcity> tcPersistProv;
 
+        @Inject
+        Provider<ITeamcity> tcConnProv;
 
         @Override
         public IAnalyticsEnabledTeamcity createServer(String serverId) {
-            IgniteTeamcityHelper igniteTeamcityHelper = new 
IgniteTeamcityHelper(Strings.emptyToNull(serverId));
+            ITeamcity tcConn = tcConnProv.get();
+            tcConn.init(Strings.emptyToNull(serverId));
 
-            IAnalyticsEnabledTeamcity instance = 
injector.getInstance(IAnalyticsEnabledTeamcity.class);
-            instance.init(igniteTeamcityHelper);
+            IAnalyticsEnabledTeamcity instance = tcPersistProv.get();
+            instance.init(tcConn);
 
             return instance;
         }
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/ProfilingInterceptor.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/ProfilingInterceptor.java
index 508670d..1c324b4 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/ProfilingInterceptor.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/ProfilingInterceptor.java
@@ -25,10 +25,35 @@ import java.util.Collections;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 
 public class ProfilingInterceptor implements MethodInterceptor {
-    Map<String, AtomicLong> totalTime = new ConcurrentHashMap<>();
+    Map<String, Invocation> totalTime = new ConcurrentHashMap<>();
+
+    public static class Invocation {
+        private final AtomicLong timeNanos = new AtomicLong();
+        private final AtomicInteger callsCnt = new AtomicInteger();
+        private String name;
+
+        public Invocation(String name) {
+            this.name = name;
+        }
+
+        public long addAndGet(long elapsed) {
+            callsCnt.incrementAndGet();
+
+            return timeNanos.addAndGet(elapsed);
+        }
+
+        public long getNanos() {
+            return timeNanos.get();
+        }
+
+        public int getCount() {
+            return callsCnt.get();
+        }
+    }
 
     @Override
     public Object invoke(MethodInvocation invocation) throws Throwable {
@@ -42,16 +67,14 @@ public class ProfilingInterceptor implements 
MethodInterceptor {
             long elapsed = started.elapsed(TimeUnit.NANOSECONDS);
 
             String fullKey = cls + "." + mtd;
-            long totalElapsed = totalTime.computeIfAbsent(fullKey, (k) -> {
-                return new AtomicLong();
-            }).addAndGet(elapsed);
-            String duration = Duration.ofNanos(totalElapsed).toString();
+            long totalElapsed = totalTime.computeIfAbsent(fullKey, 
Invocation::new).addAndGet(elapsed);
+            //String duration = Duration.ofNanos(totalElapsed).toString();
 
-            System.out.println(fullKey + ": " + duration + " ");
+            // System.out.println(fullKey + ": " + duration + " ");
         }
     }
 
-    public Map<String, AtomicLong> getMap() {
+    public Map<String, Invocation> getMap() {
         return Collections.unmodifiableMap(totalTime);
     }
 }
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/monitoring/HotSpot.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/monitoring/HotSpot.java
index 78f14a6..0bf36a7 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/monitoring/HotSpot.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/monitoring/HotSpot.java
@@ -23,6 +23,7 @@ public class HotSpot {
     public String duration;
 
     private long ns;
+    private int count;
 
     public long getNanos() {
         return ns;
@@ -32,11 +33,16 @@ public class HotSpot {
     public String toString() {
         return "HotSpot{" +
                 "method='" + method + '\'' +
-                ", duration='" +  TimeUtil.getDurationPrintableNanos(ns) + "'" 
+
+                ", count='" + count + "'" +
+                ", duration='" + TimeUtil.getDurationPrintableNanos(ns) + "'" +
                 '}';
     }
 
     public void setNanos(long l) {
         ns = l;
     }
+
+    public void setCount(int count) {
+        this.count = count;
+    }
 }
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/monitoring/MonitoringService.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/monitoring/MonitoringService.java
index 2f94f5d..fa19e93 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/monitoring/MonitoringService.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/monitoring/MonitoringService.java
@@ -44,11 +44,12 @@ public class MonitoringService {
     @Path("profiling")
     public List<String> getHotMethods() {
         ProfilingInterceptor instance = 
CtxListener.getInjector(ctx).getInstance(ProfilingInterceptor.class);
-        Map<String, AtomicLong> map = instance.getMap();
+        Map<String, ProfilingInterceptor.Invocation> map = instance.getMap();
 
         Stream<HotSpot> hotSpotStream = map.entrySet().stream().map(entry -> {
             HotSpot hotSpot = new HotSpot();
-            hotSpot.setNanos(entry.getValue().get());
+            hotSpot.setNanos(entry.getValue().getNanos());
+            hotSpot.setCount(entry.getValue().getCount());
             hotSpot.method = entry.getKey();
             return hotSpot;
         });
diff --git a/ignite-tc-helper-web/src/main/webapp/monitoring.html 
b/ignite-tc-helper-web/src/main/webapp/monitoring.html
new file mode 100644
index 0000000..e80b146
--- /dev/null
+++ b/ignite-tc-helper-web/src/main/webapp/monitoring.html
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>TC Bot monitoriong page</title>
+
+    <link rel="icon" href="img/leaf-icon-png-7066.png">
+    <link rel="stylesheet" 
href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css";>
+    <link rel="stylesheet" href="css/style-1.5.css">
+
+    <script src="https://code.jquery.com/jquery-1.12.4.js";></script>
+    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js";></script>
+
+    <script src="js/common-1.6.js"></script>
+    <script src="js/testfails-2.1.js"></script>
+</head>
+<body>
+<script>
+    $(document).ready(function() {
+        $.getScript("js/common-1.6.js", function(data, textStatus, jqxhr){ });
+
+        $( document ).tooltip();
+
+        loadData();
+    });
+
+    function loadData() {
+        $("#loadStatus").html("<img 
src='https://www.wallies.com/filebin/images/loading_apple.gif' width=20px 
height=20px> Please wait");
+        $.ajax({
+            url: "rest/branches/version",
+            success: showVersionInfo,
+            error: showErrInLoadStatus
+        });
+
+        $.ajax({
+            url: "rest/monitoring/profiling",
+            success: function(result) {
+                $("#loadStatus").html("");
+
+
+                showProfiling(result);
+
+            },
+            error: showErrInLoadStatus
+        });
+    }
+
+    function showProfiling(result) {
+        var res = "" ;
+        for (var i = 0; i < result.length; i++) {
+            res += result[i] + "<br>";
+        }
+        $("#profiling").html(res);
+    }
+
+</script>
+
+Profiling Data:
+<div id="profiling" style="font-family: monospace"></div>
+<div id="loadStatus"></div>
+<div id="version"></div>
+
+</body>
+</html>
\ No newline at end of file

Reply via email to