TracerUtils { public static LogReserveConfig parseLogReserveConfig(String logReserveConfig) { if (StringUtils.isBlank(logReserveConfig)) { return new LogReserveConfig(SofaTracerConfiguration.DEFAULT_LOG_RESERVE_DAY, 0); } int day; int hour = 0; int dayIndex = logReserveConfig.indexOf("D"); if (dayIndex >= 0) { day = Integer.valueOf(logReserveConfig.substring(0, dayIndex)); } else { day = Integer.valueOf(logReserveConfig); } int hourIndex = logReserveConfig.indexOf("H"); if (hourIndex >= 0) { hour = Integer.valueOf(logReserveConfig.substring(dayIndex + 1, hourIndex)); } return new LogReserveConfig(day, hour); }  static String getTraceId(); static boolean checkBaggageLength(SofaTracerSpan sofaTracerSpan, String key, String value); static int getSysBaggageMaxLength(); static int getBaggageMaxLength(); static String getPID(); static LogReserveConfig parseLogReserveConfig(String logReserveConfig); static boolean isLoadTest(SofaTracerSpan sofaTracerSpan); static String getLoadTestMark(SofaTracerSpan span); static String getInetAddress(); static String removeJSessionIdFromUrl(String url); static String getCurrentZone(); static String getDefaultTimeZone(); static String getEmptyStringIfNull(Map<String, String> map, String key); static String hostToHexString(String host); static final String KEY_OF_CURRENT_ZONE; static final String CURRENT_ZONE; static String P_ID_CACHE; }
@Test public void testParseLogRetentionTimeConfig() { LogReserveConfig logReserveConfig = TracerUtils.parseLogReserveConfig("0D1H"); Assert.assertEquals(0, logReserveConfig.getDay()); Assert.assertEquals(1, logReserveConfig.getHour()); }
@Test public void testParseLogReserveConfigByNumber() { LogReserveConfig logReserveConfig = TracerUtils.parseLogReserveConfig("7"); Assert.assertEquals(7, logReserveConfig.getDay()); Assert.assertEquals(0, logReserveConfig.getHour()); }