Skip to content

Commit

Permalink
Merge pull request #18 from scouter-project/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
bill23-kim committed Jul 30, 2015
2 parents f1449e6 + 3042fae commit 767bf93
Show file tree
Hide file tree
Showing 27 changed files with 378 additions and 282 deletions.
Binary file modified misc/images/xlog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified misc/screen/scr001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions scouter.agent/src/scouter/agent/Configure.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public final static synchronized Configure getInstance() {
public String server_addr = "127.0.0.1";
public int server_udp_port = NetConstants.DATAUDP_SERVER_PORT;
public int server_tcp_port = NetConstants.DATATCP_SERVER_PORT;
public int server_tcp_session_count = 2;
public int server_tcp_session_count = 1;
public int server_tcp_so_timeout = 60000;
public int server_tcp_connection_timeout = 3000;

Expand Down Expand Up @@ -390,7 +390,7 @@ private void apply() {
this.server_addr = getValue("server_addr", getValue("server.addr", "127.0.0.1"));
this.server_udp_port = getInt("server_udp_port", getInt("server.port", NetConstants.DATAUDP_SERVER_PORT));
this.server_tcp_port = getInt("server_tcp_port", getInt("server.port", NetConstants.DATATCP_SERVER_PORT));
this.server_tcp_session_count = getInt("server_tcp_session_count", 2,1);
this.server_tcp_session_count = getInt("server_tcp_session_count", 1,1);
this.server_tcp_connection_timeout = getInt("server_tcp_connection_timeout", 3000);
this.server_tcp_so_timeout = getInt("server_tcp_so_timeout", 60000);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ public static synchronized TcpRequestMgr getInstance() {
public void run() {

while (true) {
int cnt = Configure.getInstance().server_tcp_session_count;
int sessionCount = Configure.getInstance().server_tcp_session_count;
ThreadUtil.sleep(1000);
try {
for (int i = 0; i < cnt && TcpWorker.LIVE.size() < cnt; i++) {
for (int i = 0; i < sessionCount && TcpWorker.LIVE.size() < sessionCount; i++) {
TcpWorker w = new TcpWorker();
if (w.prepare()) {
pool.execute(w);
} else {
ThreadUtil.sleep(3000);
}
}
while (TcpWorker.LIVE.size() > cnt) {
while (TcpWorker.LIVE.size() > sessionCount) {
TcpWorker w = TcpWorker.LIVE.removeFirst();
w.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public boolean prepare() {
socket.connect(new InetSocketAddress(host, port), connection_timeout);
socket.setSoTimeout(so_timeout);
if (localAddr == null) {
localAddr = socket.getLocalAddress().getHostAddress() + ":0";
localAddr = socket.getLocalAddress().getHostAddress();
}
LIVE.put(this.hashCode(),this);
return true;
Expand Down
14 changes: 14 additions & 0 deletions scouter.client/src/scouter/client/PerspectiveService.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import org.eclipse.ui.IPerspectiveFactory;
import org.eclipse.ui.IPlaceholderFolderLayout;

import scouter.client.counter.views.CounterRealTimeAllView;
import scouter.client.counter.views.CounterRealTimeTotalView;
import scouter.client.group.view.GroupNavigationView;
import scouter.client.preferences.PManager;
import scouter.client.preferences.PreferenceConstants;
Expand All @@ -38,6 +40,7 @@
import scouter.client.xlog.views.XLogRealTimeView;
import scouter.client.xlog.views.XLogSelectionView;
import scouter.client.xlog.views.XLogZoomTimeView;
import scouter.lang.counters.CounterConstants;

public class PerspectiveService implements IPerspectiveFactory {

Expand Down Expand Up @@ -68,8 +71,19 @@ public void createInitialLayout(IPageLayout layout) {
eqLayout.addPlaceholder(EQView.ID + ":*");
eqLayout.addView(EQView.ID + ":" + serverId +"&"+ objType); // 1

IFolderLayout upResLayout = layout.createFolder(IConstants.LAYOUT_WASSERVICE_LEFT_TOP, IPageLayout.LEFT, 0.3f, editorArea);
upResLayout.addView(CounterRealTimeAllView.ID + ":" + serverId + "&" + objType + "&" + CounterConstants.JAVA_HEAP_USED);

IFolderLayout midResLayout = layout.createFolder(IConstants.LAYOUT_WASSERVICE_LEFT_MIDDLE, IPageLayout.BOTTOM, 0.33f, IConstants.LAYOUT_WASSERVICE_LEFT_TOP);
midResLayout.addView(CounterRealTimeTotalView.ID + ":" + serverId + "&" + objType + "&" + CounterConstants.WAS_TPS);

IFolderLayout downResLayout = layout.createFolder(IConstants.LAYOUT_WASSERVICE_LEFT_BOTTOM, IPageLayout.BOTTOM, 0.5f, IConstants.LAYOUT_WASSERVICE_LEFT_MIDDLE);
downResLayout.addView(CounterRealTimeAllView.ID + ":" + serverId + "&" + objType + "&" + CounterConstants.WAS_ELAPSED_TIME);

IFolderLayout xlogTopLayout = layout.createFolder(IConstants.LAYOUT_WASSERVICE_CENTER_TOP, IPageLayout.LEFT, 1f, editorArea);
xlogTopLayout.addView(XLogRealTimeView.ID + ":" + serverId + "&" + objType);


layout.addPerspectiveShortcut(getId());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright 2015 LG CNS.
*
* 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 scouter.client.threads.ObjectSelectManager;


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

public ClearObjectFilterAction() {
setText("Exit Filter Mode");
setId(ID);
}

public void run() {
ObjectSelectManager.getInstance().clear();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ public void mouseUp(MouseEvent e) {
toolTip.hide();
}
public void mouseDown(MouseEvent e) {
double x = xyGraph.primaryXAxis.getPositionValue(e.x, false);
double y = xyGraph.primaryYAxis.getPositionValue(e.y, false);
if (x < 0 || y < 0) {
return;
}
Image image = new Image(e.display, 1, 10);
GC gc = new GC((FigureCanvas)e.widget);
gc.copyArea(image, e.x, e.y > 5 ? e.y - 5 : 0);
Expand All @@ -198,7 +203,7 @@ public void mouseDown(MouseEvent e) {
int objHash = AgentColorManager.getInstance().getObjectHash(rgb);
if (objHash != 0) {
String objName = TextProxy.object.getText(objHash);
double time = xyGraph.primaryXAxis.getPositionValue(e.x, true);
double time = xyGraph.primaryXAxis.getPositionValue(e.x, false);
double v = 0.0d;
for (Trace t : traces) {
if (t.getName().equals(objName)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,11 @@ public void mouseUp(MouseEvent e) {
toolTip.hide();
}
public void mouseDown(MouseEvent e) {
double x = xyGraph.primaryXAxis.getPositionValue(e.x, false);
double y = xyGraph.primaryYAxis.getPositionValue(e.y, false);
if (x < 0 || y < 0) {
return;
}
Image image = new Image(e.display, 1, 10);
GC gc = new GC((FigureCanvas)e.widget);
gc.copyArea(image, e.x, e.y > 5 ? e.y - 5 : 0);
Expand All @@ -300,7 +305,7 @@ public void mouseDown(MouseEvent e) {
int objHash = AgentColorManager.getInstance().getObjectHash(rgb);
if (objHash != 0) {
String objName = TextProxy.object.getText(objHash);
double time = xyGraph.primaryXAxis.getPositionValue(e.x, true);
double time = xyGraph.primaryXAxis.getPositionValue(e.x, false);
double v = 0.0d;
for (Trace t : traces) {
if (t.getName().equals(objName)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ public void mouseUp(MouseEvent e) {
toolTip.hide();
}
public void mouseDown(MouseEvent e) {
double x = xyGraph.primaryXAxis.getPositionValue(e.x, false);
double y = xyGraph.primaryYAxis.getPositionValue(e.y, false);
if (x < 0 || y < 0) {
return;
}
Image image = new Image(e.display, 1, 10);
GC gc = new GC((FigureCanvas)e.widget);
gc.copyArea(image, e.x, e.y > 5 ? e.y - 5 : 0);
Expand All @@ -203,7 +208,7 @@ public void mouseDown(MouseEvent e) {
int objHash = AgentColorManager.getInstance().getObjectHash(rgb);
if (objHash != 0) {
String objName = TextProxy.object.getText(objHash);
double time = xyGraph.primaryXAxis.getPositionValue(e.x, true);
double time = xyGraph.primaryXAxis.getPositionValue(e.x, false);
double v = 0.0d;
for (Trace t : traces) {
if (t.getName().equals(objName)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ public void mouseUp(MouseEvent e) {
toolTip.hide();
}
public void mouseDown(MouseEvent e) {
double x = xyGraph.primaryXAxis.getPositionValue(e.x, false);
double y = xyGraph.primaryYAxis.getPositionValue(e.y, false);
if (x < 0 || y < 0) {
return;
}
Image image = new Image(e.display, 1, 10);
GC gc = new GC((FigureCanvas)e.widget);
gc.copyArea(image, e.x, e.y > 5 ? e.y - 5 : 0);
Expand All @@ -199,7 +204,7 @@ public void mouseDown(MouseEvent e) {
int objHash = AgentColorManager.getInstance().getObjectHash(rgb);
if (objHash != 0) {
String objName = TextProxy.object.getText(objHash);
double time = xyGraph.primaryXAxis.getPositionValue(e.x, true);
double time = xyGraph.primaryXAxis.getPositionValue(e.x, false);
double v = 0.0d;
Trace t = traces.get(objHash);
v = ScouterUtil.getNearestValue(t.getDataProvider(), time);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ public void mouseUp(MouseEvent e) {
toolTip.hide();
}
public void mouseDown(MouseEvent e) {
double x = xyGraph.primaryXAxis.getPositionValue(e.x, false);
double y = xyGraph.primaryYAxis.getPositionValue(e.y, false);
if (x < 0 || y < 0) {
return;
}
Image image = new Image(e.display, 1, 10);
GC gc = new GC((FigureCanvas)e.widget);
gc.copyArea(image, e.x, e.y > 5 ? e.y - 5 : 0);
Expand All @@ -192,7 +197,7 @@ public void mouseDown(MouseEvent e) {
int objHash = AgentColorManager.getInstance().getObjectHash(rgb);
if (objHash != 0) {
String objName = TextProxy.object.getText(objHash);
double time = xyGraph.primaryXAxis.getPositionValue(e.x, true);
double time = xyGraph.primaryXAxis.getPositionValue(e.x, false);
double v = 0.0d;
Trace t = traces.get(objHash);
v = ScouterUtil.getNearestValue(t.getDataProvider(), time);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ public void mouseUp(MouseEvent e) {
toolTip.hide();
}
public void mouseDown(MouseEvent e) {
double x = xyGraph.primaryXAxis.getPositionValue(e.x, false);
double y = xyGraph.primaryYAxis.getPositionValue(e.y, false);
if (x < 0 || y < 0) {
return;
}
Image image = new Image(e.display, 1, 10);
GC gc = new GC((FigureCanvas)e.widget);
gc.copyArea(image, e.x, e.y > 5 ? e.y - 5 : 0);
Expand All @@ -190,7 +195,7 @@ public void mouseDown(MouseEvent e) {
int objHash = AgentColorManager.getInstance().getObjectHash(rgb);
if (objHash != 0) {
String objName = TextProxy.object.getText(objHash);
double time = xyGraph.primaryXAxis.getPositionValue(e.x, true);
double time = xyGraph.primaryXAxis.getPositionValue(e.x, false);
double v = 0.0d;
Trace t = traces.get(objHash);
v = ScouterUtil.getNearestValue(t.getDataProvider(), time);
Expand Down
12 changes: 6 additions & 6 deletions scouter.client/src/scouter/client/tags/TagCountUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public static List<String> loadTagString(int serverId, String date, List<Value>
resultList.add(TextProxy.object.getText(lv.getInt(i)));
}
} else if (tagName.equals(TagConstants.NAME_SERVICE)
|| tagName.equals(TagConstants.NAME_SERVICE_ELAPSED)
|| tagName.equals(TagConstants.NAME_SERVICE_BYTES)
|| tagName.equals(TagConstants.NAME_SERVICE_ERRORS)) {
|| tagName.equals(TagConstants.NAME_SERVICE_TIME_SUM)
|| tagName.equals(TagConstants.NAME_SERVICE_BYTE_SUM)
|| tagName.equals(TagConstants.NAME_SERVICE_ERROR_SUM)) {
TextProxy.service.load(date, lv, serverId);
for (int i = 0; i < lv.size(); i++) {
resultList.add(TextProxy.service.getText(lv.getInt(i)));
Expand Down Expand Up @@ -116,9 +116,9 @@ public static List<String> loadTagString(int serverId, String date, List<Value>
public static Value convertTagToValue(String tagName, String tagValue) {
if (tagName.equals(TagConstants.NAME_OBJECT)
|| tagName.equals(TagConstants.NAME_SERVICE)
|| tagName.equals(TagConstants.NAME_SERVICE_ELAPSED)
|| tagName.equals(TagConstants.NAME_SERVICE_BYTES)
|| tagName.equals(TagConstants.NAME_SERVICE_ERRORS)
|| tagName.equals(TagConstants.NAME_SERVICE_TIME_SUM)
|| tagName.equals(TagConstants.NAME_SERVICE_BYTE_SUM)
|| tagName.equals(TagConstants.NAME_SERVICE_ERROR_SUM)
|| tagName.equals(TagConstants.NAME_GROUP)
|| tagName.equals(TagConstants.NAME_USER_AGENT)
|| tagName.equals(TagConstants.NAME_REFERER)
Expand Down
4 changes: 2 additions & 2 deletions scouter.client/src/scouter/client/tags/TagCountView.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public void mouseDown(MouseEvent e) {
}

public void mouseDoubleClick(MouseEvent e) {
long stime = (long) totalGraph.primaryXAxis.getPositionValue(e.x, true);
long stime = (long) totalGraph.primaryXAxis.getPositionValue(e.x, false);
if (stime < rangeX1 || stime > rangeX2) return;
stime = stime / DateUtil.MILLIS_PER_MINUTE * DateUtil.MILLIS_PER_MINUTE;
long etime = stime + DateUtil.MILLIS_PER_MINUTE - 1;
Expand Down Expand Up @@ -395,7 +395,7 @@ public void mouseDown(MouseEvent e) {
}

public void mouseDoubleClick(MouseEvent e) {
long stime = (long) cntGraph.primaryXAxis.getPositionValue(e.x, true);
long stime = (long) cntGraph.primaryXAxis.getPositionValue(e.x, false);
if (stime < rangeX1 || stime > rangeX2) return;
stime = stime / DateUtil.MILLIS_PER_MINUTE * DateUtil.MILLIS_PER_MINUTE;
long etime = stime + DateUtil.MILLIS_PER_MINUTE - 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public boolean isUnselectedObject(int objHash) {
return unSelectedObjSet.contains(objHash);
}

public void clear() {
unSelectedObjSet.clear();
notifyChangeCheckedState();
}

public int unselectedSize() {
return unSelectedObjSet.size();
}
Expand Down
2 changes: 1 addition & 1 deletion scouter.client/src/scouter/client/util/ScouterUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public void mouseDown(MouseEvent e) {
int pixelValue = imageData.getPixel(0, point);
RGB rgb = palette.getRGB(pixelValue);
if (ColorUtil.getInstance().TOTAL_CHART_COLOR.getRGB().equals(rgb)) {
double time = xyGraph.primaryXAxis.getPositionValue(e.x, true);
double time = xyGraph.primaryXAxis.getPositionValue(e.x, false);
Trace t = xyGraph.getPlotArea().getTraceList().get(0);
if (t == null) {
return;
Expand Down
26 changes: 22 additions & 4 deletions scouter.client/src/scouter/client/views/ObjectNavigationView.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@

import scouter.client.Images;
import scouter.client.actions.AddServerAction;
import scouter.client.actions.ClearObjectFilterAction;
import scouter.client.actions.OpenGroupNavigationAction;
import scouter.client.actions.OpenLoginListAction;
import scouter.client.actions.OpenObjectDailyListAction;
Expand Down Expand Up @@ -98,6 +99,7 @@
import scouter.client.server.Server;
import scouter.client.server.ServerManager;
import scouter.client.threads.ObjectSelectManager;
import scouter.client.threads.ObjectSelectManager.IObjectCheckListener;
import scouter.client.util.ColorUtil;
import scouter.client.util.DummyAction;
import scouter.client.util.ExUtil;
Expand Down Expand Up @@ -216,7 +218,7 @@ public void menuAboutToShow(IMenuManager manager){
if(selectedItem){
fillTreeViewerContextMenu(manager);
}else{
addServerContextMenu(manager);
backgroundContextMenu(manager);
}
}
});
Expand Down Expand Up @@ -246,10 +248,12 @@ public void handleEvent(Event event) {
AgentObject ao = (AgentObject) o;
if (objSelMgr.unselectedSize() > 0) {
objSelMgr.selectObj(ao.getObjHash());
if (objSelMgr.unselectedSize() >= objectList.size()) {
objSelMgr.clear();
}
} else {
AgentObject[] aos = agentThread.getObjectList();
Set<Integer> unselSet = new HashSet<Integer>();
for (AgentObject a : aos) {
for (AgentObject a : objectList) {
if (a.getObjHash() != ao.getObjHash()) {
unselSet.add(a.getObjHash());
}
Expand All @@ -263,6 +267,16 @@ public void handleEvent(Event event) {
});

createQuickMenus();
ObjectSelectManager.getInstance().addObjectCheckStateListener(new IObjectCheckListener() {
public void notifyChangeState() {
if (objSelMgr.unselectedSize() > 0) {
agentTree.setBackground(ColorUtil.getInstance().getColor("azure"));
} else {
agentTree.setBackground(null);
}
refreshViewer();
}
});

thread = new RefreshThread(this, 3000);
thread.start();
Expand Down Expand Up @@ -332,8 +346,12 @@ private void createContextMenu(Viewer viewer, IMenuListener listener){
getSite().registerContextMenu(contextMenu, viewer);
}

private void addServerContextMenu(IMenuManager mgr){
private void backgroundContextMenu(IMenuManager mgr){
IWorkbenchWindow win = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (objSelMgr.unselectedSize() > 0) {
mgr.add(new ClearObjectFilterAction());
}
mgr.add(new Separator());
mgr.add(new AddServerAction(win, "Add Server", Images.add));
mgr.add(new Separator());
mgr.add(new OpenGroupNavigationAction(win));
Expand Down
6 changes: 3 additions & 3 deletions scouter.common/src/scouter/lang/constants/TagConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public class TagConstants {
public static final String NAME_OBJECT = "object";
public static final String NAME_IP = "ip";
public static final String NAME_SERVICE = "service";
public static final String NAME_SERVICE_ELAPSED = "service-elapsed";
public static final String NAME_SERVICE_BYTES = "service-bytes";
public static final String NAME_SERVICE_ERRORS = "service-errors";
public static final String NAME_SERVICE_TIME_SUM = "service-time-sum";
public static final String NAME_SERVICE_BYTE_SUM = "service-byte-sum";
public static final String NAME_SERVICE_ERROR_SUM = "service-error-sum";
public static final String NAME_USER_AGENT = "user-agent";
public static final String NAME_ERROR = "error";
public static final String NAME_REFERER = "referer";
Expand Down
Loading

0 comments on commit 767bf93

Please sign in to comment.