Skip to content

Commit

Permalink
Merge branch 'next'
Browse files Browse the repository at this point in the history
  • Loading branch information
Nils Kübler committed Sep 8, 2014
2 parents 3a87243 + a285fd4 commit d1e9210
Show file tree
Hide file tree
Showing 95 changed files with 1,070 additions and 717 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ bin
data/*.rrd
data/*.db
conf/hbase-site.xml
.vagrant
.vagrant
.idea
*.iml
*.eml
.idea_modules
/RUNNING_PID
6 changes: 3 additions & 3 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ You will also need a browser with [SVG][]-Support to display Hannibal's graphs.

### HBase Compatibilty

Hannibal currently supports HBase versions 0.90 to 0.94. The Scala-sources are currently compiled with Apache HBase versions wherever possible, you can try to alter the version in project/Build.scala if you wish to.
Hannibal currently supports HBase versions 0.90 to 0.96. The Scala-sources are currently compiled with Apache HBase versions wherever possible, you can try to alter the version in project/Build.scala if you wish to.

## Quickstart

Expand Down Expand Up @@ -68,7 +68,7 @@ For information about the usage, check out [the Usage page on our Wiki][Wiki-Usa

$ export HANNIBAL_HBASE_VERSION=0.92

Other possible values are "0.90" or "0.94". Be sure to always have this environment-variable set before executing any of the scripts: `build`, `start` or `sbt`.
Other possible values are "0.90", "0.94" or "0.96". Be sure to always have this environment-variable set before executing any of the scripts: `build`, `start` or `sbt`.


3. Copy `conf/hbase-site.template.xml` to `conf/hbase-site.xml` and adjust it.
Expand Down Expand Up @@ -175,7 +175,7 @@ Old metrics are cleaned after one day by default and it makes sense since the re
## Deployment
If you intend to run Hannibal on a different host from where you want to build it, then you can run

./build_package
./create_package

This script generates a tgz-package inside the target folder, which you can then deploy on your target server. The HBase version can be set with the HANNIBAL_HBASE_VERSION environment variable, as described in the quickstart section.

Expand Down
21 changes: 18 additions & 3 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@

Vagrant.configure("2") do |config|

config.vm.box_url = 'http://files.vagrantup.com/lucid64.box'
config.vm.box = "lucid64"

config.vm.define :hbase090 do |vm_conf|
vm_conf.vm.box_url = 'http://files.vagrantup.com/lucid64.box'
vm_conf.vm.box = "lucid64"
vm_conf.vm.hostname = "hbase090.hannibal.dev"
vm_conf.vm.network :private_network, ip: "192.168.80.90"
vm_conf.vm.provision :puppet do |puppet|
Expand All @@ -18,6 +17,8 @@ Vagrant.configure("2") do |config|
end

config.vm.define :hbase092 do |vm_conf|
vm_conf.vm.box_url = 'http://files.vagrantup.com/lucid64.box'
vm_conf.vm.box = "lucid64"
vm_conf.vm.hostname = "hbase092.hannibal.dev"
vm_conf.vm.network :private_network, ip: "192.168.80.92"
vm_conf.vm.provision :puppet do |puppet|
Expand All @@ -29,6 +30,8 @@ Vagrant.configure("2") do |config|
end

config.vm.define :hbase094 do |vm_conf|
vm_conf.vm.box_url = 'http://files.vagrantup.com/lucid64.box'
vm_conf.vm.box = "lucid64"
vm_conf.vm.hostname = "hbase094.hannibal.dev"
vm_conf.vm.network :private_network, ip: "192.168.80.94"
vm_conf.vm.provision :puppet do |puppet|
Expand All @@ -39,6 +42,18 @@ Vagrant.configure("2") do |config|
end
end

config.vm.define :hbase096 do |vm_conf|
vm_conf.vm.box = "spantree/ubuntu-precise-64"
vm_conf.vm.hostname = "hbase096.hannibal.dev"
vm_conf.vm.network :private_network, ip: "192.168.80.96"
vm_conf.vm.provision :puppet do |puppet|
puppet.manifests_path = "vagrant/manifests"
puppet.manifest_file = "nodes.pp"
puppet.module_path = "vagrant/modules"
puppet.options = "--verbose"
end
end

config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", 3072]
end
Expand Down
27 changes: 21 additions & 6 deletions app/Global.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013 Sentric. See LICENSE for details.
* Copyright 2014 YMC. See LICENSE for details.
*/

import models.hbase.HBaseContext
Expand All @@ -8,12 +8,27 @@ import actors.UpdateMetricsActor

object Global extends GlobalSettings {

private val apiVersions = List(
"models.hbase096.HBaseContext096",
"models.hbase092.HBaseContext092",
"models.hbase090.HBaseContext090"
);

override def onStart(app: Application) {
try {
globals.hBaseContext = Class.forName("models.hbase092.HBaseContext092").newInstance.asInstanceOf[HBaseContext]
} catch {
case e: java.lang.ClassNotFoundException =>
globals.hBaseContext = Class.forName("models.hbase090.HBaseContext090").newInstance.asInstanceOf[HBaseContext]
apiVersions.foreach { hbaseContext:String =>
if(globals.hBaseContext == null) {
try {
Logger.debug("Try to intanciate api-wrapper %s".format(hbaseContext));
globals.hBaseContext = Class.forName(hbaseContext).newInstance.asInstanceOf[HBaseContext]
} catch {
case e: java.lang.ClassNotFoundException =>
Logger.debug("Instanciating api-wrapper %s failed ".format(hbaseContext));
}
}
}
if(globals.hBaseContext == null) {
Logger.error("Could not instanciate any api wrapper, Hannibal will now exit");
System.exit(1);
}

if (app.mode != Mode.Test) {
Expand Down
46 changes: 25 additions & 21 deletions app/actors/UpdateMetricsActor.scala
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
/*
* Copyright 2013 Sentric. See LICENSE for details.
* Copyright 2014 YMC. See LICENSE for details.
*/

package actors

import akka.actor.{Props, Actor}
import play.api.{Configuration, Logger}
import akka.actor.Props
import play.api.Configuration

import java.util.Date
import akka.actor.Actor
import akka.util.duration._
import play.api.Logger

import play.libs.Akka
import models.{LogFile, MetricDef}
import actors.UpdateMetricsActor._
import play.libs.Akka
import akka.util.duration._

object UpdateMetricsActor {

Expand Down Expand Up @@ -62,11 +66,11 @@ class UpdateMetricsActor extends Actor {
def receive = {

case UPDATE_REGION_INFO =>
execute("update RegionInfo cache", () => {
models.Region.updateCache
})
execute("refresh RegionInfo cache") {
models.Region.refresh()
}

executeMetricUpdate("RegionMetrics", () => {
executeMetricUpdate("RegionMetrics") {
var updated = 0
val regions = models.Region.all
regions.foreach { regionInfo =>
Expand All @@ -78,20 +82,20 @@ class UpdateMetricsActor extends Actor {
updated = updated + 1
}
updated
})
}

case INITIALIZE_LOGFILE =>
execute("initialize Logfile", () => {
execute("initialize Logfile") {
if(LogFile.init()) {
Akka.system.scheduler.scheduleOnce(logfileFetchIntervalInSeconds seconds, context.self, UpdateMetricsActor.UPDATE_COMPACTION_METRICS)
} else {
Logger.error("Compaction metrics update disabled because discovery of the log file url pattern failed. "+
"Please check your logfile.path-pattern in application.conf.")
}
})
}

case UPDATE_COMPACTION_METRICS =>
executeMetricUpdate("CompactionMetrics", () => {
executeMetricUpdate("CompactionMetrics") {
try {
var updated = 0
val compactions = models.Compaction.all
Expand All @@ -100,10 +104,10 @@ class UpdateMetricsActor extends Actor {
val filteredCompactions = models.Compaction.forRegion(compactions, regionInfo.regionName)
val metric = MetricDef.COMPACTIONS(regionInfo.regionName)
filteredCompactions.foreach { compaction =>
if (compaction.end.getTime() > metric.lastUpdate) {
if (!metric.update(1.0, compaction.start.getTime())) {
if (compaction.end.getTime > metric.lastUpdate) {
if (!metric.update(1.0, compaction.start.getTime)) {
Logger.warn("possible bug: start compaction during compaction?")
} else if(!metric.update(0.0, compaction.end.getTime())) {
} else if(!metric.update(0.0, compaction.end.getTime)) {
Logger.warn("possible bug: end compaction outside compaction?")
} else {
updated = updated + 1
Expand All @@ -115,7 +119,7 @@ class UpdateMetricsActor extends Actor {
} finally {
Akka.system.scheduler.scheduleOnce(logfileFetchIntervalInSeconds seconds, context.self, UpdateMetricsActor.UPDATE_COMPACTION_METRICS)
}
})
}

case CLEAN =>
Logger.info("start cleaning metrics and records older than one %d seconds... (%s)".format(cleanThresholdInSeconds, new Date()))
Expand All @@ -125,18 +129,18 @@ class UpdateMetricsActor extends Actor {
Logger.info("cleaned " + cleaned._1 + " old metrics and " + cleaned._2 + " old records, took " + (after - before) + "ms... (" +new Date()+") ")
}

def executeMetricUpdate(name:String, functionBlock: () => Int) : Unit = {
def executeMetricUpdate(name:String)(thunk: => Int) {
Logger.info("start updating " + name + "... (" + new Date() + ")")
val before = System.currentTimeMillis()
val length = functionBlock()
val length = thunk
val after = System.currentTimeMillis()
Logger.info("completed updating " + length + " " + name + ", took " + (after - before) + "ms... (" +new Date()+") ")
}

def execute(name:String, functionBlock: () => Unit) : Unit = {
def execute(name:String)(thunk: => Unit) = {
Logger.info("start " + name + "... (" + new Date() + ")")
val before = System.currentTimeMillis()
functionBlock()
thunk
val after = System.currentTimeMillis()
Logger.info("completed " + name + ", took " + (after - before) + "ms... (" +new Date()+") ")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Sentric. See LICENSE for details.
# Copyright 2014 YMC. See LICENSE for details.

$ ->
showCompactionsView = window.showCompactionsView = new ShowCompactionsView
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/main/regions/show_region.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Sentric. See LICENSE for details.
# Copyright 2014 YMC. See LICENSE for details.

$ ->
showRegionView = window.showRegionView = new ShowRegionView
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/main/servers/show_cluster.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Sentric. See LICENSE for details.
# Copyright 2014 YMC. See LICENSE for details.

$ ->
showClusterView = window.showClusterView = new ShowClusterView
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/main/tables/show_table.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Sentric. See LICENSE for details.
# Copyright 2014 YMC. See LICENSE for details.

$ ->
showTableView = window.showTableView = new ShowTableView
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/models/Metric.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Sentric. See LICENSE for details.
# Copyright 2014 YMC. See LICENSE for details.

class @Metric extends Backbone.Model
url: ->
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/models/MetricSeries.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Sentric. See LICENSE for details.
# Copyright 2014 YMC. See LICENSE for details.

class @MetricsSeries

Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/models/Region.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Sentric. See LICENSE for details.
# Copyright 2014 YMC. See LICENSE for details.

class @Region extends Backbone.Model
isZeroLength: () ->
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/utils/RickshawUtil.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Sentric. See LICENSE for details.
# Copyright 2014 YMC. See LICENSE for details.

root = exports ? @
$ = root.jQuery
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/views/common/MetricChart.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Sentric. See LICENSE for details.
# Copyright 2014 YMC. See LICENSE for details.

class @MetricChartView extends Backbone.View
initialize: ->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Sentric. See LICENSE for details.
# Copyright 2014 YMC. See LICENSE for details.

class @ShowCompactionsView extends Backbone.View

Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/views/regions/ShowRegion.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Sentric. See LICENSE for details.
# Copyright 2014 YMC. See LICENSE for details.

class @ShowRegionView extends Backbone.View

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Sentric. See LICENSE for details.
# Copyright 2014 YMC. See LICENSE for details.

root = exports ? @

Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/views/servers/ServerChart.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Sentric. See LICENSE for details.
# Copyright 2014 YMC. See LICENSE for details.

class StackingToggleView extends Backbone.View
events:
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/views/servers/ShowCluster.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Sentric. See LICENSE for details.
# Copyright 2014 YMC. See LICENSE for details.

class @ShowClusterView extends Backbone.View

Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/views/tables/ShowTable.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Sentric. See LICENSE for details.
# Copyright 2014 YMC. See LICENSE for details.

class @ShowTableView extends Backbone.View

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Sentric. See LICENSE for details.
# Copyright 2014 YMC. See LICENSE for details.

class @TableRegionsChartView extends Backbone.View

Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/main.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2013 Sentric. See LICENSE for details.
// Copyright 2014 YMC. See LICENSE for details.

.page-title {
}
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/metric_chart_view.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2013 Sentric. See LICENSE for details.
// Copyright 2014 YMC. See LICENSE for details.

.metric-chart-view {
@x-axis-height: 20px;
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/server_chart.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2013 Sentric. See LICENSE for details.
// Copyright 2014 YMC. See LICENSE for details.

#server_chart {
@x-axis-height: 20px;
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/table_regions_chart_view.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2013 Sentric. See LICENSE for details.
// Copyright 2014 YMC. See LICENSE for details.

.table-regions-chart-view {
@y-axis-width: 80px;
Expand Down
Loading

0 comments on commit d1e9210

Please sign in to comment.