1. 将Span的数据分隔符改成特殊字符

2. 加入配置校验功能
This commit is contained in:
zhangxin10 2015-12-01 16:50:31 +08:00
parent 5826dcdbe5
commit 0d96cf11d3
5 changed files with 33 additions and 3 deletions

View File

@ -2,6 +2,7 @@ package com.ai.cloud.skywalking.buffer;
import com.ai.cloud.skywalking.conf.Config;
import com.ai.cloud.skywalking.conf.Constants;
import com.ai.cloud.skywalking.protocol.Span;
import com.ai.cloud.skywalking.selfexamination.HealthCollector;
import com.ai.cloud.skywalking.selfexamination.HeathReading;
@ -76,7 +77,7 @@ public class BufferGroup {
data = new StringBuilder();
}
data.append(dataBuffer[i] + ";");
data.append(dataBuffer[i] + Constants.DATA_SPILT);
dataBuffer[i] = null;
}

View File

@ -5,6 +5,7 @@ public class AuthDesc {
static {
ConfigInitializer.initialize();
ConfigValidator.validate();
}
public static boolean isAuth() {

View File

@ -30,7 +30,7 @@ public class Config {
public static class Buffer {
// 每个Buffer的最大个数
public static int BUFFER_MAX_SIZE = 18000;
public static int BUFFER_MAX_SIZE = 20000;
// Buffer池的最大长度
public static int POOL_SIZE = 5;
@ -47,7 +47,7 @@ public class Config {
public static boolean IS_OFF = false;
// 发送的最大长度
public static int MAX_SEND_LENGTH = 1800;
public static int MAX_SEND_LENGTH = 18500;
public static long RETRY_GET_SENDER_WAIT_INTERVAL = 2000L;

View File

@ -0,0 +1,26 @@
package com.ai.cloud.skywalking.conf;
public class ConfigValidator {
private ConfigValidator() {
// Non
}
public static boolean validate() {
if (!validateSendMaxLength()) {
throw new IllegalArgumentException("Max send length must great than the sum of the maximum " +
"length of sending exception stack and the maximum length of sending business key.");
}
return true;
}
private static boolean validateSendMaxLength() {
if (Config.Sender.MAX_SEND_LENGTH < (Config.BuriedPoint.MAX_EXCEPTION_STACK_LENGTH +
Config.BuriedPoint.BUSINESSKEY_MAX_LENGTH)) {
return false;
}
return true;
}
}

View File

@ -3,4 +3,6 @@ package com.ai.cloud.skywalking.conf;
public class Constants {
public static final String HEALTH_DATA_SPILT_PATTERN = "^~";
public static final String DATA_SPILT = ",";
}