public ContextData beforeInvoke(Identification id) {
    try {
      Span spanData = ContextGenerator.generateSpanFromThreadLocal(id);
      // 设置SpanType的类型
      spanData.setTag(Tag.SPAN_TYPE, SpanType.RPC_CLIENT);

      if (Config.BuriedPoint.PRINTF) {
        logger.debug(
            "TraceId:"
                + spanData.getTraceId()
                + "\tParentLevelId:"
                + spanData.getParentLevel()
                + "\tLevelId:"
                + spanData.getLevelId()
                + "\tbusinessKey:"
                + spanData.getBusinessKey());
      }

      CurrentThreadSpanStack.push(spanData);

      sendRequestSpan(spanData, id);

      return new ContextData(
          spanData.getTraceId(), generateSubParentLevelId(spanData), spanData.getRouteKey());
    } catch (Throwable t) {
      logger.error(t.getMessage(), t);
      return new EmptyContextData();
    }
  }
 public void send(String alarmKey, String traceId, String message) {
   Jedis jedis = null;
   try {
     jedis = AlarmRedisConnector.getJedis();
     if (jedis != null) return;
     jedis.hsetnx(alarmKey, traceId, message);
     jedis.expire(alarmKey, Config.Alarm.ALARM_EXPIRE_SECONDS);
   } catch (Exception e) {
     AlarmRedisConnector.reportJedisFailure();
     logger.error("Failed to set data.", e);
   } finally {
     if (jedis != null) {
       jedis.close();
     }
   }
 }
  protected void occurException(Throwable th) {
    try {
      if (exclusiveExceptionSet == null) {
        Set<String> exclusiveExceptions = new HashSet<String>();

        String[] exceptions = Config.BuriedPoint.EXCLUSIVE_EXCEPTIONS.split(EXCEPTION_SPLIT);
        for (String exception : exceptions) {
          exclusiveExceptions.add(exception);
        }
        exclusiveExceptionSet = exclusiveExceptions;
      }

      Span span = CurrentThreadSpanStack.peek();
      span.handleException(
          th, exclusiveExceptionSet, Config.BuriedPoint.MAX_EXCEPTION_STACK_LENGTH);
    } catch (Throwable t) {
      easyLogger.error(t.getMessage(), t);
    }
  }
  protected void afterInvoke() {
    try {

      // 弹出上下文的栈顶中的元素
      Span spanData = CurrentThreadSpanStack.pop();

      if (Config.BuriedPoint.PRINTF) {
        easyLogger.debug(
            "TraceId-ACK:"
                + spanData.getTraceId()
                + "\tParentLevelId:"
                + spanData.getParentLevel()
                + "\tLevelId:"
                + spanData.getLevelId()
                + "\tbusinessKey:"
                + spanData.getBusinessKey());
      }

      sendAckSpan(spanData);
    } catch (Throwable t) {
      easyLogger.error(t.getMessage(), t);
    }
  }