Search in sources :

Example 91 with PressureMeasureError

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

the class MultiTermVectorsRequestIndexRename method reindex0.

@Override
public List<String> reindex0(Object target) {
    MultiTermVectorsRequest mreq = (MultiTermVectorsRequest) target;
    List list = mreq.getRequests();
    List<String> indexes = new ArrayList<String>();
    for (Object req : list) {
        if (req == null) {
            continue;
        }
        RequestIndexRename requestIndexRename = RequestIndexRenameProvider.get(req);
        if (requestIndexRename != null) {
            indexes.addAll(requestIndexRename.reindex(req));
        } else {
            throw new PressureMeasureError("elasticsearch " + req.getClass().getName() + " is not supported!");
        }
    }
    return indexes;
}
Also used : PressureMeasureError(com.pamirs.pradar.exception.PressureMeasureError) MultiTermVectorsRequest(org.elasticsearch.action.termvectors.MultiTermVectorsRequest) ArrayList(java.util.ArrayList) RequestIndexRename(com.pamirs.attach.plugin.es.common.RequestIndexRename) List(java.util.List) ArrayList(java.util.ArrayList)

Example 92 with PressureMeasureError

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

the class OpenIndexRequestIndexRename method reindex0.

@Override
public List<String> reindex0(Object target) {
    OpenIndexRequest req = (OpenIndexRequest) 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) OpenIndexRequest(org.elasticsearch.action.admin.indices.open.OpenIndexRequest)

Example 93 with PressureMeasureError

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

the class PutMappingRequestIndexRename method reindex0.

@Override
public List<String> reindex0(Object target) {
    PutMappingRequest req = (PutMappingRequest) 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;
        }
    }
    return Arrays.asList(indexes);
}
Also used : PutMappingRequest(org.elasticsearch.client.indices.PutMappingRequest) PressureMeasureError(com.pamirs.pradar.exception.PressureMeasureError)

Example 94 with PressureMeasureError

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

the class IndicesSegementsRequestIndexRename method reindex0.

@Override
public List<String> reindex0(Object target) {
    IndicesSegmentsRequest req = (IndicesSegmentsRequest) 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) IndicesSegmentsRequest(org.elasticsearch.action.admin.indices.segments.IndicesSegmentsRequest)

Example 95 with PressureMeasureError

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

the class IndicesShardStoresRequestIndexRename method reindex0.

@Override
public List<String> reindex0(Object target) {
    IndicesShardStoresRequest req = (IndicesShardStoresRequest) 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 : IndicesShardStoresRequest(org.elasticsearch.action.admin.indices.shards.IndicesShardStoresRequest) 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