Search in sources :

Example 41 with PressureMeasureError

use of com.pamirs.pradar.exception.PressureMeasureError in project LinkAgent by shulieTech.

the class DeleteIndexRequestIndexRename method reindex0.

@Override
public List<String> reindex0(Object target) {
    DeleteIndexRequest req = (DeleteIndexRequest) 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 write business index ! " + index);
        }
        if (!Pradar.isClusterTestPrefix(index)) {
            index = Pradar.addClusterTestPrefixLower(index);
            indexes[i] = index;
        }
    }
    req.indices(indexes);
    return Arrays.asList(indexes);
}
Also used : PressureMeasureError(com.pamirs.pradar.exception.PressureMeasureError) DeleteIndexRequest(org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest)

Example 42 with PressureMeasureError

use of com.pamirs.pradar.exception.PressureMeasureError in project LinkAgent by shulieTech.

the class DeleteIndexTemplateRequestIndexRename method reindex0.

@Override
public List<String> reindex0(Object target) {
    DeleteIndexTemplateRequest req = (DeleteIndexTemplateRequest) target;
    String name = req.name();
    /**
     * 如果在白名单中则不允许写
     */
    if (GlobalConfig.getInstance().getSearchWhiteList().contains(name)) {
        throw new PressureMeasureError("Cluster Test request can't delete index template ! " + name);
    }
    if (!Pradar.isClusterTestPrefix(name)) {
        name = Pradar.addClusterTestPrefixLower(name);
    }
    req.name(name);
    return Arrays.asList(name);
}
Also used : PressureMeasureError(com.pamirs.pradar.exception.PressureMeasureError) DeleteIndexTemplateRequest(org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest)

Example 43 with PressureMeasureError

use of com.pamirs.pradar.exception.PressureMeasureError in project LinkAgent by shulieTech.

the class DeleteRequestIndexRename method reindex0.

@Override
public List<String> reindex0(Object target) {
    DeleteRequest req = (DeleteRequest) target;
    String index = req.index();
    /**
     * 如果在白名单中则不允许写
     */
    if (GlobalConfig.getInstance().getSearchWhiteList().contains(index)) {
        throw new PressureMeasureError("Cluster Test request can't write business index ! " + index);
    }
    if (!Pradar.isClusterTestPrefix(index)) {
        index = Pradar.addClusterTestPrefixLower(req.index());
    }
    req.index(index);
    return Arrays.asList(index);
}
Also used : PressureMeasureError(com.pamirs.pradar.exception.PressureMeasureError) DeleteRequest(org.elasticsearch.action.delete.DeleteRequest)

Example 44 with PressureMeasureError

use of com.pamirs.pradar.exception.PressureMeasureError in project LinkAgent by shulieTech.

the class DeleteWarmerRequestIndexRename method reindex0.

@Override
public List<String> reindex0(Object target) {
    DeleteWarmerRequest req = (DeleteWarmerRequest) 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 : DeleteWarmerRequest(org.elasticsearch.action.admin.indices.warmer.delete.DeleteWarmerRequest) PressureMeasureError(com.pamirs.pradar.exception.PressureMeasureError)

Example 45 with PressureMeasureError

use of com.pamirs.pradar.exception.PressureMeasureError in project LinkAgent by shulieTech.

the class UpgradeRequestIndexRename method reindex0.

@Override
public List<String> reindex0(Object target) {
    UpgradeRequest req = (UpgradeRequest) 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 : UpgradeRequest(org.elasticsearch.action.admin.indices.upgrade.post.UpgradeRequest) PressureMeasureError(com.pamirs.pradar.exception.PressureMeasureError)

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