Skip to content
Merged

Dev #117

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ SCOUTER can help you.
## Documents
- [Document Home](./scouter.document/index.md)
- [Quick Start Guide (Quick Installation and Demo)](./scouter.document/main/Quick-Start.md)
- [Live Demo(Try to use scouter by connecting on live demo system)](./scouter.document/main/Live-Demo.md)
- [Client Screen Help](./scouter.document/client/How-To-Use-Client.md)

## Download
Expand Down Expand Up @@ -67,12 +68,16 @@ Scouter has three modules:
- **SWT & GEF4** : Charts and Diagrams
<br>

## Facebook
- [Scouter APM : Facebook Scouter user group](https://www.facebook.com/groups/scouterapm/)

## How to contribute
- TBD


## Q&A
- [Google Groups](https://groups.google.com/forum/#!forum/scouter-project)

## Facebook
- [Facebook Scouter user group](https://www.facebook.com/groups/1525329794448529/)

## License
Licensed under the Apache License, Version 2.0
<br>
Expand Down
10 changes: 7 additions & 3 deletions README_kr.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ APM은 Application performance montoring 또는 application performance manageme
## Documents
- [Document Home](./scouter.document/index_kr.md)
- [Quick Start(Scouter Demo 설치)](./scouter.document/main/Quick-Start_kr.md)
- [Live Demo(제공되는 Demo 시스템 바로 접속해 보기)](./scouter.document/main/Live-Demo_kr.md)
- [Client 화면 설명](./scouter.document/client/How-To-Use-Client_kr.md)

## Download
Expand Down Expand Up @@ -62,12 +63,15 @@ APM은 Application performance montoring 또는 application performance manageme
- **SWT & GEF4** : Charts and Diagrams
<br>

## Facebook
- [Scouter APM 사용자 모임 - Facebook 그룹](https://www.facebook.com/groups/scouterapm/)

## Scouter에 기여하기
- TBD

## Q&A
- [Google Groups](https://groups.google.com/forum/#!forum/scouter-project)

## Facebook
- [Facebook Scouter user group](https://www.facebook.com/groups/1525329794448529/)

## License
Licensed under the Apache License, Version 2.0
<br>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright 2015 the original author or authors.
* @https://github.com/scouter-project/scouter
*
* Licensed 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 scouter.agent.counter.meter;

import scouter.lang.ref.DOUBLE;
import scouter.lang.ref.INT;
import scouter.util.MeteringUtil;
import scouter.util.MeteringUtil.Handler;

public class MeterResource {

static class Bucket {
double value;
int count;
}
private MeteringUtil<Bucket> meter = new MeteringUtil<Bucket>() {
protected Bucket create() {
return new Bucket();
};

protected void clear(Bucket o) {
o.value=0;
o.count = 0;
}
};

public synchronized void add(double value) {
Bucket b = meter.getCurrentBucket();
b.value += value;
b.count++;
}

public double getAvg(int period) {
final INT count = new INT();
final DOUBLE sum = new DOUBLE();
meter.search(period, new Handler<MeterResource.Bucket>() {
public void process(Bucket u) {
sum.value += u.value;
count.value += u.count;
}
});
return count.value == 0 ? 0 : sum.value / count.value;
}

public double getSum(int period) {
final DOUBLE sum = new DOUBLE();
meter.search(period, new Handler<MeterResource.Bucket>() {
public void process(Bucket u) {
sum.value += u.value;
}
});
return sum.value;
}

}
17 changes: 15 additions & 2 deletions scouter.agent.host/src/scouter/agent/counter/task/HostPerf.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import scouter.agent.Logger;
import scouter.agent.counter.CounterBasket;
import scouter.agent.counter.anotation.Counter;
import scouter.agent.counter.meter.MeterResource;
import scouter.agent.netio.data.DataProxy;
import scouter.lang.AlertLevel;
import scouter.lang.TimeTypeEnum;
Expand All @@ -31,7 +32,11 @@ public class HostPerf {
static int SLEEP_TIME = 2000;
static Sigar sigarImpl = new Sigar();
static SigarProxy sigar = SigarProxyCache.newInstance(sigarImpl, SLEEP_TIME);


MeterResource cpuMeter = new MeterResource();
MeterResource sysCpuMeter = new MeterResource();
MeterResource userCpuMeter = new MeterResource();

@Counter
public void process(CounterBasket pw) {
try {
Expand All @@ -48,10 +53,18 @@ void domain(CounterBasket pw) throws SigarException {

CpuPerc cpuPerc = sigar.getCpuPerc();
float cpu = (float) ((1.0D - cpuPerc.getIdle()) * 100);
alertCpu(cpu);
cpuMeter.add(cpu);
float sysCpu = (float) cpuPerc.getSys() * 100;
sysCpuMeter.add(sysCpu);
float userCpu = (float) cpuPerc.getUser() * 100;
userCpuMeter.add(userCpu);

cpu = (float) cpuMeter.getAvg(10);
sysCpu = (float) sysCpuMeter.getAvg(10);
userCpu = (float) userCpuMeter.getAvg(10);

alertCpu(cpu);

Mem m = sigar.getMem();
alertMem(m);

Expand Down
6 changes: 4 additions & 2 deletions scouter.agent.java/src/scouter/agent/AgentTransformer.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ public byte[] transform(ClassLoader loader, String className, Class classBeingRe
AsyncRunner.getInstance().add(loader, className, classfileBuffer);
return null;
}
if (loader == null) {
return null;
if (loader == null ) {
if(conf._hook_boot_prefix==null || conf._hook_boot_prefix.length()==0 || false == className.startsWith(conf._hook_boot_prefix)){
return null;
}
}
}
if (className.startsWith("scouter/")) {
Expand Down
3 changes: 3 additions & 0 deletions scouter.agent.java/src/scouter/agent/Configure.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
public class Configure extends Thread {
public static boolean JDBC_REDEFINED = false;
private static Configure instance = null;

public final static synchronized Configure getInstance() {
if (instance == null) {
instance = new Configure();
Expand Down Expand Up @@ -182,6 +183,7 @@ public final static synchronized Configure getInstance() {
public boolean _hook_usertx_enabled = true;
public String _hook_direct_patch_classes = "";
public boolean _hook_spring_rest_enabled = false;
public String _hook_boot_prefix=null;

//Control
public boolean control_reject_service_enabled = false;
Expand Down Expand Up @@ -443,6 +445,7 @@ private void apply() {
this.trace_db2_enabled = getBoolean("trace_db2_enabled", true);
this._hook_usertx_enabled = getBoolean("_hook_usertx_enabled", true);
this._hook_direct_patch_classes = getValue("_hook_direct_patch_classes", "");
this._hook_boot_prefix = getValue("_hook_boot_prefix");
this.counter_recentuser_valid_ms = getLong("counter_recentuser_valid_ms", DateUtil.MILLIS_PER_FIVE_MINUTE);
this.counter_object_registry_path = getValue("counter_object_registry_path", "/tmp/scouter");
this.sfa_dump_enabled = getBoolean("sfa_dump_enabled", false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ public Pack activeThreadList(Pack param) {
ListValue ip = rPack.newList("ip");
ListValue sql = rPack.newList("sql");
ListValue subcall = rPack.newList("subcall");
ListValue login = rPack.newList("login");
ListValue desc = rPack.newList("desc");
Enumeration<TraceContext> en = TraceContextManager.getContextEnumeration();
while (en.hasMoreElements()) {
TraceContext ctx = en.nextElement();
Expand All @@ -154,6 +156,8 @@ public Pack activeThreadList(Pack param) {
Logger.println("A128", th);
cpu.add(0L);
}
login.add(ctx.login);
desc.add(ctx.desc);
}
rPack.put("complete", new BooleanValue(true));
return rPack;
Expand Down
72 changes: 48 additions & 24 deletions scouter.client/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -455,14 +455,6 @@
name="Data File Management"
restorable="false">
</view>
<view
allowMultiple="true"
class="scouter.client.views.ServiceGroupCountView"
icon="icons/server_chart.png"
id="scouter.client.views.ServiceGroupCountView"
name="ServiceGroup Count"
restorable="true">
</view>
<view
allowMultiple="false"
class="scouter.client.group.view.GroupNavigationView"
Expand Down Expand Up @@ -592,14 +584,6 @@
name="EQ Group"
restorable="true">
</view>
<view
allowMultiple="true"
class="scouter.client.views.ServiceGroupView"
icon="icons/sum.png"
id="scouter.client.views.ServiceGroupView"
name="Service Group"
restorable="true">
</view>
<view
allowMultiple="true"
class="scouter.client.views.LoginUserView"
Expand All @@ -608,14 +592,6 @@
name="LoginUser"
restorable="false">
</view>
<view
allowMultiple="true"
class="scouter.client.group.view.ServiceGroupGroupView"
icon="icons/sum.png"
id="scouter.client.group.view.ServiceGroupGroupView"
name="Service Group of Group"
restorable="true">
</view>
<view
allowMultiple="true"
class="scouter.client.views.WhiteBoardView"
Expand Down Expand Up @@ -942,6 +918,54 @@
name="Visitors"
restorable="false">
</view>
<view
allowMultiple="true"
class="scouter.client.counter.views.CounterRTAllPairChart"
icon="icons/perf.png"
id="scouter.client.counter.views.CounterRTAllPairChart"
name="RealtimePairChart"
restorable="true">
</view>
<view
allowMultiple="true"
class="scouter.client.counter.views.CounterPTAllPairChart"
icon="icons/perf.png"
id="scouter.client.counter.views.CounterPTAllPairChart"
name="PasttimePairChart"
restorable="false">
</view>
<view
allowMultiple="true"
class="scouter.client.views.ServiceGroupTPSView"
icon="icons/sum.png"
id="scouter.client.views.ServiceGroupTPSView"
name="Service Group TPS"
restorable="true">
</view>
<view
allowMultiple="true"
class="scouter.client.group.view.ServiceGroupTPSGroupView"
icon="icons/sum.png"
id="scouter.client.group.view.ServiceGroupTPSGroupView"
name="Service Group of Group TPS"
restorable="true">
</view>
<view
allowMultiple="true"
class="scouter.client.views.ServiceGroupElapsedView"
icon="icons/sum.png"
id="scouter.client.views.ServiceGroupElapsedView"
name="Service Group Elapsed"
restorable="true">
</view>
<view
allowMultiple="true"
class="scouter.client.group.view.ServiceGroupElapsedGroupView"
icon="icons/sum.png"
id="scouter.client.group.view.ServiceGroupElapsedGroupView"
name="Service Group of Group Elapsed"
restorable="true">
</view>
</extension>
<extension
point="org.eclipse.ui.commands">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright 2015 the original author or authors.
* @https://github.com/scouter-project/scouter
*
* Licensed 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 scouter.client.actions;

import org.eclipse.jface.action.Action;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;

import scouter.client.Images;
import scouter.client.views.ServiceGroupElapsedView;
import scouter.lang.counters.CounterConstants;

public class OpenServiceGroupElapsedAction extends Action {
public final static String ID = OpenServiceGroupElapsedAction.class.getName();

private final IWorkbenchWindow window;
int serverId;
String objType;

public OpenServiceGroupElapsedAction(IWorkbenchWindow window, int serverId, String objType) {
this.window = window;
this.serverId = serverId;
this.objType = objType;
setText("Elapsed");
setId(ID);
setImageDescriptor(Images.getCounterImageDescriptor(objType, CounterConstants.WAS_ELAPSED_TIME, serverId));
}

public void run() {
if (window != null) {
try {
window.getActivePage().showView(ServiceGroupElapsedView.ID, serverId + "&" + objType, IWorkbenchPage.VIEW_ACTIVATE);
} catch (PartInitException e) {
e.printStackTrace();
}
}
}
}
Loading