当前位置: 首页>>代码示例>>Java>>正文


Java AlertPack类代码示例

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


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

示例1: xlog

import scouter.lang.pack.AlertPack; //导入依赖的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.AlertPack; //导入依赖的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

示例3: alert

import scouter.lang.pack.AlertPack; //导入依赖的package包/类
public static void alert(byte level, RealCounter c, String title, String message) {
	long now = System.currentTimeMillis();
	if (c.silentTime() > 0) {
		if (now < c.lastAlertTime(level) + c.silentTime() * 1000)
			return;
	}
	AlertPack p = new AlertPack();
	p.time = now;
	p.level = level;
	p.objHash = c.objHash();
	p.objType = c.objType();
	p.title = title;
	p.message = message;
	c.setAlertTime(level, now);
	AlertCore.add(p);
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:17,代码来源:AlertUtil.java

示例4: ariseAlert

import scouter.lang.pack.AlertPack; //导入依赖的package包/类
public void ariseAlert(final int serverId, final AlertPack alert) {
	ExUtil.exec(table, new Runnable() {
		public void run() {
			while (table.getItemCount() > 500) {
				table.remove(table.getItemCount() - 1);
			}
			AlertData data = new AlertData(serverId, alert);
			TableItem t = new TableItem(table, SWT.NONE, 0);
			t.setText(new String[] { //
					FormatUtil.print(new Date(alert.time), "HH:mm:ss.SSS"),
					AlertLevel.getName(alert.level), //
					alert.title, //
					alert.message,//
					TextProxy.object.getLoadText(DateUtil.yyyymmdd(TimeUtil.getCurrentTime()), data.p.objHash, serverId),//
			});
			t.setData(data);
		}
	});
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:20,代码来源:AlertView.java

示例5: getColumnText

import scouter.lang.pack.AlertPack; //导入依赖的package包/类
public String getColumnText(Object element, int columnIndex) {
	if (element instanceof AlertPack == false) {
		return null;
	} 
	AlertPack p = (AlertPack) element;
	AlertColumnEnum column = columnList.get(columnIndex);
	switch (column) {
	case TIME :
		return DateUtil.format(p.time, "HH:mm:ss.SSS");
	case LEVEL :
		return AlertLevel.getName(p.level);
	case OBJECT :
		return TextProxy.object.getLoadText(yyyymmdd, p.objHash, serverId);
	case TITLE :
		return p.title;
	case MESSAGE :
		return p.message;
	case TAGS :
		return p.tags.toString();
	}
	return null;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:23,代码来源:AlertTableComposite.java

示例6: endPut

import scouter.lang.pack.AlertPack; //导入依赖的package包/类
public static void endPut(Map map) {
    int size = map.size();
    if(size > 0 && size % conf._hook_map_impl_warning_size == 0) {
        TraceContext ctx = TraceContextManager.getContext();

        if(ctx == null) return;
        if(ctx.error != 0) return;

        MapValue mv = new MapValue();
        mv.put(AlertPack.HASH_FLAG + TextTypes.SERVICE + "_service-name", ctx.serviceHash);
        String message = "Too many Map entries!\n" + ThreadUtil.getStackTrace(Thread.currentThread().getStackTrace(), 2);
        HashedMessageStep step = new HashedMessageStep();
        step.hash = DataProxy.sendHashedMessage(message);
        step.value = size;
        step.start_time = (int) (System.currentTimeMillis() - ctx.startTime);
        ctx.profile.add(step);
        mv.put(AlertPack.HASH_FLAG + TextTypes.HASH_MSG + "_full-stack", step.hash);

        DataProxy.sendAlert(AlertLevel.WARN, "TOO_MANY_MAP_ENTRIES", "too many Map entries, over #" + size, mv);
        int errorMessageHash = DataProxy.sendError("too many Map entries, over #" + size);
        if (ctx.error == 0) {
            ctx.error = errorMessageHash;
        }
        ctx.offerErrorEntity(ErrorEntity.of(tooManyCollectionMemebers, errorMessageHash, 0, 0));
    }
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:27,代码来源:TraceCollection.java

示例7: alert

import scouter.lang.pack.AlertPack; //导入依赖的package包/类
@Test
public void alert() throws Exception {
    when(conf.getValue("ext_plugin_line_access_token")).thenReturn(lineAccessToken);
    when(conf.getValue("ext_plugin_line_group_id")).thenReturn(lineGroupId);
    when(conf.getBoolean(eq("ext_plugin_line_send_alert"), anyBoolean())).thenReturn(true);

    AlertPack ap = genAlertPack();
    plugin.alert(ap);

    Thread.sleep(10000);
}
 
开发者ID:scouter-project,项目名称:scouter-plugin-server-alert-line,代码行数:12,代码来源:LinePluginTest.java

示例8: genAlertPack

import scouter.lang.pack.AlertPack; //导入依赖的package包/类
private static AlertPack genAlertPack() {
    AlertPack ap = new AlertPack();

    ap.level = AlertLevel.WARN;
    ap.objHash = 100;
    ap.title = "Elapsed time exceed a threshold.";
    ap.message = "[100 agent] exceed a threshold";
    ap.time = System.currentTimeMillis();
    ap.objType = "someObjecttype";

    return ap;
}
 
开发者ID:scouter-project,项目名称:scouter-plugin-server-alert-line,代码行数:13,代码来源:LinePluginTest.java

示例9: alert

import scouter.lang.pack.AlertPack; //导入依赖的package包/类
@Internal
public void alert(byte level, int objHash, String objType, String title, String message) {
	AlertPack p = new AlertPack();
	p.time = System.currentTimeMillis();
	p.level = level;
	p.objHash = objHash;
	p.objType = objType;
	p.title = title;
	p.message = message;
	AlertCore.add(p);
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:12,代码来源:PluginHelper.java

示例10: alert

import scouter.lang.pack.AlertPack; //导入依赖的package包/类
public static void alert(AlertPack p) {
       BuiltInPluginManager.invokeAllPlugins(PluginConstants.PLUGIN_SERVER_ALERT, p);

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

示例11: toPack

import scouter.lang.pack.AlertPack; //导入依赖的package包/类
public AlertPack toPack() {
	AlertPack pack = new AlertPack();
	pack.level = AlertLevel.getValue(level);
	pack.message = message;
	pack.objHash = object == null ? 0 : HashUtil.hash(object);
	pack.objType = objType;
	pack.tags = tags;
	pack.time = time;
	pack.title = title;
	return pack;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:12,代码来源:AlertDetailListView.java

示例12: initLayout

import scouter.lang.pack.AlertPack; //导入依赖的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 AlertPack) {
				String objName = TextProxy.object.getLoadText(yyyymmdd, ((AlertPack) o).objHash, serverId);
				AlertNotifierDialog alertDialog = new AlertNotifierDialog(parent.getDisplay(), serverId);
				alertDialog.setObjName(objName);
				alertDialog.setPack((AlertPack) o);
				alertDialog.show(parent.getBounds());
			} else {
				System.out.println(o);
			}
		}
	});
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:29,代码来源:AlertTableComposite.java

示例13: of

import scouter.lang.pack.AlertPack; //导入依赖的package包/类
public static SAlert of(AlertPack p) {
    Map<String, Object> tagMap = p.tags.toMap().entrySet().stream()
            .collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue().toJavaObject()));

    return SAlert.builder()
            .time(p.time)
            .objType(p.objType)
            .objHash(p.objHash)
            .objName(AgentModelThread.getInstance().getAgentObject(p.objHash).getObjName())
            .level(AlertLevelEnum.of(p.level))
            .title(p.title)
            .message(p.message)
            .tagMap(tagMap)
            .build();
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:16,代码来源:SAlert.java

示例14: retrieveRealTimeAlert

import scouter.lang.pack.AlertPack; //导入依赖的package包/类
public RealTimeAlertView retrieveRealTimeAlert(final RealTimeAlertRequest request) {
	MapPack paramPack = new MapPack();
	paramPack.put(ParamConstant.OFFSET_LOOP, request.getLoop());
	paramPack.put(ParamConstant.OFFSET_INDEX, request.getIndex());
	paramPack.put(ParamConstant.OBJ_TYPE, request.getObjType());

	RealTimeAlertView alertView = new RealTimeAlertView();
	List<SAlert> alertList = new ArrayList<>();
	alertView.setAlerts(alertList);

	try (TcpProxy tcpProxy = TcpProxy.getTcpProxy(request.getServerId())) {
		tcpProxy.process(RequestCmd.ALERT_REAL_TIME, paramPack, in -> {
			Pack packet = in.readPack();
			if (packet instanceof MapPack) {
				MapPack metaPack = (MapPack) packet;
				alertView.setOffset1(metaPack.getLong(ParamConstant.OFFSET_LOOP));
				alertView.setOffset1(metaPack.getInt(ParamConstant.OFFSET_INDEX));

			} else {
				AlertPack alertPack = (AlertPack) packet;
				alertList.add(SAlert.of(alertPack));
			}
		});
	}

	return alertView;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:28,代码来源:AlertConsumer.java

示例15: checkDelayedService

import scouter.lang.pack.AlertPack; //导入依赖的package包/类
public void checkDelayedService(XLogPack pack, String serviceName) {
	if (stopChecking) {
		Logger.println("SA-2003", "Pass delayed checking... " + Hexa32.toString32(pack.txid));
		return;
	}
	DelayedCondition condition = conditionMap.get(pack.service);
	if (condition != null && pack.elapsed > condition.time) {
		StringBuilder msg = new StringBuilder();
		msg.append(serviceName + System.getProperty("line.separator"));
		msg.append(pack.elapsed + " ms (SET:" + condition.time + " ms)" + System.getProperty("line.separator"));
		msg.append("ID = " + Hexa32.toString32(pack.txid));
		MapValue tags = null;
		if (pack.error != 0) {
			tags = new MapValue();
			tags.put(AlertPack.HASH_FLAG + TextTypes.ERROR + "_error", pack.error);
		}
		StringBuilder titleSb = new StringBuilder();
		titleSb.append("DELAYED_SERVICE");
		if (serviceName != null && serviceName.length() > 15) {
			titleSb.append("(...");
			titleSb.append(serviceName.substring(serviceName.length() - 10));
			titleSb.append(")");
		} else {
			titleSb.append("(");
			titleSb.append(serviceName);
			titleSb.append(")");
		}
		AlertProxy.sendAlert(AlertLevel.WARN, titleSb.toString(), msg.toString(), tags);
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:31,代码来源:DelayedServiceManager.java


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