Search in sources :

Example 1 with ServiceAlarmList

use of org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarmList in project incubator-skywalking by apache.

the class ServiceAlarmListEsPersistenceDAO method get.

@Override
public ServiceAlarmList get(String id) {
    GetResponse getResponse = getClient().prepareGet(ServiceAlarmListTable.TABLE, id).get();
    if (getResponse.isExists()) {
        ServiceAlarmList serviceAlarmList = new ServiceAlarmList();
        serviceAlarmList.setId(id);
        Map<String, Object> source = getResponse.getSource();
        serviceAlarmList.setApplicationId(((Number) source.get(ServiceAlarmListTable.COLUMN_APPLICATION_ID)).intValue());
        serviceAlarmList.setInstanceId(((Number) source.get(ServiceAlarmListTable.COLUMN_INSTANCE_ID)).intValue());
        serviceAlarmList.setServiceId(((Number) source.get(ServiceAlarmListTable.COLUMN_SERVICE_ID)).intValue());
        serviceAlarmList.setSourceValue(((Number) source.get(ServiceAlarmListTable.COLUMN_SOURCE_VALUE)).intValue());
        serviceAlarmList.setAlarmType(((Number) source.get(ServiceAlarmListTable.COLUMN_ALARM_TYPE)).intValue());
        serviceAlarmList.setAlarmContent((String) source.get(ServiceAlarmListTable.COLUMN_ALARM_CONTENT));
        serviceAlarmList.setTimeBucket(((Number) source.get(ServiceAlarmListTable.COLUMN_TIME_BUCKET)).longValue());
        return serviceAlarmList;
    } else {
        return null;
    }
}
Also used : GetResponse(org.elasticsearch.action.get.GetResponse) ServiceAlarmList(org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarmList)

Example 2 with ServiceAlarmList

use of org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarmList in project incubator-skywalking by apache.

the class ServiceMetricAlarmToListNodeProcessor method process.

@Override
public void process(ServiceAlarm serviceAlarm, Next<ServiceAlarmList> next) {
    String id = serviceAlarm.getLastTimeBucket() + Const.ID_SPLIT + serviceAlarm.getSourceValue() + Const.ID_SPLIT + serviceAlarm.getAlarmType() + Const.ID_SPLIT + serviceAlarm.getServiceId();
    ServiceAlarmList serviceAlarmList = new ServiceAlarmList();
    serviceAlarmList.setId(id);
    serviceAlarmList.setApplicationId(serviceAlarm.getApplicationId());
    serviceAlarmList.setInstanceId(serviceAlarm.getInstanceId());
    serviceAlarmList.setServiceId(serviceAlarm.getServiceId());
    serviceAlarmList.setSourceValue(serviceAlarm.getSourceValue());
    serviceAlarmList.setAlarmType(serviceAlarm.getAlarmType());
    serviceAlarmList.setTimeBucket(serviceAlarm.getLastTimeBucket());
    serviceAlarmList.setAlarmContent(serviceAlarm.getAlarmContent());
    next.execute(serviceAlarmList);
}
Also used : ServiceAlarmList(org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarmList)

Example 3 with ServiceAlarmList

use of org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarmList in project incubator-skywalking by apache.

the class ServiceAlarmListH2PersistenceDAO method h2DataToStreamData.

@Override
protected ServiceAlarmList h2DataToStreamData(ResultSet resultSet) throws SQLException {
    ServiceAlarmList serviceAlarmList = new ServiceAlarmList();
    serviceAlarmList.setId(resultSet.getString(ServiceAlarmListTable.COLUMN_ID));
    serviceAlarmList.setSourceValue(resultSet.getInt(ServiceAlarmListTable.COLUMN_SOURCE_VALUE));
    serviceAlarmList.setAlarmType(resultSet.getInt(ServiceAlarmListTable.COLUMN_ALARM_TYPE));
    serviceAlarmList.setApplicationId(resultSet.getInt(ServiceAlarmListTable.COLUMN_APPLICATION_ID));
    serviceAlarmList.setInstanceId(resultSet.getInt(ServiceAlarmListTable.COLUMN_INSTANCE_ID));
    serviceAlarmList.setServiceId(resultSet.getInt(ServiceAlarmListTable.COLUMN_SERVICE_ID));
    serviceAlarmList.setTimeBucket(resultSet.getLong(ServiceAlarmListTable.COLUMN_TIME_BUCKET));
    serviceAlarmList.setAlarmContent(resultSet.getString(ServiceAlarmListTable.COLUMN_ALARM_CONTENT));
    return serviceAlarmList;
}
Also used : ServiceAlarmList(org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarmList)

Aggregations

ServiceAlarmList (org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarmList)3 GetResponse (org.elasticsearch.action.get.GetResponse)1