use of org.apache.skywalking.apm.collector.storage.table.register.ServiceName in project incubator-skywalking by apache.
the class ServiceReferenceMetricAlarmAssertWorker method generateAlarmContent.
@Override
protected void generateAlarmContent(ServiceReferenceAlarm alarm, double threshold) {
ServiceName serviceName = serviceNameCacheService.get(alarm.getBehindServiceId());
String clientOrServer = "server";
if (MetricSource.Caller.getValue() == alarm.getSourceValue()) {
clientOrServer = "client";
}
if (AlarmType.ERROR_RATE.getValue() == alarm.getAlarmType()) {
alarm.setAlarmContent("The success rate of " + serviceName.getServiceName() + ", detected from " + clientOrServer + " side, is lower than " + threshold + " rate.");
} else if (AlarmType.SLOW_RTT.getValue() == alarm.getAlarmType()) {
alarm.setAlarmContent("Response time of " + serviceName.getServiceName() + ", detected from " + clientOrServer + " side, is slower than " + threshold + " ms.");
}
}
use of org.apache.skywalking.apm.collector.storage.table.register.ServiceName in project incubator-skywalking by apache.
the class ServiceNameH2CacheDAO method get.
@Override
public ServiceName get(int serviceId) {
H2Client client = getClient();
String sql = SqlBuilder.buildSql(GET_SERVICE_NAME_SQL, ServiceNameTable.COLUMN_APPLICATION_ID, ServiceNameTable.COLUMN_SERVICE_NAME, ServiceNameTable.TABLE, ServiceNameTable.COLUMN_SERVICE_ID);
Object[] params = new Object[] { serviceId };
try (ResultSet rs = client.executeQuery(sql, params)) {
if (rs.next()) {
ServiceName serviceName = new ServiceName();
serviceName.setServiceId(serviceId);
serviceName.setApplicationId(rs.getInt(ServiceNameTable.COLUMN_APPLICATION_ID));
serviceName.setServiceName(rs.getString(ServiceNameTable.COLUMN_SERVICE_NAME));
return serviceName;
}
} catch (SQLException | H2ClientException e) {
logger.error(e.getMessage(), e);
}
return null;
}
Aggregations