Search in sources :

Example 46 with PressureMeasureError

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);
}
Also used : PutWarmerRequest(org.elasticsearch.action.admin.indices.warmer.put.PutWarmerRequest) PressureMeasureError(com.pamirs.pradar.exception.PressureMeasureError)

Example 47 with PressureMeasureError

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);
}
Also used : RecoveryRequest(org.elasticsearch.action.admin.indices.recovery.RecoveryRequest) PressureMeasureError(com.pamirs.pradar.exception.PressureMeasureError)

Example 48 with PressureMeasureError

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);
}
Also used : RefreshRequest(org.elasticsearch.action.admin.indices.refresh.RefreshRequest) PressureMeasureError(com.pamirs.pradar.exception.PressureMeasureError)

Example 49 with PressureMeasureError

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);
}
Also used : UpgradeStatusRequest(org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusRequest) PressureMeasureError(com.pamirs.pradar.exception.PressureMeasureError)

Example 50 with PressureMeasureError

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);
    }
}
Also used : PressureMeasureError(com.pamirs.pradar.exception.PressureMeasureError) RestClient(org.elasticsearch.client.RestClient) IOException(java.io.IOException)

Aggregations

PressureMeasureError (com.pamirs.pradar.exception.PressureMeasureError)150 PradarException (com.pamirs.pradar.exception.PradarException)34 DataSourceMeta (com.pamirs.pradar.pressurement.agent.shared.service.DataSourceMeta)14 Connection (java.sql.Connection)14 SQLException (java.sql.SQLException)13 ArrayList (java.util.ArrayList)13 Map (java.util.Map)11 MatchConfig (com.pamirs.pradar.internal.config.MatchConfig)8 ShadowDatabaseConfig (com.pamirs.pradar.internal.config.ShadowDatabaseConfig)8 HashMap (java.util.HashMap)8 MongoNamespace (com.mongodb.MongoNamespace)7 RequestIndexRename (com.pamirs.attach.plugin.es.common.RequestIndexRename)7 ProcessControlException (com.shulie.instrument.simulator.api.ProcessControlException)7 MQTraceContext (com.pamirs.attach.plugin.alibaba.rocketmq.common.MQTraceContext)6 SpanRecord (com.pamirs.pradar.interceptor.SpanRecord)6 ReflectException (com.shulie.instrument.simulator.api.reflect.ReflectException)6 List (java.util.List)6 ConsumeMessageContext (org.apache.rocketmq.client.hook.ConsumeMessageContext)6 ConsumeMessageContext (com.alibaba.rocketmq.client.hook.ConsumeMessageContext)5 WrapperRequest (com.pamirs.attach.plugin.hessian.common.WrapperRequest)5