• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java XLogPack类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中scouter.lang.pack.XLogPack的典型用法代码示例。如果您正苦于以下问题:Java XLogPack类的具体用法?Java XLogPack怎么用?Java XLogPack使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XLogPack类属于scouter.lang.pack包,在下文中一共展示了XLogPack类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: xlog

import scouter.lang.pack.XLogPack; //导入依赖的package包/类
@ServerPlugin(PluginConstants.PLUGIN_SERVER_XLOG)
public void xlog(XLogPack pack) {
	if (conf.getBoolean("ext_plugin_teamup_xlog_enabled", true)) {
		println("[ext_plugin_teamup_xlog_enabled true]");
		if (pack.error != 0) {
			String date = DateUtil.yyyymmdd(pack.endTime);
			String service = TextRD.getString(date, TextTypes.SERVICE, pack.service);
			String patterns = conf.getValue("ext_plugin_teamup_error_escape_method_patterns").length()>0?conf.getValue("ext_plugin_teamup_error_escape_method_patterns"):"*";
			if (!PatternsUtil.isValid(patterns, service)) {
				AlertPack ap = new AlertPack();
				ap.level = AlertLevel.ERROR;
				ap.objHash = pack.objHash;
				ap.title = "Ultron Error";
				ap.message = service + " - " + TextRD.getString(date, TextTypes.ERROR, pack.error);
				ap.time = System.currentTimeMillis();
				ap.objType = "scouter";
				alert(ap);
			}else{
				println("escape service : " + service);
			}
		}
	}
}
 
开发者ID:kingbbode,项目名称:scouter-plugin-server-alert-teamup,代码行数:24,代码来源:TeamUpPlugin.java


示例2: xlog

import scouter.lang.pack.XLogPack; //导入依赖的package包/类
/**
   * XLogPack 발생 시 처리
   * @param pack
   */
  @ServerPlugin(PluginConstants.PLUGIN_SERVER_XLOG)
  public void xlog(XLogPack pack) {
  	try {
   	if (serviceStatMap.get(pack.objHash) == null) {
   		serviceStatMap.put(pack.objHash, new ConcurrentHashMap<Integer, ServiceStat>());
   	}
   	
   	if (serviceStatMap.get(pack.objHash).get(pack.service) == null) {
   		serviceStatMap.get(pack.objHash).put(pack.service, new ServiceStat(pack.objHash, pack.service));
   	}

   	String serviceName = TextRD.getString(DateUtil.yyyymmdd(pack.endTime), TextTypes.SERVICE, pack.service);
  		InetAddress inetAddr = InetAddress.getByAddress(pack.ipaddr);
  		serviceStatMap.get(pack.objHash).get(pack.service).add(serviceName, pack.elapsed, pack.error != 0, inetAddr == null ? null : inetAddr.getHostAddress(), pack.userAgent, pack.sqlCount, pack.sqlTime);
} catch (Exception e) {
	Logger.printStackTrace(e);
}
  }
 
开发者ID:OpenSourceConsulting,项目名称:scouter-plugin-server-reporting,代码行数:23,代码来源:ReportingPlugin.java


示例3: xlog

import scouter.lang.pack.XLogPack; //导入依赖的package包/类
@ServerPlugin(PluginConstants.PLUGIN_SERVER_XLOG)
  public void xlog(XLogPack pack) {
  	try {
  		int elapsedThreshold = conf.getInt("ext_plugin_elapsed_time_threshold", 0);
  		
  		if (elapsedThreshold != 0 && pack.elapsed > elapsedThreshold) {
  			String serviceName = TextRD.getString(DateUtil.yyyymmdd(pack.endTime), TextTypes.SERVICE, pack.service);
  			
  			AlertPack ap = new AlertPack();
  			
        ap.level = AlertLevel.WARN;
        ap.objHash = pack.objHash;
        ap.title = "Elapsed time exceed a threshold.";
        ap.message = "[" + AgentManager.getAgentName(pack.objHash) + "] " 
        				+ pack.service + "(" + serviceName + ") "
        				+ "elapsed time(" + pack.elapsed + " ms) exceed a threshold.";
        ap.time = System.currentTimeMillis();
        ap.objType = AgentManager.getAgent(pack.objHash).objType;
		
        alert(ap);
  		}
  		
} catch (Exception e) {
	Logger.printStackTrace(e);
}
  }
 
开发者ID:scouter-project,项目名称:scouter-plugin-server-alert-email,代码行数:27,代码来源:EmailPlugin.java


示例4: getXLogData

import scouter.lang.pack.XLogPack; //导入依赖的package包/类
public static XLogData getXLogData(int serverId, String date, long txid) {
	TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
	try {
		MapPack param = new MapPack();
		param.put("date", date);
		param.put("txid", txid);
		Pack p = tcp.getSingle(RequestCmd.XLOG_READ_BY_TXID, param);
		if (p != null) {
			XLogPack xp = XLogUtil.toXLogPack(p);
			XLogData d = new XLogData(xp, serverId);
			d.objName = TextProxy.object.getLoadText(date, xp.objHash, serverId);
			d.serviceName = TextProxy.service.getLoadText(date, xp.service, serverId);
			return d;
		}
	} catch (Throwable th) {
		ConsoleProxy.errorSafe(th.toString());
	} finally {
		TcpProxy.putTcpProxy(tcp);
	}
	return null;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:22,代码来源:XLogProxy.java


示例5: getXLogData

import scouter.lang.pack.XLogPack; //导入依赖的package包/类
private XLogData getXLogData(int serverId, String date, long txid) {
	TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
	try {
		MapPack param = new MapPack();
		param.put("date", date);
		param.put("txid", txid);
		Pack p = tcp.getSingle(RequestCmd.XLOG_READ_BY_TXID, param);
		if (p != null) {
			XLogPack xp = XLogUtil.toXLogPack(p);
			XLogData d = new XLogData(xp, serverId);
			d.objName = TextProxy.object.getLoadText(date, xp.objHash, serverId);
			d.serviceName = TextProxy.service.getLoadText(date, xp.service, serverId);
			return d;
		}
	} catch (Throwable th) {
		ConsoleProxy.errorSafe(th.toString());
	} finally {
		TcpProxy.putTcpProxy(tcp);
	}
	return null;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:22,代码来源:OpenXLogProfileJob.java


示例6: preLoadDictionary

import scouter.lang.pack.XLogPack; //导入依赖的package包/类
private static void preLoadDictionary(XLogPack pack, int serverId) {
    TextLoader loader = new TextLoader(serverId);

    loader.addTextHash(TextTypeEnum.SERVICE, pack.service);
    loader.addTextHash(TextTypeEnum.HASH_MSG, pack.threadNameHash);
    loader.addTextHash(TextTypeEnum.ERROR, pack.error);
    loader.addTextHash(TextTypeEnum.USER_AGENT, pack.userAgent);
    loader.addTextHash(TextTypeEnum.REFERRER, pack.referer);
    loader.addTextHash(TextTypeEnum.GROUP, pack.group);
    loader.addTextHash(TextTypeEnum.CITY, pack.city);
    loader.addTextHash(TextTypeEnum.LOGIN, pack.login);
    loader.addTextHash(TextTypeEnum.DESC, pack.desc);
    loader.addTextHash(TextTypeEnum.HASH_MSG, pack.queuingHostHash);
    loader.addTextHash(TextTypeEnum.HASH_MSG, pack.queuing2ndHostHash);

    loader.loadAll();
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:18,代码来源:XLogData.java


示例7: getRealTimeXLogReader

import scouter.lang.pack.XLogPack; //导入依赖的package包/类
/**
 * get INetReader to make streaming output from realtime xlogs.
 *
 * @param jsonGenerator - low-level streaming json generator
 * @param countable - to keep xlog count
 * @return INetReader
 */
private INetReader getRealTimeXLogReader(JsonGenerator jsonGenerator, int[] countable) {
    return in -> {
        Pack p = in.readPack();
        if (p.getPackType() == PackEnum.MAP) { //meta data arrive ahead of xlog pack
            MapPack metaPack = (MapPack) p;
            jsonGenerator.writeNumberField("xlogLoop", metaPack.getInt(ParamConstant.OFFSET_LOOP));
            jsonGenerator.writeNumberField("xlogIndex", metaPack.getInt(ParamConstant.OFFSET_INDEX));
            jsonGenerator.writeArrayFieldStart("xlogs");
        } else {
            XLogPack xLogPack = (XLogPack) p;
            jsonGenerator.writeObject(SXLog.of(xLogPack));
            countable[0]++;
        }
    };
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:23,代码来源:XLogController.java


示例8: getPageableXLogReader

import scouter.lang.pack.XLogPack; //导入依赖的package包/类
/**
 * get INetReader to make streaming output from xlogs.
 *
 * @param jsonGenerator - low-level streaming json generator
 * @return INetReader
 */
private INetReader getPageableXLogReader(JsonGenerator jsonGenerator) {
    int[] countable = {0};

    return in -> {
        Pack p = in.readPack();
        if (p.getPackType() != PackEnum.MAP) { // XLogPack case
            XLogPack xLogPack = (XLogPack) p;
            jsonGenerator.writeObject(SXLog.of(xLogPack));
            countable[0]++;
        } else { // MapPack case (//meta data arrive followed by xlog pack)
            jsonGenerator.writeEndArray();

            MapPack metaPack = (MapPack) p;
            jsonGenerator.writeBooleanField("hasMore", metaPack.getBoolean(ParamConstant.XLOG_RESULT_HAS_MORE));
            jsonGenerator.writeNumberField("lastTxid", metaPack.getLong(ParamConstant.XLOG_RESULT_LAST_TXID));
            jsonGenerator.writeNumberField("lastXLogTime", metaPack.getLong(ParamConstant.XLOG_RESULT_LAST_TIME));
            jsonGenerator.writeNumberField("count", countable[0]);
        }
    };
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:27,代码来源:XLogController.java


示例9: getPageableXLogReader

import scouter.lang.pack.XLogPack; //导入依赖的package包/类
/**
 * get INetReader to make streaming output from xlogs.
 *
 * @param jsonGenerator - low-level streaming json generator
 * @param serverId - serverId (needs for retrieving dictionary text)
 * @return INetReader
 */
private INetReader getPageableXLogReader(JsonGenerator jsonGenerator, int serverId) {
    int[] countable = {0};

    return in -> {
        Pack p = in.readPack();
        if (p.getPackType() != PackEnum.MAP) { // XLogPack case
            XLogPack xLogPack = (XLogPack) p;
            jsonGenerator.writeObject(XLogData.of(xLogPack, serverId));
            countable[0]++;
        } else { // MapPack case (//meta data arrive followed by xlog pack)
            jsonGenerator.writeEndArray();

            MapPack metaPack = (MapPack) p;
            jsonGenerator.writeBooleanField("hasMore", metaPack.getBoolean(ParamConstant.XLOG_RESULT_HAS_MORE));
            jsonGenerator.writeNumberField("lastTxid", metaPack.getLong(ParamConstant.XLOG_RESULT_LAST_TXID));
            jsonGenerator.writeNumberField("lastXLogTime", metaPack.getLong(ParamConstant.XLOG_RESULT_LAST_TIME));
            jsonGenerator.writeNumberField("count", countable[0]);
        }
    };
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:28,代码来源:XLogDataController.java


示例10: txperf

import scouter.lang.pack.XLogPack; //导入依赖的package包/类
public static XLogPack txperf(long endtime, long txid, int service_hash, String serviceName, int elapsed, int cpu,
                              int sqlCount, int sqlTime, String remoteAddr, String error, long visitor) {
    XLogPack pack = new XLogPack();
    pack.cpu = cpu;
    pack.endTime = endtime;
    pack.elapsed = elapsed;
    DataProxy.sendServiceName(service_hash, serviceName);
    pack.service = service_hash;
    pack.kbytes = 0;
    pack.status = 0;
    pack.sqlCount = sqlCount;
    pack.sqlTime = sqlTime;
    pack.txid = txid;
    pack.ipaddr = IPUtil.toBytes(remoteAddr);
    pack.userid = visitor;
    if (error != null) {
        pack.error = DataProxy.sendError(error);
    }
    MeterService.getInstance().add(pack.elapsed, pack.sqlTime, pack.apicallTime, pack.queuingTime, error != null);
    DataProxy.sendXLog(pack);
    MeterUsers.add(pack.userid);
    return pack;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:24,代码来源:TraceMain.java


示例11: process

import scouter.lang.pack.XLogPack; //导入依赖的package包/类
public void process(XLogPack p) {
	if (conf.summary_enabled == false)
		return;
	// service summary
	SummaryData d = getSummaryMap(serviceMaster, p.service);
	d.count++;
	d.elapsed += p.elapsed;
	if (p.error != 0) {
		d.error_cnt++;
	}
	d.cpu += p.cpu;
	d.mem += p.kbytes;

	// ip summary
	if (IPUtil.isOK(p.ipaddr) && p.ipaddr[0] != 0 && p.ipaddr[0] != 127) {
		int ip = DataInputX.toInt(p.ipaddr, 0);
		ipMaster.put(ip, ipMaster.get(ip) + 1);
	}
	// user-agent summary
	if (p.userAgent != 0) {
		uaMaster.put(p.userAgent, uaMaster.get(p.userAgent) + 1);
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:24,代码来源:ServiceSummary.java


示例12: objType

import scouter.lang.pack.XLogPack; //导入依赖的package包/类
public String objType(XLogPack p) {
	ObjectPack a = AgentManager.getAgent(p.objHash);
	if (a != null) {
		return a.objType;
	}
	return null;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:8,代码来源:IXLog.java


示例13: xlog

import scouter.lang.pack.XLogPack; //导入依赖的package包/类
public static void xlog(XLogPack m) {
       BuiltInPluginManager.invokeAllPlugins(PluginConstants.PLUGIN_SERVER_XLOG, m);

	if (xlog != null) {
		try {
			xlog.process(m);
		} catch (Throwable t) {
			Logger.printStackTrace("PL001", t);
		}
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:12,代码来源:PlugInManager.java


示例14: xlogdb

import scouter.lang.pack.XLogPack; //导入依赖的package包/类
public static void xlogdb(XLogPack m) {
	if (xlogdb != null) {
		try {
			xlogdb.process(m);
		} catch (Throwable t) {
			Logger.printStackTrace("PL002", t);
		}
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:10,代码来源:PlugInManager.java


示例15: initLayout

import scouter.lang.pack.XLogPack; //导入依赖的package包/类
private void initLayout() {
	parent.setLayout(new FillLayout());
	Composite comp = new Composite(parent, SWT.NONE);
	tableColumnLayout = new TableColumnLayout();
	comp.setLayout(tableColumnLayout);
	viewer = new TableViewer(comp, SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
	createColumns();
	final Table table = viewer.getTable();
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setComparator(new TableLabelSorter(viewer));
    viewer.addDoubleClickListener(new IDoubleClickListener() {
		public void doubleClick(DoubleClickEvent e) {
			StructuredSelection sel = (StructuredSelection) viewer.getSelection();
			Object o = sel.getFirstElement();
			if (o instanceof XLogPack) {
				XLogPack data = (XLogPack) o;
				XLogData d = new XLogData(data, serverId);
				d.objName = TextProxy.object.getLoadText(yyyymmdd, data.objHash, serverId);
				d.serviceName = TextProxy.service.getLoadText(yyyymmdd, data.service, serverId);
				new OpenXLogProfileJob(ServiceTableComposite.this.getDisplay(), d, serverId).schedule();
			} else {
				System.out.println(o);
			}
		}
	});
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:29,代码来源:ServiceTableComposite.java


示例16: setInput

import scouter.lang.pack.XLogPack; //导入依赖的package包/类
public void setInput(ArrayList<Pack> packList, int serverId, String date) {
	this.serverId = serverId;
	this.yyyymmdd = date;
	ArrayList<Integer> serverHashes = new ArrayList<Integer>(packList.size());
	for (Pack p : packList) {
		XLogPack xp = (XLogPack) p;
		serverHashes.add(xp.service);
	}
	TextProxy.service.load(yyyymmdd, serverHashes, serverId);
	viewer.setInput(packList);
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:12,代码来源:ServiceTableComposite.java


示例17: getForeground

import scouter.lang.pack.XLogPack; //导入依赖的package包/类
public Color getForeground(Object element) {
	if (element instanceof XLogPack) {
		XLogPack d = (XLogPack) element;
		if (d.error != 0) {
			return ColorUtil.getInstance().getColor("red");
		}
	}
	return null;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:10,代码来源:ServiceTableComposite.java


示例18: getColumnText

import scouter.lang.pack.XLogPack; //导入依赖的package包/类
public String getColumnText(Object element, int columnIndex) {
	if (element instanceof XLogPack == false) {
		return null;
	} 
	XLogPack p = (XLogPack) element;
	XLogColumnEnum column = columnList.get(columnIndex);
	switch (column) {
	case OBJECT :
		return TextProxy.object.getLoadText(yyyymmdd, p.objHash, serverId);
	case ELAPSED :
		return FormatUtil.print(p.elapsed, "#,##0");
	case SERVICE :
		return TextProxy.service.getLoadText(yyyymmdd, p.service, serverId);
	case START_TIME :
		return FormatUtil.print(new Date(p.endTime - p.elapsed), "HH:mm:ss.SSS");
	case END_TIME :
		return FormatUtil.print(new Date(p.endTime), "HH:mm:ss.SSS");
	case TX_ID :
		return Hexa32.toString32(p.txid);
	case CPU :
		return FormatUtil.print(p.cpu, "#,##0");
	case SQL_COUNT :
		return FormatUtil.print(p.sqlCount, "#,##0");
	case SQL_TIME :
			return FormatUtil.print(p.sqlTime, "#,##0");
	case KBYTES :
			return FormatUtil.print(p.kbytes, "#,##0");
	case IP :
			return IPUtil.toString(p.ipaddr);
	case ERROR :
		return p.error == 0 ? "" : TextProxy.error.getLoadText(yyyymmdd, p.error, serverId);
	case GX_ID :
		return Hexa32.toString32(p.gxid);
	}
	return null;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:37,代码来源:ServiceTableComposite.java


示例19: run

import scouter.lang.pack.XLogPack; //导入依赖的package包/类
protected IStatus run(IProgressMonitor monitor) {
	monitor.beginTask("Find " + Hexa32.toString32(gxid), IProgressMonitor.UNKNOWN);
	final LongKeyLinkedMap<Object> xlogMap = new LongKeyLinkedMap<Object>();
	Iterator<Integer> itr = ServerManager.getInstance().getOpenServerList().iterator();
	while (itr.hasNext()) {
		final int serverId = itr.next();
		monitor.subTask(ServerManager.getInstance().getServer(serverId).getName());
		TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
		try {
			MapPack param = new MapPack();
			param.put("date", date);
			param.put("gxid", gxid);
			tcp.process(RequestCmd.XLOG_READ_BY_GXID, param, new INetReader() {
				public void process(DataInputX in) throws IOException {
					Pack p = in.readPack();
					XLogPack xlog = XLogUtil.toXLogPack(p);
					XLogData d = new XLogData(xlog, serverId);
					d.objName = TextProxy.object.getLoadText(date, d.p.objHash, d.serverId);
					xlogMap.putFirst(xlog.txid, d);
				}
			});
		} catch (Throwable th) {
			ConsoleProxy.errorSafe(th.toString());
		} finally {
			TcpProxy.putTcpProxy(tcp);
		}
	}
	ExUtil.exec(viewer.getGraphControl(), new Runnable() {
		public void run() {
			viewer.setInput(xlogMap);
		}
	});
	return Status.OK_STATUS;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:35,代码来源:XLogCallView.java


示例20: loadAdditinalData

import scouter.lang.pack.XLogPack; //导入依赖的package包/类
public void loadAdditinalData(long stime, long etime, final boolean reverse) {
	int max = getMaxCount();
	TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
	try {
		MapPack param = new MapPack();
		String date = DateUtil.yyyymmdd(stime);
		param.put("date", date);
		param.put("stime", stime);
		param.put("etime", etime);
		param.put("objHash", agnetProxy.getObjHashLv(date, serverId, objType));
		param.put("reverse", new BooleanValue(reverse));
		int limit = PManager.getInstance().getInt(PreferenceConstants.P_XLOG_IGNORE_TIME);
		if (limit > 0) {
			param.put("limit", limit);
		}
		if (max > 0) {
			param.put("max", max);
		}
		twdata.setMax(max);
		tcp.process(RequestCmd.TRANX_LOAD_TIME_GROUP, param, new INetReader() {
			public void process(DataInputX in) throws IOException {
				Pack p = in.readPack();
				XLogPack x = XLogUtil.toXLogPack(p);
				if (reverse) {				
					twdata.putFirst(x.txid, new XLogData(x, serverId));
				} else {
					twdata.putLast(x.txid, new XLogData(x, serverId));
				}
			}
		});
	} catch (Throwable t) {
		ConsoleProxy.errorSafe(t.toString());
	} finally {
		TcpProxy.putTcpProxy(tcp);
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:37,代码来源:XLogLoadTimeView.java



注:本文中的scouter.lang.pack.XLogPack类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Dispatcher类代码示例发布时间:2022-05-22
下一篇:
Java ImagePlusImgFactory类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap