Skip to content

Commit

Permalink
add console view for VISITOR
Browse files Browse the repository at this point in the history
  • Loading branch information
ScouterProject committed Jul 4, 2015
1 parent 9f46523 commit 01703b1
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 4 deletions.
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 @@ -113,7 +113,7 @@ public final static synchronized Configure getInstance() {
* 1 - JSESSIONID + remoteIp
* 2 - SCOUTER(set-cookie)
*/
public int mode_visitor = 1;
public int mode_visitor = 2;

public boolean enable_profile_summary = false;
public boolean profile_thread_cputime = false;
Expand Down Expand Up @@ -466,7 +466,7 @@ private void apply() {
this.max_concurrent_server_request = getInt("max_concurrent_server_request", 10);
this.debug_connection_stack = getBoolean("debug_connection_stack", false);

this.mode_visitor = getInt("mode_visitor", 1);
this.mode_visitor = getInt("mode_visitor", 2);

this.visitor_jsessionid = getValue("visitor_jsessionid", "JSESSIONID");
this.enable_statistics = getBoolean("enable_statistics", true);
Expand Down
2 changes: 1 addition & 1 deletion scouter.server/src/scouter/server/core/AgentManager.scala
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ object AgentManager {
return agents;
}
}
private def isObjType(word: String) = objMap.getTypeObjects(word) != null
def isObjType(word: String) = objMap.getTypeObjects(word) != null

def getObjPacks(): Enumeration[ObjectPack] = {
return objMap.objects();
Expand Down
2 changes: 1 addition & 1 deletion scouter.server/src/scouter/server/db/VisitorDB.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import scouter.server.util.cardinality.HyperLogLog
import scouter.util.DateUtil
import scouter.util.ThreadUtil
import scouter.util.IntKeyLinkedMap
import scouter.server.db.DBCtr

import java.io.File
import scouter.util.FileUtil
import scouter.util.HashUtil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ object ProcessMain {
case "xlog" => XLOG.process(cmd.trim().substring("xlog".length()).trim())
case "xlist" => XLIST.process(cmd.trim().substring("xlist".length()).trim())
case "tagcnt" => TAGCNT.process(cmd.trim().substring("tagcnt".length()).trim())
case "visitor" => VISITOR.process(cmd.trim().substring("visitor".length()).trim())
case "" =>
case _ => Help.help(cmd)
}
Expand Down
59 changes: 59 additions & 0 deletions scouter.server/src/scouter/server/term/handler/VISITOR.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* 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.server.term.handler

import java.util.List
import scouter.lang.CounterKey
import scouter.lang.TimeTypeEnum
import scouter.server.core.AgentManager
import scouter.server.core.cache.CounterCache
import scouter.server.term.AnsiPrint
import scouter.server.util.EnumerScala
import scouter.server.util.ThreadScala
import scouter.util.DateUtil
import scouter.util.FormatUtil
import scouter.util.StringUtil
import scala.collection.JavaConversions._
import scouter.util.IntSet
import scouter.server.core.cache.XLogCache
import scouter.io.DataInputX
import scouter.lang.pack.XLogPack
import scouter.util.CastUtil
import scouter.server.db.VisitorDB
import scouter.lang.ObjectType
object VISITOR {

def process(cmd: String): Unit = {

if (cmd == null)
return
val o = StringUtil.firstWord(cmd, " ")
if (AgentManager.isObjType(o)) {
val v = VisitorDB.getVisitorObjType(o)
println("\t" + FormatUtil.print(v, "#,##0"));
} else {
val hashList = AgentManager.filter(o)
EnumerScala.foreach(hashList.iterator(), (h: Int) => {
val v = VisitorDB.getVisitorObject(h)
if (v > 0) {
println("\t" + AgentManager.getAgentName(h) + " = " + FormatUtil.print(v, "#,##0"));
}
})
}
}

}

0 comments on commit 01703b1

Please sign in to comment.