Search in sources :

Example 1 with InstanceReferenceAlarm

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

the class InstanceReferenceAlarmEsPersistenceDAO method get.

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

Example 2 with InstanceReferenceAlarm

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

the class InstanceReferenceMetricAlarmAssertWorker method newAlarmObject.

@Override
protected InstanceReferenceAlarm newAlarmObject(String id, InstanceReferenceMetric inputMetric) {
    InstanceReferenceAlarm instanceReferenceAlarm = new InstanceReferenceAlarm();
    instanceReferenceAlarm.setId(id + Const.ID_SPLIT + inputMetric.getFrontInstanceId() + Const.ID_SPLIT + inputMetric.getBehindInstanceId());
    instanceReferenceAlarm.setFrontApplicationId(inputMetric.getFrontApplicationId());
    instanceReferenceAlarm.setBehindApplicationId(inputMetric.getBehindApplicationId());
    instanceReferenceAlarm.setFrontInstanceId(inputMetric.getFrontInstanceId());
    instanceReferenceAlarm.setBehindInstanceId(inputMetric.getBehindInstanceId());
    return instanceReferenceAlarm;
}
Also used : InstanceReferenceAlarm(org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarm)

Example 3 with InstanceReferenceAlarm

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

the class InstanceReferenceAlarmH2PersistenceDAO method h2DataToStreamData.

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

Aggregations

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