You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sirona.apache.org by rm...@apache.org on 2013/11/04 17:12:50 UTC

svn commit: r1538662 [2/2] - in /incubator/sirona/trunk: collector/src/main/java/org/apache/sirona/collector/server/ collector/src/main/java/org/apache/sirona/collector/server/store/ collector/src/main/java/org/apache/sirona/collector/server/store/coun...

Modified: incubator/sirona/trunk/graphite/src/main/java/org/apache/sirona/graphite/GraphiteCounterDataStore.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/graphite/src/main/java/org/apache/sirona/graphite/GraphiteCounterDataStore.java?rev=1538662&r1=1538661&r2=1538662&view=diff
==============================================================================
--- incubator/sirona/trunk/graphite/src/main/java/org/apache/sirona/graphite/GraphiteCounterDataStore.java (original)
+++ incubator/sirona/trunk/graphite/src/main/java/org/apache/sirona/graphite/GraphiteCounterDataStore.java Mon Nov  4 16:12:48 2013
@@ -19,7 +19,7 @@ package org.apache.sirona.graphite;
 import org.apache.sirona.configuration.Configuration;
 import org.apache.sirona.counters.Counter;
 import org.apache.sirona.counters.MetricData;
-import org.apache.sirona.store.BatchCounterDataStore;
+import org.apache.sirona.store.counter.BatchCounterDataStore;
 
 import java.io.IOException;
 import java.util.Collection;

Modified: incubator/sirona/trunk/graphite/src/main/java/org/apache/sirona/graphite/GraphiteDataStoreFactory.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/graphite/src/main/java/org/apache/sirona/graphite/GraphiteDataStoreFactory.java?rev=1538662&r1=1538661&r2=1538662&view=diff
==============================================================================
--- incubator/sirona/trunk/graphite/src/main/java/org/apache/sirona/graphite/GraphiteDataStoreFactory.java (original)
+++ incubator/sirona/trunk/graphite/src/main/java/org/apache/sirona/graphite/GraphiteDataStoreFactory.java Mon Nov  4 16:12:48 2013
@@ -17,9 +17,10 @@
 package org.apache.sirona.graphite;
 
 import org.apache.sirona.store.DelegateDataStoreFactory;
+import org.apache.sirona.store.status.EmptyStatuses;
 
 public class GraphiteDataStoreFactory extends DelegateDataStoreFactory {
     public GraphiteDataStoreFactory() {
-        super(new GraphiteCounterDataStore(), new GraphiteGaugeDataStore());
+        super(new GraphiteCounterDataStore(), new GraphiteGaugeDataStore(), new EmptyStatuses());
     }
 }

Modified: incubator/sirona/trunk/graphite/src/main/java/org/apache/sirona/graphite/GraphiteGaugeDataStore.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/graphite/src/main/java/org/apache/sirona/graphite/GraphiteGaugeDataStore.java?rev=1538662&r1=1538661&r2=1538662&view=diff
==============================================================================
--- incubator/sirona/trunk/graphite/src/main/java/org/apache/sirona/graphite/GraphiteGaugeDataStore.java (original)
+++ incubator/sirona/trunk/graphite/src/main/java/org/apache/sirona/graphite/GraphiteGaugeDataStore.java Mon Nov  4 16:12:48 2013
@@ -18,8 +18,8 @@ package org.apache.sirona.graphite;
 
 import org.apache.sirona.Role;
 import org.apache.sirona.configuration.Configuration;
-import org.apache.sirona.store.AggregatedGaugeDataStore;
-import org.apache.sirona.store.Value;
+import org.apache.sirona.store.gauge.AggregatedGaugeDataStore;
+import org.apache.sirona.store.gauge.Value;
 
 import java.io.IOException;
 import java.util.Map;

Modified: incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/graph/Line.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/graph/Line.java?rev=1538662&r1=1538661&r2=1538662&view=diff
==============================================================================
--- incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/graph/Line.java (original)
+++ incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/graph/Line.java Mon Nov  4 16:12:48 2013
@@ -18,10 +18,10 @@ package org.apache.sirona.reporting.web.
 
 import org.apache.sirona.Role;
 import org.apache.sirona.configuration.Configuration;
-import org.apache.sirona.store.CollectorGaugeDataStore;
+import org.apache.sirona.store.gauge.CollectorGaugeDataStore;
 import org.apache.sirona.reporting.web.plugin.json.Jsons;
 import org.apache.sirona.repositories.Repository;
-import org.apache.sirona.store.GaugeValuesRequest;
+import org.apache.sirona.store.gauge.GaugeValuesRequest;
 import org.apache.sirona.util.Environment;
 
 import java.awt.Color;

Added: incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/status/StatusEndpoints.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/status/StatusEndpoints.java?rev=1538662&view=auto
==============================================================================
--- incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/status/StatusEndpoints.java (added)
+++ incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/status/StatusEndpoints.java Mon Nov  4 16:12:48 2013
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sirona.reporting.web.plugin.status;
+
+import org.apache.sirona.reporting.web.handler.api.Regex;
+import org.apache.sirona.reporting.web.handler.api.Template;
+import org.apache.sirona.repositories.Repository;
+
+public class StatusEndpoints {
+    @Regex
+    public Template home() {
+        return new Template("status/home.vm").set("nodes", Repository.INSTANCE.statuses());
+    }
+
+    @Regex("/([^/]*)")
+    public Template detail(final String node) {
+        return new Template("status/detail.vm")
+            .set("node", Repository.INSTANCE.statuses().get(node))
+            .set("name", node);
+    }
+}

Added: incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/status/StatusPlugin.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/status/StatusPlugin.java?rev=1538662&view=auto
==============================================================================
--- incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/status/StatusPlugin.java (added)
+++ incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/status/StatusPlugin.java Mon Nov  4 16:12:48 2013
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sirona.reporting.web.plugin.status;
+
+import org.apache.sirona.reporting.web.plugin.Plugin;
+
+public class StatusPlugin implements Plugin {
+    @Override
+    public String name() {
+        return "Status";
+    }
+
+    @Override
+    public Class<?> endpoints() {
+        return StatusEndpoints.class;
+    }
+
+    @Override
+    public String mapping() {
+        return "/status";
+    }
+}

Modified: incubator/sirona/trunk/reporting/src/main/resources/META-INF/services/org.apache.sirona.reporting.web.plugin.Plugin
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/reporting/src/main/resources/META-INF/services/org.apache.sirona.reporting.web.plugin.Plugin?rev=1538662&r1=1538661&r2=1538662&view=diff
==============================================================================
--- incubator/sirona/trunk/reporting/src/main/resources/META-INF/services/org.apache.sirona.reporting.web.plugin.Plugin (original)
+++ incubator/sirona/trunk/reporting/src/main/resources/META-INF/services/org.apache.sirona.reporting.web.plugin.Plugin Mon Nov  4 16:12:48 2013
@@ -1,5 +1,6 @@
 org.apache.sirona.reporting.web.plugin.report.ReportPlugin
 org.apache.sirona.reporting.web.plugin.gauge.GaugePlugin
+org.apache.sirona.reporting.web.plugin.status.StatusPlugin
 org.apache.sirona.reporting.web.plugin.jmx.JMXPlugin
 org.apache.sirona.reporting.web.plugin.jvm.JVMPlugin
 org.apache.sirona.reporting.web.plugin.jta.JTAPlugin

Added: incubator/sirona/trunk/reporting/src/main/resources/templates/status/detail.vm
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/reporting/src/main/resources/templates/status/detail.vm?rev=1538662&view=auto
==============================================================================
--- incubator/sirona/trunk/reporting/src/main/resources/templates/status/detail.vm (added)
+++ incubator/sirona/trunk/reporting/src/main/resources/templates/status/detail.vm Mon Nov  4 16:12:48 2013
@@ -0,0 +1,41 @@
+#*
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+*#
+<h1>Node $name</h1>
+
+<div>
+    Global status: $node.status
+    <ul>
+        <table class="table table-bordered table-striped table-hover">
+            <thead>
+            <tr>
+                <th>Name</th>
+                <th>Description</th>
+                <th>Status</th>
+            </tr>
+            </thead>
+            <tbody>
+                #foreach ($result in $node.results)
+                <tr>
+                    <td>$result.name</td>
+                    <td>$result.message</td>
+                    <td>$result.status.name()</td>
+                </tr>
+                #end
+            </tbody>
+        </table>
+    </ul>
+</div>

Copied: incubator/sirona/trunk/reporting/src/main/resources/templates/status/home.vm (from r1538543, incubator/sirona/trunk/reporting/src/main/resources/templates/gauge/home.vm)
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/reporting/src/main/resources/templates/status/home.vm?p2=incubator/sirona/trunk/reporting/src/main/resources/templates/status/home.vm&p1=incubator/sirona/trunk/reporting/src/main/resources/templates/gauge/home.vm&r1=1538543&r2=1538662&rev=1538662&view=diff
==============================================================================
--- incubator/sirona/trunk/reporting/src/main/resources/templates/gauge/home.vm (original)
+++ incubator/sirona/trunk/reporting/src/main/resources/templates/status/home.vm Mon Nov  4 16:12:48 2013
@@ -14,13 +14,13 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 *#
-<h1>Gauges</h1>
+<h1>Nodes</h1>
 
 <div>
-    Here is the list of available gauges, click on one of them to get its details:
+    Here is the list of available nodes with their status:
     <ul>
-        #foreach ($gauge in $gauges.entrySet())
-            <li><a href="$mapping/gauges/$gauge.value">$gauge.key<a/></li>
+        #foreach ($node in $nodes.entrySet())
+            <li><a href="$mapping/status/$node.key">$node.key<a/>: $node.value.status</li>
         #end
     </ul>
 </div>

Copied: incubator/sirona/trunk/reporting/src/test/java/org/apache/sirona/reporting/template/StatusTest.java (from r1538515, incubator/sirona/trunk/reporting/src/test/java/org/apache/sirona/reporting/template/ThreadsTest.java)
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/reporting/src/test/java/org/apache/sirona/reporting/template/StatusTest.java?p2=incubator/sirona/trunk/reporting/src/test/java/org/apache/sirona/reporting/template/StatusTest.java&p1=incubator/sirona/trunk/reporting/src/test/java/org/apache/sirona/reporting/template/ThreadsTest.java&r1=1538515&r2=1538662&rev=1538662&view=diff
==============================================================================
--- incubator/sirona/trunk/reporting/src/test/java/org/apache/sirona/reporting/template/ThreadsTest.java (original)
+++ incubator/sirona/trunk/reporting/src/test/java/org/apache/sirona/reporting/template/StatusTest.java Mon Nov  4 16:12:48 2013
@@ -16,29 +16,39 @@
  */
 package org.apache.sirona.reporting.template;
 
-import com.gargoylesoftware.htmlunit.TextPage;
 import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import org.apache.sirona.configuration.Configuration;
+import org.apache.sirona.repositories.Repository;
+import org.apache.sirona.status.NodeStatus;
+import org.apache.sirona.status.Status;
+import org.apache.sirona.status.ValidationResult;
+import org.apache.sirona.store.status.NodeStatusDataStore;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 import java.io.IOException;
 
-import static com.gargoylesoftware.htmlunit.WebAssert.assertElementPresent;
 import static org.hamcrest.CoreMatchers.containsString;
 import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
 
-public class ThreadsTest extends SironaReportingTestBase {
-    private static final String CONTAINER_BACKGROUND_THREAD = "Q29udGFpbmVyQmFja2dyb3VuZFByb2Nlc3NvcltTdGFuZGFyZEVuZ2luZVthcnF1aWxsaWFuLXRvbWNhdC1lbWJlZGRlZC03XV0="; // always exists
+public class StatusTest extends SironaReportingTestBase {
+    @BeforeClass
+    public static void addStatus() {
+        Configuration.findOrCreateInstance(Repository.class);
+        Configuration.getInstance(NodeStatusDataStore.class).statuses().put("node1", new NodeStatus(new ValidationResult[] { new ValidationResult("validation #1", Status.OK, "all is fine") }));
+    }
 
     @Test
-    public void checkThreadsAreListed() throws IOException {
-        final HtmlPage page = page("threads");
-        assertElementPresent(page, CONTAINER_BACKGROUND_THREAD);
+    public void checkNodesAreListed() throws IOException {
+        final HtmlPage page = page("status");
+        assertThat(page.getWebResponse().getContentAsString(), containsString("/status/node1"));
     }
 
     @Test
     public void checkDetail() throws IOException {
-        final TextPage page = page("threads/" + CONTAINER_BACKGROUND_THREAD);
-        assertThat(page.getWebResponse().getContentAsString(), containsString("org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run"));
+        final HtmlPage page = page("status/node1");
+        assertThat(page.getWebResponse().getContentAsString(), containsString("Global status: OK"));
+        assertThat(page.getWebResponse().getContentAsString(), containsString("validation #1"));
+        assertThat(page.getWebResponse().getContentAsString(), containsString("all is fine"));
     }
 }

Added: incubator/sirona/trunk/reporting/src/test/resources/sirona.properties
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/reporting/src/test/resources/sirona.properties?rev=1538662&view=auto
==============================================================================
--- incubator/sirona/trunk/reporting/src/test/resources/sirona.properties (added)
+++ incubator/sirona/trunk/reporting/src/test/resources/sirona.properties Mon Nov  4 16:12:48 2013
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+org.apache.sirona.store.status.NodeStatusDataStore = org.apache.sirona.store.status.EmptyStatuses

Modified: incubator/sirona/trunk/src/site/markdown/collector.md
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/src/site/markdown/collector.md?rev=1538662&r1=1538661&r2=1538662&view=diff
==============================================================================
--- incubator/sirona/trunk/src/site/markdown/collector.md (original)
+++ incubator/sirona/trunk/src/site/markdown/collector.md Mon Nov  4 16:12:48 2013
@@ -22,7 +22,13 @@ Collector modules aims to aggregate data
 
 ## Features
 
-Default implementation only store data in memory.
+Default implementation only store data in memory but you can easily extend it to store data in MongoDB or whatever you want.
+
+Note: this is on our roadmap
+
+## For the impatient
+
+Take a servlet container and deploy `sirona-collector-[version].war`. You'll get the reporting on `/collector` endpoint.
 
 ## Configuration
 
@@ -39,7 +45,7 @@ By default it uses the in memory impleme
 
 Note: if your `GaugeDataStore` has a constructor with a `String`, the marker of the store will be passed to the `GaugeDataStore`.
 
-The `CounterDataStore` needs to be an instance of `org.apache.sirona.store.CollectorCounterStore`.
+The `CounterDataStore` needs to be an instance of `org.apache.sirona.store.counter.CollectorCounterStore`.
 By default it is in memory too but it is easily extensible to be persisted if needed.
 
 ## Installing the collector