老板以为你的写Hello World程序
public static void main(String[] args){
System.out.println("hello "+args[0]);
}
程序员写的Hello World程序
public static void main(String[] args){
if(ags.length==0){
log.error("ags is null");//记录日志
Metric.submitEvent("hello-world-ags-error");
return ;
}
if(ags.length>1){
log.error("ags is "+Arrays.asList(ags));
//继续执行
}
Metric helloMetric = Metric.of("hello-world");
try{
helloMetric.start();
System.out.println("hello "+args[0]);
log.info("hello world success "+args[0]);
}catch(Exception ex){
if(MyRatelimiter.tryAcquire()){
//阻止大量error日志打爆磁盘
log.error("helloworld error ",ex);
}
//TODO 如何降级处理?
helloMetric.error(ex.getMessage());
}finally{
helloMetric.end();
}
}
知道合格程序员为啥这么累了吧😂