Search in sources :

Example 1 with InstanceReferenceAlarmList

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

the class InstanceReferenceAlarmListEsPersistenceDAO method get.

@Override
public InstanceReferenceAlarmList get(String id) {
    GetResponse getResponse = getClient().prepareGet(InstanceReferenceAlarmListTable.TABLE, id).get();
    if (getResponse.isExists()) {
        InstanceReferenceAlarmList serviceReferenceAlarmList = new InstanceReferenceAlarmList();
        serviceReferenceAlarmList.setId(id);
        Map<String, Object> source = getResponse.getSource();
        serviceReferenceAlarmList.setFrontApplicationId(((Number) source.get(InstanceReferenceAlarmListTable.COLUMN_FRONT_APPLICATION_ID)).intValue());
        serviceReferenceAlarmList.setBehindApplicationId(((Number) source.get(InstanceReferenceAlarmListTable.COLUMN_BEHIND_APPLICATION_ID)).intValue());
        serviceReferenceAlarmList.setFrontInstanceId(((Number) source.get(InstanceReferenceAlarmListTable.COLUMN_FRONT_INSTANCE_ID)).intValue());
        serviceReferenceAlarmList.setBehindInstanceId(((Number) source.get(InstanceReferenceAlarmListTable.COLUMN_BEHIND_INSTANCE_ID)).intValue());
        serviceReferenceAlarmList.setSourceValue(((Number) source.get(InstanceReferenceAlarmListTable.COLUMN_SOURCE_VALUE)).intValue());
        serviceReferenceAlarmList.setAlarmType(((Number) source.get(InstanceReferenceAlarmListTable.COLUMN_ALARM_TYPE)).intValue());
        serviceReferenceAlarmList.setAlarmContent((String) source.get(InstanceReferenceAlarmListTable.COLUMN_ALARM_CONTENT));
        serviceReferenceAlarmList.setTimeBucket(((Number) source.get(InstanceReferenceAlarmListTable.COLUMN_TIME_BUCKET)).longValue());
        return serviceReferenceAlarmList;
    } else {
        return null;
    }
}
Also used : InstanceReferenceAlarmList(org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarmList) GetResponse(org.elasticsearch.action.get.GetResponse)

Example 2 with InstanceReferenceAlarmList

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

the class InstanceReferenceMetricAlarmToListNodeProcessor method process.

@Override
public void process(InstanceReferenceAlarm instanceReferenceAlarm, Next<InstanceReferenceAlarmList> next) {
    String id = instanceReferenceAlarm.getLastTimeBucket() + Const.ID_SPLIT + instanceReferenceAlarm.getSourceValue() + Const.ID_SPLIT + instanceReferenceAlarm.getAlarmType() + Const.ID_SPLIT + instanceReferenceAlarm.getFrontInstanceId() + Const.ID_SPLIT + instanceReferenceAlarm.getBehindInstanceId();
    InstanceReferenceAlarmList instanceReferenceAlarmList = new InstanceReferenceAlarmList();
    instanceReferenceAlarmList.setId(id);
    instanceReferenceAlarmList.setFrontApplicationId(instanceReferenceAlarm.getFrontApplicationId());
    instanceReferenceAlarmList.setBehindApplicationId(instanceReferenceAlarm.getBehindApplicationId());
    instanceReferenceAlarmList.setFrontInstanceId(instanceReferenceAlarm.getFrontInstanceId());
    instanceReferenceAlarmList.setBehindInstanceId(instanceReferenceAlarm.getBehindInstanceId());
    instanceReferenceAlarmList.setSourceValue(instanceReferenceAlarm.getSourceValue());
    instanceReferenceAlarmList.setAlarmType(instanceReferenceAlarm.getAlarmType());
    instanceReferenceAlarmList.setTimeBucket(instanceReferenceAlarm.getLastTimeBucket());
    instanceReferenceAlarmList.setAlarmContent(instanceReferenceAlarm.getAlarmContent());
    next.execute(instanceReferenceAlarmList);
}
Also used : InstanceReferenceAlarmList(org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarmList)

Example 3 with InstanceReferenceAlarmList

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

the class InstanceReferenceAlarmListH2PersistenceDAO method h2DataToStreamData.

@Override
protected InstanceReferenceAlarmList h2DataToStreamData(ResultSet resultSet) throws SQLException {
    InstanceReferenceAlarmList instanceReferenceAlarmList = new InstanceReferenceAlarmList();
    instanceReferenceAlarmList.setId(resultSet.getString(InstanceReferenceAlarmListTable.COLUMN_ID));
    instanceReferenceAlarmList.setSourceValue(resultSet.getInt(InstanceReferenceAlarmListTable.COLUMN_SOURCE_VALUE));
    instanceReferenceAlarmList.setAlarmType(resultSet.getInt(InstanceReferenceAlarmListTable.COLUMN_ALARM_TYPE));
    instanceReferenceAlarmList.setFrontApplicationId(resultSet.getInt(InstanceReferenceAlarmListTable.COLUMN_FRONT_APPLICATION_ID));
    instanceReferenceAlarmList.setFrontInstanceId(resultSet.getInt(InstanceReferenceAlarmListTable.COLUMN_FRONT_INSTANCE_ID));
    instanceReferenceAlarmList.setBehindApplicationId(resultSet.getInt(InstanceReferenceAlarmListTable.COLUMN_BEHIND_APPLICATION_ID));
    instanceReferenceAlarmList.setBehindInstanceId(resultSet.getInt(InstanceReferenceAlarmListTable.COLUMN_BEHIND_INSTANCE_ID));
    instanceReferenceAlarmList.setTimeBucket(resultSet.getLong(InstanceReferenceAlarmListTable.COLUMN_TIME_BUCKET));
    instanceReferenceAlarmList.setAlarmContent(resultSet.getString(InstanceReferenceAlarmListTable.COLUMN_ALARM_CONTENT));
    return instanceReferenceAlarmList;
}
Also used : InstanceReferenceAlarmList(org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarmList)

Aggregations

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