From 3b215cafdc85784ea12c0e935de1af2bda86cc5c Mon Sep 17 00:00:00 2001 From: SkyWorker Date: Sat, 5 Sep 2015 13:01:24 +0900 Subject: [PATCH 1/2] change data type of TagCount(int -> float) --- .../src/scouter/client/tags/TagCount.java | 2 +- .../src/scouter/client/tags/TagCountView.java | 34 +++--- .../service/handle/TagCountService.scala | 110 +++++++++--------- 3 files changed, 73 insertions(+), 73 deletions(-) diff --git a/scouter.client/src/scouter/client/tags/TagCount.java b/scouter.client/src/scouter/client/tags/TagCount.java index 44c18c534..6fb0ca05d 100644 --- a/scouter.client/src/scouter/client/tags/TagCount.java +++ b/scouter.client/src/scouter/client/tags/TagCount.java @@ -23,7 +23,7 @@ public class TagCount { String tagName; String value; - long count; + float count; List childs = null; protected synchronized void addChild(TagCount child) { diff --git a/scouter.client/src/scouter/client/tags/TagCountView.java b/scouter.client/src/scouter/client/tags/TagCountView.java index c8e14681c..b50999f6d 100644 --- a/scouter.client/src/scouter/client/tags/TagCountView.java +++ b/scouter.client/src/scouter/client/tags/TagCountView.java @@ -136,7 +136,7 @@ public class TagCountView extends ViewPart { FigureCanvas cntCanvas; XYGraph cntGraph; HashMap cntTraceMap = new HashMap(); - LinkedMap valueMap = new LinkedMap(); + LinkedMap valueMap = new LinkedMap(); private String objType; private String date; @@ -690,17 +690,17 @@ private void drawStackCountGraph() { cntGraph.removeTrace(t); } cntTraceMap.clear(); - int[] stackedValue = new int[1440]; - LinkedMap tempMap = new LinkedMap(); + float[] stackedValue = new float[1440]; + LinkedMap tempMap = new LinkedMap(); Enumeration entries = valueMap.entries(); while (entries.hasMoreElements()) { ENTRY entry = entries.nextElement(); String key = (String) entry.getKey(); - int[] values = (int[]) entry.getValue(); + float[] values = (float[]) entry.getValue(); for (int i = 0; i < values.length; i++) { stackedValue[i] += values[i]; } - int[] copiedArray = new int[stackedValue.length]; + float[] copiedArray = new float[stackedValue.length]; System.arraycopy(stackedValue, 0, copiedArray, 0, stackedValue.length); tempMap.putFirst(key, copiedArray); } @@ -709,7 +709,7 @@ private void drawStackCountGraph() { while (entries2.hasMoreElements()) { ENTRY entry = entries2.nextElement(); String key = (String) entry.getKey(); - int[] values = (int[]) entry.getValue(); + float[] values = (float[]) entry.getValue(); Trace trace = getCountTrace(key); CircularBufferDataProvider provider = (CircularBufferDataProvider)trace.getDataProvider(); provider.clearTrace(); @@ -824,11 +824,11 @@ public void process(DataInputX in) throws IOException { dataList.add(data); data.tagName = in.readText(); data.totalSize = in.readInt(); - data.totalCnt = in.readLong(); + data.totalCnt = in.readFloat(); int size = in.readInt(); for (int i = 0; i < size; i++) { Value v = in.readValue(); - long cnt = in.readLong(); + float cnt = in.readFloat(); data.addValue(v, cnt); } } @@ -861,12 +861,12 @@ public void process(DataInputX in) throws IOException { static class TagData { String tagName; List valueList = new ArrayList(); - List cntList = new ArrayList(); + List cntList = new ArrayList(); List strValueList; int totalSize; - long totalCnt; + float totalCnt; - void addValue(Value v, long cnt) { + void addValue(Value v, float cnt) { valueList.add(v); cntList.add(cnt); } @@ -896,7 +896,7 @@ private void loadTagCount(final String tagGroup, final String tagName, final Str ExUtil.asyncRun(new Runnable() { public void run() { TcpProxy tcp = TcpProxy.getTcpProxy(serverId); - final int[] valueArray = new int[1440]; + final float[] valueArray = new float[1440]; try { MapPack param = new MapPack(); param.put("objType", objType); @@ -906,8 +906,8 @@ public void run() { param.put("date", date); tcp.process(RequestCmd.TAGCNT_TAG_VALUE_DATA, param, new INetReader() { public void process(DataInputX in) throws IOException { - int[] values = in.readArray(new int[0]); - for (int i = 0; i < values.length; i++) { + float[] values = in.readArray(new float[0]); + for (int i = 0; i < values.length; i++) { valueArray[i] = values[i]; } } @@ -935,7 +935,7 @@ private void loadTotalCount(final String tagGroup) { ExUtil.asyncRun(new Runnable() { public void run() { TcpProxy tcp = TcpProxy.getTcpProxy(serverId); - final List valueList = new ArrayList(); + final List valueList = new ArrayList(); try { MapPack param = new MapPack(); param.put("tagGroup", tagGroup); @@ -945,7 +945,7 @@ public void run() { param.put("date", date); tcp.process(RequestCmd.TAGCNT_TAG_VALUE_DATA, param, new INetReader() { public void process(DataInputX in) throws IOException { - int[] values = in.readArray(new int[0]); + float[] values = in.readArray(new float[0]); for (int i = 0; i < values.length; i++) { valueList.add(values[i]); } @@ -963,7 +963,7 @@ public void run() { provider.clearTrace(); for (int i = 0; i < valueList.size(); i++) { double x = stime + (DateUtil.MILLIS_PER_MINUTE * i + DateUtil.MILLIS_PER_SECOND * 30); - int value = valueList.get(i); + float value = valueList.get(i); provider.addSample(new Sample(x, value)); } adjustYAxisRange(totalGraph, provider); diff --git a/scouter.server/src/scouter/server/netio/service/handle/TagCountService.scala b/scouter.server/src/scouter/server/netio/service/handle/TagCountService.scala index c36c4a20c..6b91551cd 100644 --- a/scouter.server/src/scouter/server/netio/service/handle/TagCountService.scala +++ b/scouter.server/src/scouter/server/netio/service/handle/TagCountService.scala @@ -86,12 +86,12 @@ class TagCountService { dout.writeText(tagName); dout.writeInt(valueCountTotal.howManyValues) // TODO: temp - dout.writeLong(valueCountTotal.totalCount.toLong) + dout.writeFloat(valueCountTotal.totalCount) dout.writeInt(valueCountTotal.values.size()) EnumerScala.forward(valueCountTotal.values, (vc: ValueCount) => { dout.writeValue(vc.tagValue) // TODO: temp - dout.writeLong(vc.valueCount.toLong) + dout.writeFloat(vc.valueCount.toFloat) }) } } @@ -117,7 +117,7 @@ class TagCountService { val valueCount = TagCountProxy.getTagValueCountData(date, objType, tagGroup, tagName, tagValue); if (valueCount != null) { dout.writeByte(TcpFlag.HasNEXT); - dout.writeArray(toIntArr(valueCount)) + dout.writeArray(valueCount) } } private def toIntArr(a: Array[Float]): Array[Int] = { @@ -239,14 +239,14 @@ class TagCountService { return true; } } -// } else if (key == TagConstants.NAME_USERID) { -// val useridLv = mv.getList(key); -// for (i <- 0 to useridLv.size() - 1) { -// var userid = useridLv.getLong(i); -// if (x.userid == userid) { -// return true; -// } -// } + // } else if (key == TagConstants.NAME_USERID) { + // val useridLv = mv.getList(key); + // for (i <- 0 to useridLv.size() - 1) { + // var userid = useridLv.getLong(i); + // if (x.userid == userid) { + // return true; + // } + // } } else if (key == TagConstants.NAME_CITY) { val cityLv = mv.getList(key); for (i <- 0 to cityLv.size() - 1) { @@ -255,14 +255,14 @@ class TagCountService { return true; } } -// } else if (key == TagConstants.NAME_IP) { -// val ipLv = mv.getList(key); -// for (i <- 0 to ipLv.size() - 1) { -// var ip = ipLv.get(i); -// if (IPUtil.toString(x.ipaddr) == ip.toString()) { -// return true; -// } -// } + // } else if (key == TagConstants.NAME_IP) { + // val ipLv = mv.getList(key); + // for (i <- 0 to ipLv.size() - 1) { + // var ip = ipLv.get(i); + // if (IPUtil.toString(x.ipaddr) == ip.toString()) { + // return true; + // } + // } } else if (TagConstants.serviceHashGroup.hasKey(key)) { val serviceLv = mv.getList(key); for (i <- 0 to serviceLv.size() - 1) { @@ -287,42 +287,42 @@ class TagCountService { return true; } } -// } else if (key == TagConstants.NAME_APITIME) { -// if (x.apicallTime >= 1000) { -// val apitimeLv = mv.getList(key); -// for (i <- 0 to apitimeLv.size() - 1) { -// var apitime = apitimeLv.getInt(i); -// apitime match { -// case 1 => if (1000 <= x.apicallTime && x.apicallTime < 3000) return true; -// case 3 => if (3000 <= x.apicallTime && x.apicallTime < 8000) return true; -// case 8 => if (8000 <= x.apicallTime) return true; -// } -// } -// } -// } else if (key == TagConstants.NAME_SQLTIME) { -// if (x.sqlTime >= 1000) { -// val sqltimeLv = mv.getList(key); -// for (i <- 0 to sqltimeLv.size() - 1) { -// var sqltime = sqltimeLv.getInt(i); -// sqltime match { -// case 1 => if (1000 <= x.sqlTime && x.sqlTime < 3000) return true; -// case 3 => if (3000 <= x.sqlTime && x.sqlTime < 8000) return true; -// case 8 => if (8000 <= x.sqlTime) return true; -// } -// } -// } -// } else if (key == TagConstants.NAME_ELAPSED) { -// if (x.elapsed >= 1000) { -// val elapsedLv = mv.getList(key); -// for (i <- 0 to elapsedLv.size() - 1) { -// var elapsed = elapsedLv.getInt(i); -// elapsed match { -// case 1 => if (1000 <= x.elapsed && x.elapsed < 3000) return true; -// case 3 => if (3000 <= x.elapsed && x.elapsed < 8000) return true; -// case 8 => if (8000 <= x.elapsed) return true; -// } -// } -// } + // } else if (key == TagConstants.NAME_APITIME) { + // if (x.apicallTime >= 1000) { + // val apitimeLv = mv.getList(key); + // for (i <- 0 to apitimeLv.size() - 1) { + // var apitime = apitimeLv.getInt(i); + // apitime match { + // case 1 => if (1000 <= x.apicallTime && x.apicallTime < 3000) return true; + // case 3 => if (3000 <= x.apicallTime && x.apicallTime < 8000) return true; + // case 8 => if (8000 <= x.apicallTime) return true; + // } + // } + // } + // } else if (key == TagConstants.NAME_SQLTIME) { + // if (x.sqlTime >= 1000) { + // val sqltimeLv = mv.getList(key); + // for (i <- 0 to sqltimeLv.size() - 1) { + // var sqltime = sqltimeLv.getInt(i); + // sqltime match { + // case 1 => if (1000 <= x.sqlTime && x.sqlTime < 3000) return true; + // case 3 => if (3000 <= x.sqlTime && x.sqlTime < 8000) return true; + // case 8 => if (8000 <= x.sqlTime) return true; + // } + // } + // } + // } else if (key == TagConstants.NAME_ELAPSED) { + // if (x.elapsed >= 1000) { + // val elapsedLv = mv.getList(key); + // for (i <- 0 to elapsedLv.size() - 1) { + // var elapsed = elapsedLv.getInt(i); + // elapsed match { + // case 1 => if (1000 <= x.elapsed && x.elapsed < 3000) return true; + // case 3 => if (3000 <= x.elapsed && x.elapsed < 8000) return true; + // case 8 => if (8000 <= x.elapsed) return true; + // } + // } + // } } } return false; From 5e5720699322785ee94624bbef439f9969273502 Mon Sep 17 00:00:00 2001 From: KimEunsu Date: Sat, 5 Sep 2015 17:58:58 +0900 Subject: [PATCH 2/2] minor version up --- scouter.deploy/build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scouter.deploy/build.xml b/scouter.deploy/build.xml index c6dbb2ca0..fe1f904a4 100644 --- a/scouter.deploy/build.xml +++ b/scouter.deploy/build.xml @@ -4,7 +4,7 @@ - +