Search in sources :

Example 1 with ConfigPair

use of org.apache.hadoop.tracing.TraceAdminPB.ConfigPair in project hadoop by apache.

the class TraceAdminProtocolServerSideTranslatorPB method addSpanReceiver.

@Override
public AddSpanReceiverResponseProto addSpanReceiver(RpcController controller, AddSpanReceiverRequestProto req) throws ServiceException {
    try {
        SpanReceiverInfoBuilder factory = new SpanReceiverInfoBuilder(req.getClassName());
        for (ConfigPair config : req.getConfigList()) {
            factory.addConfigurationPair(config.getKey(), config.getValue());
        }
        long id = server.addSpanReceiver(factory.build());
        return AddSpanReceiverResponseProto.newBuilder().setId(id).build();
    } catch (IOException e) {
        throw new ServiceException(e);
    }
}
Also used : ConfigPair(org.apache.hadoop.tracing.TraceAdminPB.ConfigPair) ServiceException(com.google.protobuf.ServiceException) IOException(java.io.IOException)

Example 2 with ConfigPair

use of org.apache.hadoop.tracing.TraceAdminPB.ConfigPair in project hadoop by apache.

the class TraceAdminProtocolTranslatorPB method addSpanReceiver.

@Override
public long addSpanReceiver(SpanReceiverInfo info) throws IOException {
    try {
        AddSpanReceiverRequestProto.Builder bld = AddSpanReceiverRequestProto.newBuilder();
        bld.setClassName(info.getClassName());
        for (ConfigurationPair configPair : info.configPairs) {
            ConfigPair tuple = ConfigPair.newBuilder().setKey(configPair.getKey()).setValue(configPair.getValue()).build();
            bld.addConfig(tuple);
        }
        AddSpanReceiverResponseProto resp = rpcProxy.addSpanReceiver(null, bld.build());
        return resp.getId();
    } catch (ServiceException e) {
        throw ProtobufHelper.getRemoteException(e);
    }
}
Also used : ConfigPair(org.apache.hadoop.tracing.TraceAdminPB.ConfigPair) AddSpanReceiverResponseProto(org.apache.hadoop.tracing.TraceAdminPB.AddSpanReceiverResponseProto) ServiceException(com.google.protobuf.ServiceException) AddSpanReceiverRequestProto(org.apache.hadoop.tracing.TraceAdminPB.AddSpanReceiverRequestProto) ConfigurationPair(org.apache.hadoop.tracing.SpanReceiverInfo.ConfigurationPair)

Aggregations

ServiceException (com.google.protobuf.ServiceException)2 ConfigPair (org.apache.hadoop.tracing.TraceAdminPB.ConfigPair)2 IOException (java.io.IOException)1 ConfigurationPair (org.apache.hadoop.tracing.SpanReceiverInfo.ConfigurationPair)1 AddSpanReceiverRequestProto (org.apache.hadoop.tracing.TraceAdminPB.AddSpanReceiverRequestProto)1 AddSpanReceiverResponseProto (org.apache.hadoop.tracing.TraceAdminPB.AddSpanReceiverResponseProto)1