use of com.pamirs.pradar.exception.PressureMeasureError in project LinkAgent by shulieTech.
the class PutWarmerRequestIndexRename method reindex0.
@Override
public List<String> reindex0(Object target) {
PutWarmerRequest req = (PutWarmerRequest) target;
String[] indices = req.indices();
for (int i = 0, len = indices.length; i < len; i++) {
String index = indices[i];
/**
* 如果在白名单中则不允许写
*/
if (GlobalConfig.getInstance().getSearchWhiteList().contains(index)) {
throw new PressureMeasureError("Cluster Test request can't delete index template ! " + index);
}
if (!Pradar.isClusterTestPrefix(index)) {
index = Pradar.addClusterTestPrefixLower(index);
indices[i] = index;
}
}
req.indices(indices);
return Arrays.asList(indices);
}
use of com.pamirs.pradar.exception.PressureMeasureError in project LinkAgent by shulieTech.
the class RecoveryRequestIndexRename method reindex0.
@Override
public List<String> reindex0(Object target) {
RecoveryRequest req = (RecoveryRequest) target;
String[] indexes = req.indices();
for (int i = 0, len = indexes.length; i < len; i++) {
String index = indexes[i];
/**
* 如果在白名单中则不允许写
*/
if (GlobalConfig.getInstance().getSearchWhiteList().contains(index)) {
throw new PressureMeasureError("Cluster Test request can't refresh business index !");
}
if (!Pradar.isClusterTestPrefix(index)) {
index = Pradar.addClusterTestPrefixLower(index);
indexes[i] = index;
}
}
req.indices(indexes);
return Arrays.asList(indexes);
}
use of com.pamirs.pradar.exception.PressureMeasureError in project LinkAgent by shulieTech.
the class RefreshRequestIndexRename method reindex0.
@Override
public List<String> reindex0(Object target) {
RefreshRequest req = (RefreshRequest) target;
String[] indexes = req.indices();
for (int i = 0, len = indexes.length; i < len; i++) {
String index = indexes[i];
/**
* 如果在白名单中则不允许写
*/
if (GlobalConfig.getInstance().getSearchWhiteList().contains(index)) {
throw new PressureMeasureError("Cluster Test request can't refresh business index !");
}
if (!Pradar.isClusterTestPrefix(index)) {
index = Pradar.addClusterTestPrefixLower(index);
indexes[i] = index;
}
}
req.indices(indexes);
return Arrays.asList(indexes);
}
use of com.pamirs.pradar.exception.PressureMeasureError in project LinkAgent by shulieTech.
the class UpgradeStatusRequestIndexRename method reindex0.
@Override
public List<String> reindex0(Object target) {
UpgradeStatusRequest req = (UpgradeStatusRequest) target;
String[] indices = req.indices();
for (int i = 0, len = indices.length; i < len; i++) {
String index = indices[i];
/**
* 如果在白名单中则不允许写
*/
if (GlobalConfig.getInstance().getSearchWhiteList().contains(index)) {
throw new PressureMeasureError("Cluster Test request can't delete index template ! " + index);
}
if (!Pradar.isClusterTestPrefix(index)) {
index = Pradar.addClusterTestPrefixLower(index);
indices[i] = index;
}
}
req.indices(indices);
return Arrays.asList(indices);
}
use of com.pamirs.pradar.exception.PressureMeasureError in project LinkAgent by shulieTech.
the class AbstractRestClientShadowServerInterceptor method doShadowServerInterceptor.
protected CutOffResult doShadowServerInterceptor(Advice advice) {
Object target = advice.getTarget();
String methodName = advice.getBehaviorName();
Object[] args = advice.getParameterArray();
if (!doCheck(target, methodName, args)) {
return CutOffResult.PASSED;
}
try {
RestClient restClient = ShadowEsClientHolder.getShadowRestClient((RestClient) target);
return CutOffResult.cutoff(doCutoff(restClient, methodName, args));
} catch (PressureMeasureError e) {
LOGGER.error(e.getMessage(), e);
ErrorReporter.buildError().setErrorType(ErrorTypeEnum.ShadowEsServer).setErrorCode("redisServer-0001").setMessage("获取影子数据源失败!").setDetail(ExceptionUtils.getStackTrace(e)).report();
throw e;
} catch (IOException e) {
throw new PressureMeasureError(e);
}
}
Aggregations