use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Channel in project dble by actiontech.
the class AlarmAppender method append.
@Override
public void append(LogEvent event) {
if (stub == null && DbleStartup.isInitZKend()) {
// only if the dbleserver init config file finished than the config can be use for alert
try {
AlarmConfig config = DbleServer.getInstance().getConfig().getAlarm();
if (config != null && config.getUrl() != null) {
grpcLevel = "error".equalsIgnoreCase(config.getLevel()) ? 200 : 300;
serverId = config.getServerId();
port = Integer.parseInt(config.getPort());
grpcUrl = config.getUrl();
alertComponentId = config.getComponentId();
ushardCode = config.getComponentType();
Channel channel = ManagedChannelBuilder.forAddress(grpcUrl, port).usePlaintext(true).build();
stub = UcoreGrpc.newBlockingStub(channel);
}
} catch (Exception e) {
// config not ready yeat
return;
}
}
if (stub != null) {
if (grpcLevel >= event.getLevel().intLevel()) {
String data = new String(getLayout().toByteArray(event));
String[] d = data.split("::");
if (d.length >= 2) {
String level = event.getLevel().intLevel() == 300 ? "WARN" : "CRITICAL";
UcoreInterface.AlertInput inpurt = UcoreInterface.AlertInput.newBuilder().setCode(d[0]).setDesc(d[1]).setLevel(level).setSourceComponentType(ushardCode).setSourceComponentId(alertComponentId).setAlertComponentId(alertComponentId).setAlertComponentType(ushardCode).setServerId(serverId).setTimestampUnix(System.currentTimeMillis() * 1000000).build();
stub.alert(inpurt);
}
}
}
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Channel in project dble by actiontech.
the class UOffLineListener method init.
public void init() {
Channel channel = ManagedChannelBuilder.forAddress(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_PLUGINS_IP), Integer.parseInt(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build();
stub = UcoreGrpc.newBlockingStub(channel);
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Channel in project dble by actiontech.
the class UcoreSingleKeyListener method init.
public void init() {
Channel channel = ManagedChannelBuilder.forAddress(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_PLUGINS_IP), Integer.parseInt(UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_PLUGINS_PORT))).usePlaintext(true).build();
stub = UcoreGrpc.newBlockingStub(channel);
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Channel in project pinpoint by naver.
the class UnaryCallDeadlineInterceptorTest method withoutDeadlineTest.
@Test
public void withoutDeadlineTest() {
Channel channel = new TestChannel();
UnaryCallDeadlineInterceptor unaryCallDeadlineInterceptor = new UnaryCallDeadlineInterceptor(5000);
unaryCallDeadlineInterceptor.interceptCall(createMethodDescritor(MethodDescriptor.MethodType.BIDI_STREAMING), CallOptions.DEFAULT.withAuthority("test"), channel);
Assert.assertNull(((TestChannel) channel).callOptions.getDeadline());
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Channel in project pinpoint by naver.
the class UnaryCallDeadlineInterceptorTest method withDeadlineTest.
@Test
public void withDeadlineTest() {
Channel channel = new TestChannel();
UnaryCallDeadlineInterceptor unaryCallDeadlineInterceptor = new UnaryCallDeadlineInterceptor(5000);
ClientCall<PAgentInfo, PResult> pAgentInfoPResultClientCall = unaryCallDeadlineInterceptor.interceptCall(createMethodDescritor(MethodDescriptor.MethodType.UNARY), CallOptions.DEFAULT.withAuthority("test"), channel);
Assert.assertNotNull(((TestChannel) channel).callOptions.getDeadline());
}
Aggregations