code
stringlengths 23
201k
| docstring
stringlengths 17
96.2k
| func_name
stringlengths 0
235
| language
stringclasses 1
value | repo
stringlengths 8
72
| path
stringlengths 11
317
| url
stringlengths 57
377
| license
stringclasses 7
values |
|---|---|---|---|---|---|---|---|
public Set<String> getExcludeServiceOperations() {
return excludeServiceOperations;
}
|
DynamicClass retransform rules:
1. addEntity: all entity of the same class of the added entity class need to be set to retransform
2. resetEntity: resetEntityClassSet only contains the class not in newDynamicClassList
ex: oldDynamicClassList: ClassA methodA, ClassB methodB, ClassC methodC
newDynamicClassList: ClassA methodA, ClassA methodA2, ClassB methodB2
addEntityClassSet: ClassA, ClassB
resetEntityClassSet: ClassC
retransform: ClassA: methodA, methodA2, ClassB methodB2
|
getExcludeServiceOperations
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
Apache-2.0
|
public boolean isAgentEnabled() {
return agentEnabled;
}
|
DynamicClass retransform rules:
1. addEntity: all entity of the same class of the added entity class need to be set to retransform
2. resetEntity: resetEntityClassSet only contains the class not in newDynamicClassList
ex: oldDynamicClassList: ClassA methodA, ClassB methodB, ClassC methodC
newDynamicClassList: ClassA methodA, ClassA methodA2, ClassB methodB2
addEntityClassSet: ClassA, ClassB
resetEntityClassSet: ClassC
retransform: ClassA: methodA, methodA2, ClassB methodB2
|
isAgentEnabled
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
Apache-2.0
|
public void setAgentEnabled(boolean agentEnabled) {
this.agentEnabled = agentEnabled;
}
|
DynamicClass retransform rules:
1. addEntity: all entity of the same class of the added entity class need to be set to retransform
2. resetEntity: resetEntityClassSet only contains the class not in newDynamicClassList
ex: oldDynamicClassList: ClassA methodA, ClassB methodB, ClassC methodC
newDynamicClassList: ClassA methodA, ClassA methodA2, ClassB methodB2
addEntityClassSet: ClassA, ClassB
resetEntityClassSet: ClassC
retransform: ClassA: methodA, methodA2, ClassB methodB2
|
setAgentEnabled
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
Apache-2.0
|
public String getMessage() {
return message;
}
|
DynamicClass retransform rules:
1. addEntity: all entity of the same class of the added entity class need to be set to retransform
2. resetEntity: resetEntityClassSet only contains the class not in newDynamicClassList
ex: oldDynamicClassList: ClassA methodA, ClassB methodB, ClassC methodC
newDynamicClassList: ClassA methodA, ClassA methodA2, ClassB methodB2
addEntityClassSet: ClassA, ClassB
resetEntityClassSet: ClassC
retransform: ClassA: methodA, methodA2, ClassB methodB2
|
getMessage
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
Apache-2.0
|
public void setMessage(String message) {
this.message = message;
}
|
DynamicClass retransform rules:
1. addEntity: all entity of the same class of the added entity class need to be set to retransform
2. resetEntity: resetEntityClassSet only contains the class not in newDynamicClassList
ex: oldDynamicClassList: ClassA methodA, ClassB methodB, ClassC methodC
newDynamicClassList: ClassA methodA, ClassA methodA2, ClassB methodB2
addEntityClassSet: ClassA, ClassB
resetEntityClassSet: ClassC
retransform: ClassA: methodA, methodA2, ClassB methodB2
|
setMessage
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
Apache-2.0
|
public void setDubboStreamReplayThreshold(String dubboStreamReplayThreshold) {
this.dubboStreamReplayThreshold = Integer.parseInt(dubboStreamReplayThreshold);
}
|
DynamicClass retransform rules:
1. addEntity: all entity of the same class of the added entity class need to be set to retransform
2. resetEntity: resetEntityClassSet only contains the class not in newDynamicClassList
ex: oldDynamicClassList: ClassA methodA, ClassB methodB, ClassC methodC
newDynamicClassList: ClassA methodA, ClassA methodA2, ClassB methodB2
addEntityClassSet: ClassA, ClassB
resetEntityClassSet: ClassC
retransform: ClassA: methodA, methodA2, ClassB methodB2
|
setDubboStreamReplayThreshold
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
Apache-2.0
|
public int getDubboStreamReplayThreshold() {
return dubboStreamReplayThreshold;
}
|
DynamicClass retransform rules:
1. addEntity: all entity of the same class of the added entity class need to be set to retransform
2. resetEntity: resetEntityClassSet only contains the class not in newDynamicClassList
ex: oldDynamicClassList: ClassA methodA, ClassB methodB, ClassC methodC
newDynamicClassList: ClassA methodA, ClassA methodA2, ClassB methodB2
addEntityClassSet: ClassA, ClassB
resetEntityClassSet: ClassC
retransform: ClassA: methodA, methodA2, ClassB methodB2
|
getDubboStreamReplayThreshold
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
Apache-2.0
|
public Map<String, String> getExtendField() {
return extendField;
}
|
DynamicClass retransform rules:
1. addEntity: all entity of the same class of the added entity class need to be set to retransform
2. resetEntity: resetEntityClassSet only contains the class not in newDynamicClassList
ex: oldDynamicClassList: ClassA methodA, ClassB methodB, ClassC methodC
newDynamicClassList: ClassA methodA, ClassA methodA2, ClassB methodB2
addEntityClassSet: ClassA, ClassB
resetEntityClassSet: ClassC
retransform: ClassA: methodA, methodA2, ClassB methodB2
|
getExtendField
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
Apache-2.0
|
public void setExtendField(Map<String, String> extendField) {
this.extendField = extendField;
}
|
DynamicClass retransform rules:
1. addEntity: all entity of the same class of the added entity class need to be set to retransform
2. resetEntity: resetEntityClassSet only contains the class not in newDynamicClassList
ex: oldDynamicClassList: ClassA methodA, ClassB methodB, ClassC methodC
newDynamicClassList: ClassA methodA, ClassA methodA2, ClassB methodB2
addEntityClassSet: ClassA, ClassB
resetEntityClassSet: ClassC
retransform: ClassA: methodA, methodA2, ClassB methodB2
|
setExtendField
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
Apache-2.0
|
public int getBufferSize() {
if (extendField != null && extendField.containsKey(BUFFER_SIZE)) {
return Integer.parseInt(extendField.get(BUFFER_SIZE));
}
return bufferSize;
}
|
DynamicClass retransform rules:
1. addEntity: all entity of the same class of the added entity class need to be set to retransform
2. resetEntity: resetEntityClassSet only contains the class not in newDynamicClassList
ex: oldDynamicClassList: ClassA methodA, ClassB methodB, ClassC methodC
newDynamicClassList: ClassA methodA, ClassA methodA2, ClassB methodB2
addEntityClassSet: ClassA, ClassB
resetEntityClassSet: ClassC
retransform: ClassA: methodA, methodA2, ClassB methodB2
|
getBufferSize
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
Apache-2.0
|
public void setBufferSize(String bufferSize) {
if (StringUtil.isEmpty(bufferSize)) {
return;
}
this.bufferSize = Integer.parseInt(bufferSize);
System.setProperty(BUFFER_SIZE, bufferSize);
}
|
DynamicClass retransform rules:
1. addEntity: all entity of the same class of the added entity class need to be set to retransform
2. resetEntity: resetEntityClassSet only contains the class not in newDynamicClassList
ex: oldDynamicClassList: ClassA methodA, ClassB methodB, ClassC methodC
newDynamicClassList: ClassA methodA, ClassA methodA2, ClassB methodB2
addEntityClassSet: ClassA, ClassB
resetEntityClassSet: ClassC
retransform: ClassA: methodA, methodA2, ClassB methodB2
|
setBufferSize
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
Apache-2.0
|
@Override
public String toString() {
return "ConfigManager{" +
"enableDebug=" + enableDebug +
", agentVersion='" + agentVersion + '\'' +
", serviceName='" + serviceName + '\'' +
", storageServiceHost='" + storageServiceHost + '\'' +
", configPath='" + configPath + '\'' +
", storageServiceMode='" + storageServiceMode + '\'' +
", recordRate='" + recordRate + '\'' +
", allowDayOfWeeks='" + allowDayOfWeeks + '\'' +
", allowTimeOfDayFrom='" + allowTimeOfDayFrom + '\'' +
", allowTimeOfDayTo='" + allowTimeOfDayTo + '\'' +
", dynamicClassList='" + dynamicClassList + '\'' +
'}';
}
|
DynamicClass retransform rules:
1. addEntity: all entity of the same class of the added entity class need to be set to retransform
2. resetEntity: resetEntityClassSet only contains the class not in newDynamicClassList
ex: oldDynamicClassList: ClassA methodA, ClassB methodB, ClassC methodC
newDynamicClassList: ClassA methodA, ClassA methodA2, ClassB methodB2
addEntityClassSet: ClassA, ClassB
resetEntityClassSet: ClassC
retransform: ClassA: methodA, methodA2, ClassB methodB2
|
toString
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java
|
Apache-2.0
|
public static void reportUsedTime(long time, boolean isQueuedTime) {
if (STATE.get() <= FAST_REJECT) {
return;
}
if (isQueuedTime) {
BALANCE_CHECKER.statistic(time);
} else {
DATA_SERVICE_CHECKER.statistic(time);
}
}
|
Report time consuming
@param time -1,Reject;
@param isQueuedTime isQueuedTime
|
reportUsedTime
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/healthy/HealthManager.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/healthy/HealthManager.java
|
Apache-2.0
|
@Override
public void run() {
boolean isRecover = false;
switch (STATE.get()) {
case SERVICE_EXCEPTION:
isRecover = DATA_SERVICE_CHECKER.isRecover();
if (isRecover) {
STATE.set(NORMAL);
scheduledFuture = null;
} else {
RECORD_RATE_MANAGER.changeRate();
scheduledFuture = TimerService.schedule(this, 60, MINUTES);
}
break;
case QUEUE_OVERFLOW:
isRecover = BALANCE_CHECKER.isRecover();
if (isRecover) {
STATE.set(NORMAL);
scheduledFuture = null;
} else {
RECORD_RATE_MANAGER.decelerate();
scheduledFuture = TimerService.schedule(this, 10, MINUTES);
}
break;
default:
break;
}
LogManager.warn("healthManager.healthCheckTask", StringUtil.format("check result: state=%s, isRecover=%s",
String.valueOf(STATE.get()), String.valueOf(isRecover)));
}
|
Report time consuming
@param time -1,Reject;
@param isQueuedTime isQueuedTime
|
run
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/healthy/HealthManager.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/healthy/HealthManager.java
|
Apache-2.0
|
void statistic(long usedTime) {
if (usedTime < 0) {
fatal.incrementAndGet();
} else if (usedTime <= defaultTimeout) {
success.incrementAndGet();
}
total.incrementAndGet();
}
|
Report time consuming
@param time -1,Reject;
@param isQueuedTime isQueuedTime
|
statistic
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/healthy/HealthManager.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/healthy/HealthManager.java
|
Apache-2.0
|
void updateRate(double configRate, double currentRate) {
if ((configRate > currentRate && STATE.get() == NORMAL) || configRate < currentRate) {
for (Map.Entry<String, Pair<Double, RateLimiter>> entry : RATE_LIMITER_MAP.entrySet()) {
RATE_LIMITER_MAP.put(entry.getKey(), Pair.of(configRate, RateLimiter.create(configRate / BASE)));
}
System.setProperty(ConfigConstants.CURRENT_RATE, String.format("%.2f", configRate));
System.setProperty(ConfigConstants.DECELERATE_CODE, DecelerateReasonEnum.NORMAL.getCodeStr());
LogManager.info("healthManager.updateRate",
StringUtil.format("update rate, current rate change to: %s", String.format("%.2f", configRate)));
}
}
|
custom modify config rate or health check recover :
1. increase or recover (configRate > currentRate && STATE == NORMAL)
2. decrease (configRate < currentRate)
|
updateRate
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/healthy/HealthManager.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/healthy/HealthManager.java
|
Apache-2.0
|
double getCurrentRate(double rate) {
if (STATE.get() == NORMAL) {
return rate;
}
// un normally state, use current rate(maybe decelerated)
String currentRate = System.getProperty(ConfigConstants.CURRENT_RATE);
if (StringUtil.isNotEmpty(currentRate)) {
return Double.parseDouble(currentRate);
}
return rate;
}
|
custom modify config rate or health check recover :
1. increase or recover (configRate > currentRate && STATE == NORMAL)
2. decrease (configRate < currentRate)
|
getCurrentRate
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/healthy/HealthManager.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/healthy/HealthManager.java
|
Apache-2.0
|
boolean validate() {
return ConfigManager.INSTANCE.getRecordRate() > 0;
}
|
custom modify config rate or health check recover :
1. increase or recover (configRate > currentRate && STATE == NORMAL)
2. decrease (configRate < currentRate)
|
validate
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/healthy/HealthManager.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/healthy/HealthManager.java
|
Apache-2.0
|
void changeRate() {
if (!validate()) {
return;
}
double targetRate = ConfigManager.INSTANCE.getRecordRate();
for (Map.Entry<String, Pair<Double, RateLimiter>> entry : RATE_LIMITER_MAP.entrySet()) {
targetRate = MIN_RATE;
RATE_LIMITER_MAP.put(entry.getKey(), Pair.of(targetRate, RateLimiter.create(targetRate / BASE)));
}
System.setProperty(ConfigConstants.CURRENT_RATE, String.format("%.2f", targetRate));
System.setProperty(ConfigConstants.DECELERATE_CODE, DecelerateReasonEnum.SERVICE_EXCEPTION.getCodeStr());
LogManager.warn("healthManager.decelerate",
StringUtil.format("service exception! decrement record rate, current rate change to: %s",
String.format("%.2f", targetRate)));
}
|
Decrement record rate to {@link #MIN_RATE}
trigger if service exception
|
changeRate
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/healthy/HealthManager.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/healthy/HealthManager.java
|
Apache-2.0
|
void decelerate() {
if (!validate()) {
return;
}
double targetRate = ConfigManager.INSTANCE.getRecordRate();
for (Map.Entry<String, Pair<Double, RateLimiter>> entry : RATE_LIMITER_MAP.entrySet()) {
Pair<Double, RateLimiter> limiterPair = entry.getValue();
targetRate = Math.max(limiterPair.getFirst() * 0.8, MIN_RATE);
RATE_LIMITER_MAP.put(entry.getKey(), Pair.of(targetRate, RateLimiter.create(targetRate / BASE)));
}
System.setProperty(ConfigConstants.CURRENT_RATE, String.format("%.2f", targetRate));
System.setProperty(ConfigConstants.DECELERATE_CODE, DecelerateReasonEnum.QUEUE_OVERFLOW.getCodeStr());
LogManager.warn("healthManager.decelerate",
StringUtil.format("queue overflow! decrement record rate, current rate change to: %s",
String.format("%.2f", targetRate)));
}
|
Decrement record rate by 20%
trigger if queue is full
|
decelerate
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/healthy/HealthManager.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/healthy/HealthManager.java
|
Apache-2.0
|
public int getCode() {
return code;
}
|
AREX is shutdown, need to restart
|
getCode
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/model/AgentStatusEnum.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/model/AgentStatusEnum.java
|
Apache-2.0
|
public String getValue() {
return value;
}
|
AREX is shutdown, need to restart
|
getValue
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/model/AgentStatusEnum.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/model/AgentStatusEnum.java
|
Apache-2.0
|
public String serialize(Object object) {
try {
return jsonPrinter.print((AbstractMessage) object);
} catch (Throwable e) {
LogManager.warn("proto-serialize", e);
return StringUtil.EMPTY;
}
}
|
for the type inside the Collection is the PB type,
traverse the elements inside the Collection and serialize them one by one with separators
|
serialize
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/ProtoJsonSerializer.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/ProtoJsonSerializer.java
|
Apache-2.0
|
public <T> T deserialize(String value, Class<T> clazz) {
if (StringUtil.isEmpty(value) || clazz == null) {
return null;
}
try {
Builder<?> builder = getMessageBuilder(clazz);
jsonParser.merge(value, builder);
return (T) builder.build();
} catch (Throwable e) {
LogManager.warn("proto-deserialize", e);
return null;
}
}
|
for the type inside the Collection is the PB type,
traverse the elements inside the Collection and serialize them one by one with separators
|
deserialize
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/ProtoJsonSerializer.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/ProtoJsonSerializer.java
|
Apache-2.0
|
private Builder<?> getMessageBuilder(Class<?> clazz)
throws InvocationTargetException, IllegalAccessException, NoSuchMethodException {
Method method = clazz.getDeclaredMethod("newBuilder");
return (Builder<?>) method.invoke(null);
}
|
Create Class.Builder based on Class reflection for Json deserialization
@param clazz
@return Class.Builder
|
getMessageBuilder
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/ProtoJsonSerializer.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/ProtoJsonSerializer.java
|
Apache-2.0
|
@Override
public AbstractMessage read(JsonReader in) throws IOException {
final JsonElement parse = Streams.parse(in);
final String json = GSON.toJson(parse);
return (AbstractMessage) ProtoJsonSerializer.getInstance().deserialize(json, rawClass);
}
|
Streams.parse(in) will return a JsonObject object, which needs to be serialized to json first,
and then deserialized and restored to the original type by ProtoJsonSerializer
|
read
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/gson/adapter/ProtoBufTypeAdapter.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/gson/adapter/ProtoBufTypeAdapter.java
|
Apache-2.0
|
@Override
protected ClassIntrospector defaultClassIntrospector() {
return new ArexBasicClassIntrospector();
}
|
When the class does not have a no-argument constructor,
create a custom-built no-argument constructor logic
|
defaultClassIntrospector
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/jackson/ArexObjectMapper.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/jackson/ArexObjectMapper.java
|
Apache-2.0
|
@Override
public BasicBeanDescription forDeserialization(DeserializationConfig config, JavaType type, MixInResolver r) {
BasicBeanDescription desc = super.forDeserialization(config, type, r);
if (HAS_EXCEPTION.get()) {
return desc;
}
if (isMissingDefaultConstructor(type, desc)) {
try {
if (noCollectMethodWithFiveParameter) {
return new ArexBasicBeanDescription(collectProperties(config,
type, r, false));
}
return new ArexBasicBeanDescription(collectProperties(config,
type, r, false, null));
} catch (Throwable e) {
LogManager.warn("forDeserialization", e);
HAS_EXCEPTION.set(true);
}
}
return desc;
}
|
When the class does not have a no-argument constructor,
create a custom-built no-argument constructor logic
|
forDeserialization
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/jackson/ArexObjectMapper.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/jackson/ArexObjectMapper.java
|
Apache-2.0
|
private boolean isMissingDefaultConstructor(JavaType type, BasicBeanDescription desc) {
if (desc.findDefaultConstructor() != null) {
return false;
}
if (isStdTypeDesc(type)) {
return false;
}
return !super._isStdJDKCollection(type);
}
|
When the class does not have a no-argument constructor,
create a custom-built no-argument constructor logic
|
isMissingDefaultConstructor
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/jackson/ArexObjectMapper.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/jackson/ArexObjectMapper.java
|
Apache-2.0
|
private boolean isStdTypeDesc(JavaType type) {
Class<?> cls = type.getRawClass();
if (cls.isPrimitive()) {
return cls == Integer.TYPE || cls == Long.TYPE || cls == Boolean.TYPE;
}
if (cls == CLS_OBJECT || cls == CLS_STRING || cls == Integer.class || cls == Long.class || cls == Boolean.class) {
return true;
}
return CLS_JSON_NODE.isAssignableFrom(cls);
}
|
When the class does not have a no-argument constructor,
create a custom-built no-argument constructor logic
|
isStdTypeDesc
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/jackson/ArexObjectMapper.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/jackson/ArexObjectMapper.java
|
Apache-2.0
|
@Override
public AnnotatedConstructor findDefaultConstructor() {
AnnotatedConstructor annotatedConstructor = super.findDefaultConstructor();
if (annotatedConstructor == null) {
try {
// no default constructor, create one for deserialize
Constructor<?> defaultConstructor =
(Constructor<?>) constructorForSerialization.invoke(reflectionFactory, this.getBeanClass(), objectConstructor);
annotatedConstructor = new
AnnotatedConstructor(null, defaultConstructor, null, null);
} catch (Throwable ex) {
LogManager.warn("findDefaultConstructor", ex);
HAS_EXCEPTION.set(true);
}
}
return annotatedConstructor;
}
|
When the class does not have a no-argument constructor,
create a custom-built no-argument constructor logic
|
findDefaultConstructor
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/jackson/ArexObjectMapper.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/jackson/ArexObjectMapper.java
|
Apache-2.0
|
@Override
public boolean useForType(JavaType type) {
Class<?> rawClass = type.getRawClass();
return rawClass.isInterface() &&
StringUtil.startWith(rawClass.getName(), FastUtilAdapterFactory.FASTUTIL_PACKAGE);
}
|
@return true will serialize with runtime type info
|
useForType
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/jackson/JacksonSerializer.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/jackson/JacksonSerializer.java
|
Apache-2.0
|
public Date parseDate(final String source) {
return parseDate(source, null);
}
|
Parse date without timezone
@param source datetime string
@return Date
|
parseDate
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/util/DateFormatParser.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/util/DateFormatParser.java
|
Apache-2.0
|
public Date parseDate(String source, TimeZone timeZone) {
if (StringUtil.isEmpty(source)) {
return null;
}
if (timeZone == null) {
timeZone = TimezoneParser.INSTANCE.parse(source);
}
try {
if (source.length() >= TimePatternConstants.SIMPLE_DATE_FORMAT_WITH_TIMEZONE.length()) {
source = source.substring(0, TimePatternConstants.SIMPLE_DATE_FORMAT_MILLIS.length()).replace('T', ' ');
}
String pattern =
DATE_PATTERN_MAP.getOrDefault(source.length(), TimePatternConstants.SIMPLE_DATE_FORMAT_MILLIS);
return FastDateFormat.getInstance(pattern, timeZone).parse(source);
} catch (ParseException e) {
LogManager.warn("parseDate", e);
return null;
}
}
|
Parse date with timezone
@param source datetime string
@return Date
|
parseDate
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/util/DateFormatParser.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/util/DateFormatParser.java
|
Apache-2.0
|
public DateTimeFormatter getFormatter(final String source, final String defaultPattern) {
String pattern = DATE_PATTERN_MAP.getOrDefault(source.length(), defaultPattern);
return DEFAULT_FORMATTER_MAP.computeIfAbsent(pattern, DateTimeFormatter::ofPattern);
}
|
Get datetime formatter
@param source datetime string
@param defaultPattern default datetime pattern
@return DateTimeFormatter instance
|
getFormatter
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/util/DateFormatParser.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/util/DateFormatParser.java
|
Apache-2.0
|
public DateTimeFormatter getFormatter(final String pattern) {
return DEFAULT_FORMATTER_MAP.computeIfAbsent(pattern, DateTimeFormatter::ofPattern);
}
|
Get datetime formatter
@param pattern datetime pattern
@return DateTimeFormatter instance
|
getFormatter
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/util/DateFormatParser.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/util/DateFormatParser.java
|
Apache-2.0
|
public static Object restoreRange(String json) {
try {
Object rangeDeserializer = JacksonSerializerWithType.INSTANCE.deserialize(json, rangeClass);
if (StringUtil.containsIgnoreCase(json, GUAVA_BELOW_ALL_CLASS_NAME)) {
lowerBoundField.set(rangeDeserializer, belowAllInstance);
}
if (StringUtil.containsIgnoreCase(json, GUAVA_ABOVE_ALL_CLASS_NAME)) {
upperBoundField.set(rangeDeserializer, aboveAllInstance);
}
return rangeDeserializer;
} catch (Throwable e) {
LogManager.warn("rang.restore", e);
return null;
}
}
|
<relocation>
<pattern>com.google</pattern>
<shadedPattern>shaded.com.google</shadedPattern>
</relocation>
after packaging, com.google.** will be relocated to shaded.com.google.**. String also will be relocated.
so in order to get the Range type at runtime, need to remove the shaded prefix
ex: String GUAVA_RANGE_CLASS_NAME = com.google.common.collect.Range -> shaded.com.google.common.collect.Range
|
restoreRange
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/util/GuavaRangeManager.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/util/GuavaRangeManager.java
|
Apache-2.0
|
public static boolean isGuavaRange(String typeName) {
return GUAVA_RANGE_CLASS_NAME.endsWith(typeName);
}
|
Guava_RANGE will be shaded, so use endswith.
|
isGuavaRange
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/util/GuavaRangeManager.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/serializer/util/GuavaRangeManager.java
|
Apache-2.0
|
public long loadAgentConfig(String agentArgs) {
// AREX cli may pass arguments to agent
if (StringUtil.isNotEmpty(agentArgs)) {
ConfigManager.INSTANCE.parseAgentConfig(agentArgs);
return -1;
}
if (ConfigManager.INSTANCE.isLocalStorage()) {
return -1;
}
// Load agent config according to last modified time
loadAgentConfig();
return DELAY_MINUTES;
}
|
ConfigService
todo: config file, run backend
@date 2022/03/16
|
loadAgentConfig
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/services/ConfigService.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/services/ConfigService.java
|
Apache-2.0
|
public void loadAgentConfig() {
try {
ConfigQueryRequest request = buildConfigQueryRequest();
String requestJson = serialize(request);
HttpClientResponse clientResponse = AsyncHttpClientUtil.postAsyncWithJson(CONFIG_LOAD_URI, requestJson, null).join();
if (clientResponse == null) {
LOGGER.warn("[AREX] Load agent config, response is null, pause recording");
ConfigManager.INSTANCE.setConfigInvalid();
return;
}
LOGGER.info("[AREX] Load agent config\nrequest: {}\nresponse: {}", requestJson, clientResponse.getBody());
if (StringUtil.isEmpty(clientResponse.getBody()) || "{}".equals(clientResponse.getBody())) {
LOGGER.warn("[AREX] Load agent config, response is null, pause recording");
ConfigManager.INSTANCE.setConfigInvalid();
return;
}
ConfigQueryResponse configResponse = deserialize(clientResponse.getBody(), ConfigQueryResponse.class);
if (configResponse == null || configResponse.getBody() == null ||
configResponse.getBody().getServiceCollectConfiguration() == null) {
ConfigManager.INSTANCE.setConfigInvalid();
LOGGER.warn("[AREX] Load agent config, deserialize response is null, pause recording");
return;
}
ConfigManager.INSTANCE.updateConfigFromService(configResponse.getBody());
} catch (Throwable e) {
LOGGER.warn("[AREX] Load agent config error, pause recording. exception message: {}", e.getMessage(), e);
ConfigManager.INSTANCE.setConfigInvalid();
}
}
|
ConfigService
todo: config file, run backend
@date 2022/03/16
|
loadAgentConfig
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/services/ConfigService.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/services/ConfigService.java
|
Apache-2.0
|
public ConfigQueryRequest buildConfigQueryRequest() {
ConfigQueryRequest request = new ConfigQueryRequest();
request.setAppId(ConfigManager.INSTANCE.getServiceName());
request.setHost(NetUtils.getIpAddress());
request.setRecordVersion(ConfigManager.INSTANCE.getAgentVersion());
AgentStatusEnum agentStatus = getAgentStatus();
if (AgentStatusEnum.START == agentStatus) {
request.setSystemProperties(getSystemProperties());
request.setSystemEnv(new HashMap<>(System.getenv()));
} else {
request.setSystemProperties(TAGS_PROPERTIES);
}
request.setAgentStatus(agentStatus.name());
return request;
}
|
ConfigService
todo: config file, run backend
@date 2022/03/16
|
buildConfigQueryRequest
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/services/ConfigService.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/services/ConfigService.java
|
Apache-2.0
|
AgentStatusEnum getAgentStatus() {
if (AgentStatusService.INSTANCE.isShutdown()) {
return AgentStatusEnum.SHUTDOWN;
}
if (firstLoad.compareAndSet(false, true)) {
return AgentStatusEnum.START;
}
if (ConfigManager.FIRST_TRANSFORM.get()) {
if (ConfigManager.INSTANCE.inWorkingTime() && ConfigManager.INSTANCE.getRecordRate() > 0) {
return AgentStatusEnum.WORKING;
} else {
return AgentStatusEnum.SLEEPING;
}
}
return AgentStatusEnum.UN_START;
}
|
ConfigService
todo: config file, run backend
@date 2022/03/16
|
getAgentStatus
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/services/ConfigService.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/services/ConfigService.java
|
Apache-2.0
|
public Map<String, String> getSystemProperties() {
Properties properties = System.getProperties();
Map<String, String> map = MapUtils.newHashMapWithExpectedSize(properties.size());
Map<String, String> mockerTags = new HashMap<>();
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
String key = String.valueOf(entry.getKey());
String value = String.valueOf(entry.getValue());
map.put(key, value);
buildTags(mockerTags, key, value);
}
System.setProperty(ConfigConstants.MOCKER_TAGS, StringUtil.mapToString(mockerTags));
return map;
}
|
ConfigService
todo: config file, run backend
@date 2022/03/16
|
getSystemProperties
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/services/ConfigService.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/services/ConfigService.java
|
Apache-2.0
|
public static byte[] zstdCompress(byte[] original) {
if (original == null || original.length == 0) {
return ZERO_BYTE;
}
try (ByteArrayInputStream byteInputStream = new ByteArrayInputStream(original);
ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream(byteInputStream.available());
ZstdOutputStreamNoFinalizer zstdOutputStream = new ZstdOutputStreamNoFinalizer(byteOutputStream,
RecyclingBufferPool.INSTANCE)) {
byte[] buffer = new byte[BYTES_BUFFER_LENGTH];
for (int length; (length = byteInputStream.read(buffer, 0, BYTES_BUFFER_LENGTH)) != -1; ) {
zstdOutputStream.write(buffer, 0, length);
}
zstdOutputStream.flush();
zstdOutputStream.close();
return byteOutputStream.toByteArray();
} catch (Throwable e) {
LOGGER.warn("[[title=arex.compress]]", e);
return ZERO_BYTE;
}
}
|
zstd compress
@param original original string
@return
|
zstdCompress
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/util/CompressUtil.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/util/CompressUtil.java
|
Apache-2.0
|
public static String zstdDecompress(InputStream inputStream, Charset charsetName) {
try (ZstdInputStreamNoFinalizer zstdInputStream = new ZstdInputStreamNoFinalizer(inputStream,
RecyclingBufferPool.INSTANCE);
ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream(inputStream.available())) {
byte[] buffer = new byte[BYTES_BUFFER_LENGTH];
for (int length; (length = zstdInputStream.read(buffer, 0, BYTES_BUFFER_LENGTH)) != -1; ) {
byteOutputStream.write(buffer, 0, length);
}
return byteOutputStream.toString(charsetName.name());
} catch (Throwable e) {
LOGGER.warn("[[title=arex.decompress]]", e);
return null;
}
}
|
zstd compress
@param original original string
@return
|
zstdDecompress
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/util/CompressUtil.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/util/CompressUtil.java
|
Apache-2.0
|
public static String zstdDecompress(byte[] bytes, Charset charsetName) {
return zstdDecompress(new ByteArrayInputStream(bytes), charsetName);
}
|
zstd compress
@param original original string
@return
|
zstdDecompress
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/main/java/io/arex/foundation/util/CompressUtil.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/main/java/io/arex/foundation/util/CompressUtil.java
|
Apache-2.0
|
@Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoRequestType}
|
getUnknownFields
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return ProtoTest.internal_static_com_ctrip_flight_arextest_api_proto_HelloProtoRequestType_descriptor;
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoRequestType}
|
getDescriptor
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return ProtoTest.internal_static_com_ctrip_flight_arextest_api_proto_HelloProtoRequestType_fieldAccessorTable
.ensureFieldAccessorsInitialized(
HelloProtoRequestType.class, Builder.class);
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoRequestType}
|
internalGetFieldAccessorTable
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return ProtoTest.internal_static_com_ctrip_flight_arextest_api_proto_HelloProtoRequestType_descriptor;
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoRequestType}
|
getDescriptor
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return ProtoTest.internal_static_com_ctrip_flight_arextest_api_proto_HelloProtoRequestType_fieldAccessorTable
.ensureFieldAccessorsInitialized(
HelloProtoRequestType.class, Builder.class);
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoRequestType}
|
internalGetFieldAccessorTable
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoRequestType}
|
maybeForceBuilderInitialization
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public Builder clear() {
super.clear();
name_ = "";
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoRequestType}
|
clear
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return ProtoTest.internal_static_com_ctrip_flight_arextest_api_proto_HelloProtoRequestType_descriptor;
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoRequestType}
|
getDescriptorForType
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public HelloProtoRequestType getDefaultInstanceForType() {
return HelloProtoRequestType.getDefaultInstance();
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoRequestType}
|
getDefaultInstanceForType
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public HelloProtoRequestType build() {
HelloProtoRequestType result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoRequestType}
|
build
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public HelloProtoRequestType buildPartial() {
HelloProtoRequestType result = new HelloProtoRequestType(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.name_ = name_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoRequestType}
|
buildPartial
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public Builder clone() {
return (Builder) super.clone();
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoRequestType}
|
clone
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return (Builder) super.setField(field, value);
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoRequestType}
|
setField
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return (Builder) super.clearField(field);
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoRequestType}
|
clearField
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return (Builder) super.clearOneof(oneof);
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoRequestType}
|
clearOneof
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, Object value) {
return (Builder) super.setRepeatedField(field, index, value);
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoRequestType}
|
setRepeatedField
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return (Builder) super.addRepeatedField(field, value);
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoRequestType}
|
addRepeatedField
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof HelloProtoRequestType) {
return mergeFrom((HelloProtoRequestType)other);
} else {
super.mergeFrom(other);
return this;
}
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoRequestType}
|
mergeFrom
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
public Builder mergeFrom(HelloProtoRequestType other) {
if (other == HelloProtoRequestType.getDefaultInstance()) return this;
if (other.hasName()) {
bitField0_ |= 0x00000001;
name_ = other.name_;
onChanged();
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoRequestType}
|
mergeFrom
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public final boolean isInitialized() {
return true;
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoRequestType}
|
isInitialized
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
HelloProtoRequestType parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (HelloProtoRequestType) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoRequestType}
|
mergeFrom
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoResponseType}
|
getUnknownFields
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return ProtoTest.internal_static_com_ctrip_flight_arextest_api_proto_HelloProtoResponseType_descriptor;
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoResponseType}
|
getDescriptor
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return ProtoTest.internal_static_com_ctrip_flight_arextest_api_proto_HelloProtoResponseType_fieldAccessorTable
.ensureFieldAccessorsInitialized(
HelloProtoResponseType.class, Builder.class);
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoResponseType}
|
internalGetFieldAccessorTable
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return ProtoTest.internal_static_com_ctrip_flight_arextest_api_proto_HelloProtoResponseType_descriptor;
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoResponseType}
|
getDescriptor
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return ProtoTest.internal_static_com_ctrip_flight_arextest_api_proto_HelloProtoResponseType_fieldAccessorTable
.ensureFieldAccessorsInitialized(
HelloProtoResponseType.class, Builder.class);
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoResponseType}
|
internalGetFieldAccessorTable
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoResponseType}
|
maybeForceBuilderInitialization
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public Builder clear() {
super.clear();
msg_ = "";
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoResponseType}
|
clear
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return ProtoTest.internal_static_com_ctrip_flight_arextest_api_proto_HelloProtoResponseType_descriptor;
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoResponseType}
|
getDescriptorForType
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public HelloProtoResponseType getDefaultInstanceForType() {
return HelloProtoResponseType.getDefaultInstance();
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoResponseType}
|
getDefaultInstanceForType
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public HelloProtoResponseType build() {
HelloProtoResponseType result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoResponseType}
|
build
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public HelloProtoResponseType buildPartial() {
HelloProtoResponseType result = new HelloProtoResponseType(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.msg_ = msg_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoResponseType}
|
buildPartial
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public Builder clone() {
return (Builder) super.clone();
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoResponseType}
|
clone
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return (Builder) super.setField(field, value);
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoResponseType}
|
setField
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return (Builder) super.clearField(field);
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoResponseType}
|
clearField
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return (Builder) super.clearOneof(oneof);
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoResponseType}
|
clearOneof
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, Object value) {
return (Builder) super.setRepeatedField(field, index, value);
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoResponseType}
|
setRepeatedField
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return (Builder) super.addRepeatedField(field, value);
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoResponseType}
|
addRepeatedField
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof HelloProtoResponseType) {
return mergeFrom((HelloProtoResponseType)other);
} else {
super.mergeFrom(other);
return this;
}
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoResponseType}
|
mergeFrom
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
public Builder mergeFrom(HelloProtoResponseType other) {
if (other == HelloProtoResponseType.getDefaultInstance()) return this;
if (other.hasMsg()) {
bitField0_ |= 0x00000001;
msg_ = other.msg_;
onChanged();
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoResponseType}
|
mergeFrom
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public final boolean isInitialized() {
return true;
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoResponseType}
|
isInitialized
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
@Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
HelloProtoResponseType parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (HelloProtoResponseType) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
|
Protobuf type {@code com.ctrip.flight.arextest.api.proto.HelloProtoResponseType}
|
mergeFrom
|
java
|
arextest/arex-agent-java
|
arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-instrumentation-foundation/src/test/java/io/arex/foundation/serializer/ProtoTest.java
|
Apache-2.0
|
private static String testDynamic(int num) {
return UUID.randomUUID().toString();
}
|
the value returned by each call is different, but if replayed, the recorded value should be returned normally
|
testDynamic
|
java
|
arextest/arex-agent-java
|
arex-integration-tests/arex-dynamic-integration-test/src/test/java/io/arex/integrationtest/dynamic/DynamicClassIT.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-integration-tests/arex-dynamic-integration-test/src/test/java/io/arex/integrationtest/dynamic/DynamicClassIT.java
|
Apache-2.0
|
@ParameterizedTest
@ValueSource(strings = {"openjdk:8", "openjdk:11", "openjdk:17"})
void main(String image) {
GenericContainer<?> container = new GenericContainer<>(DockerImageName.parse(image))
.withCopyFileToContainer(MountableFile.forHostPath(getAgentJarPath("arex-agent")),
String.join("/", tempAgentDir, "arex-agent.jar"))
.withCopyFileToContainer(MountableFile.forHostPath(getAgentJarPath("arex-agent-bootstrap")),
String.join("/", tempAgentDir, getAgentJarName("arex-agent-bootstrap")))
.withCopyFileToContainer(MountableFile.forHostPath(getMainAppJar()), "/tmp/main-app.jar")
.withCommand("java -javaagent:/tmp/arex/arex-agent-jar/arex-agent.jar" +
" -Darex.service.name=test-app" +
" -jar /tmp/main-app.jar")
.waitingFor(Wait.forLogMessage(".*ArexAgent AgentInstaller initialized.*", 1));
container.start();
try {
assertTrue(container.getLogs().contains("ArexAgent AgentInstaller initialized"));
} finally {
container.stop();
}
}
|
test whether the AREX starts normally under different jdk versions
|
main
|
java
|
arextest/arex-agent-java
|
arex-integration-tests/arex-main-integration-test/src/test/java/io/arex/integrationtest/mainapp/MainAppIT.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-integration-tests/arex-main-integration-test/src/test/java/io/arex/integrationtest/mainapp/MainAppIT.java
|
Apache-2.0
|
private static String getMainAppJar() {
String jarDir = "target/arex-main-integration-test.jar";
Path path = Paths.get(jarDir);
assertTrue(Files.exists(path), jarDir + " not found. Execute mvn package to build the jar.");
return path.toAbsolutePath().toString();
}
|
test whether the AREX starts normally under different jdk versions
|
getMainAppJar
|
java
|
arextest/arex-agent-java
|
arex-integration-tests/arex-main-integration-test/src/test/java/io/arex/integrationtest/mainapp/MainAppIT.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-integration-tests/arex-main-integration-test/src/test/java/io/arex/integrationtest/mainapp/MainAppIT.java
|
Apache-2.0
|
public static TableSchema parse(String sql) throws Exception {
sql = PATTERN.matcher(sql).replaceAll(" ");
Statement statement = CCJSqlParserUtil.parse(sql);
List<String> tableNameList = new TablesNamesFinder().getTableList(statement);
// sort table name
if (tableNameList != null && tableNameList.size() > 1) {
Collections.sort(tableNameList);
}
TableSchema tableSchema = new TableSchema();
tableSchema.setAction(getAction(statement));
tableSchema.setTableNames(tableNameList);
return tableSchema;
}
|
parse table and action from sql
@param sql sql
@return table schema info
|
parse
|
java
|
arextest/arex-agent-java
|
arex-third-party/src/main/java/io/arex/agent/thirdparty/util/sqlparser/JSqlParserUtil.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-third-party/src/main/java/io/arex/agent/thirdparty/util/sqlparser/JSqlParserUtil.java
|
Apache-2.0
|
private static String getAction(Statement statement) {
if (statement instanceof Select) {
return "Select";
}
return statement.getClass().getSimpleName();
}
|
parse table and action from sql
@param sql sql
@return table schema info
|
getAction
|
java
|
arextest/arex-agent-java
|
arex-third-party/src/main/java/io/arex/agent/thirdparty/util/sqlparser/JSqlParserUtil.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-third-party/src/main/java/io/arex/agent/thirdparty/util/sqlparser/JSqlParserUtil.java
|
Apache-2.0
|
@Override
public StringBuffer format(final Object obj, final StringBuffer toAppendTo, final FieldPosition pos) {
return toAppendTo.append(printer.format(obj));
}
|
<p>Formats a {@code Date}, {@code Calendar} or
{@code Long} (milliseconds) object.</p>
This method is an implementation of {@link Format#format(Object, StringBuffer, FieldPosition)}
@param obj the object to format
@param toAppendTo the buffer to append to
@param pos the position - ignored
@return the buffer passed in
|
format
|
java
|
arextest/arex-agent-java
|
arex-third-party/src/main/java/io/arex/agent/thirdparty/util/time/FastDateFormat.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-third-party/src/main/java/io/arex/agent/thirdparty/util/time/FastDateFormat.java
|
Apache-2.0
|
@Override
public String format(final long millis) {
return printer.format(millis);
}
|
<p>Formats a millisecond {@code long} value.</p>
@param millis the millisecond value to format
@return the formatted string
@since 2.1
|
format
|
java
|
arextest/arex-agent-java
|
arex-third-party/src/main/java/io/arex/agent/thirdparty/util/time/FastDateFormat.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-third-party/src/main/java/io/arex/agent/thirdparty/util/time/FastDateFormat.java
|
Apache-2.0
|
@Override
public String format(final Date date) {
return printer.format(date);
}
|
<p>Formats a {@code Date} object using a {@code GregorianCalendar}.</p>
@param date the date to format
@return the formatted string
|
format
|
java
|
arextest/arex-agent-java
|
arex-third-party/src/main/java/io/arex/agent/thirdparty/util/time/FastDateFormat.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-third-party/src/main/java/io/arex/agent/thirdparty/util/time/FastDateFormat.java
|
Apache-2.0
|
@Override
public String format(final Calendar calendar) {
return printer.format(calendar);
}
|
<p>Formats a {@code Calendar} object.</p>
@param calendar the calendar to format
@return the formatted string
|
format
|
java
|
arextest/arex-agent-java
|
arex-third-party/src/main/java/io/arex/agent/thirdparty/util/time/FastDateFormat.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-third-party/src/main/java/io/arex/agent/thirdparty/util/time/FastDateFormat.java
|
Apache-2.0
|
@Deprecated
@Override
public StringBuffer format(final long millis, final StringBuffer buf) {
return printer.format(millis, buf);
}
|
<p>Formats a {@code Calendar} object.</p>
@param calendar the calendar to format
@return the formatted string
|
format
|
java
|
arextest/arex-agent-java
|
arex-third-party/src/main/java/io/arex/agent/thirdparty/util/time/FastDateFormat.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-third-party/src/main/java/io/arex/agent/thirdparty/util/time/FastDateFormat.java
|
Apache-2.0
|
@Deprecated
@Override
public StringBuffer format(final Date date, final StringBuffer buf) {
return printer.format(date, buf);
}
|
<p>Formats a {@code Date} object into the
supplied {@code StringBuffer} using a {@code GregorianCalendar}.</p>
@param date the date to format
@param buf the buffer to format into
@return the specified string buffer
@deprecated Use {{@link #format(Date, Appendable)}.
|
format
|
java
|
arextest/arex-agent-java
|
arex-third-party/src/main/java/io/arex/agent/thirdparty/util/time/FastDateFormat.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-third-party/src/main/java/io/arex/agent/thirdparty/util/time/FastDateFormat.java
|
Apache-2.0
|
@Deprecated
@Override
public StringBuffer format(final Calendar calendar, final StringBuffer buf) {
return printer.format(calendar, buf);
}
|
<p>Formats a {@code Calendar} object into the
supplied {@code StringBuffer}.</p>
@param calendar the calendar to format
@param buf the buffer to format into
@return the specified string buffer
@deprecated Use {{@link #format(Calendar, Appendable)}.
|
format
|
java
|
arextest/arex-agent-java
|
arex-third-party/src/main/java/io/arex/agent/thirdparty/util/time/FastDateFormat.java
|
https://github.com/arextest/arex-agent-java/blob/master/arex-third-party/src/main/java/io/arex/agent/thirdparty/util/time/FastDateFormat.java
|
Apache-2.0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.