2016-03-24 88 views
0

我試圖從here濃湯阿帕奇風暴監控指標

配置濃湯風暴拓撲監控沒有在網站上給出明顯的例子或使用,需要在哪些參數和在哪裏添加此代碼一些澄清在上面的網站上給出

MonitorClient mclient = MonitorClient.forConfig(conf); 

// There are multiple metric groups, each with multiple metrics. 
// Components have names and multiple instances, each of which has an integer ID 

mclient.declare(metricGroup,metric,task_id,component_id); 

mclient.increment(metricGroup,metric, 1L , task_id); 

TaskHook.registerTo(config); 

現在我們需要爲MetricGroup,metric,task_id和component_id提供哪些值?如果需要從每個Spout和Bolt找到它,我們該怎麼做?這個代碼應該放在哪裏,在提交拓撲結構之前,還是在拓撲構建器中,或者在open/prepare方法或其他地方的單個Spout/Bolt類中。感謝在這個問題上的任何幫助。

回答

0

我試過幾個選項,下面是爲我工作的配置,組名可以是任何東西,度量標準名稱是流從一個組件到其他的名稱,taskid可以是任何唯一的任務編號,

conf.put("gumbo.server.kind", "local"); 
conf.put("gumbo.local.port", 8086); //Any port it must be same in the html file 
conf.put("gumbo.start", System.currentTimeMillis()); // should be the same for all calls 
conf.put("gumbo.bucketSize", 1000L); 
conf.put("gumbo.enabled", true); 
conf.put("gumbo.http.host", "hostname"); 
conf.put("gumbo.http.port", 8086);//Any port it must be same in the html file 
conf.put("gumbo.http.app", "gumbo"); 
conf.put("gumbo.enabled", true); 
conf.put("gumbo.server.key", topology_id); 

MonitorClient mclient = MonitorClient.connect(conf); 

GumboTaskHook.registerTo(conf); 
    mclient.declare("Backlog",RTConstants.MATCH_LEFT_STREAM,3,RTConstants.TRANSFORM_LEFT_BOLT);  
    mclient.increment("Backlog",RTConstants.MATCH_LEFT_STREAM, 1L , 3); 

    mclient.declare("Backlog",RTConstants.MATCH_RIGHT_STREAM,4,RTConstants.TRANSFORM_RIGHT_BOLT);  
    mclient.increment("Backlog",RTConstants.MATCH_RIGHT_STREAM, 1L , 4);