Search in sources :

Example 46 with GetResponse

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.get.GetResponse in project incubator-skywalking by apache.

the class NetworkAddressEsCacheDAO method getAddressById.

@Override
public String getAddressById(int addressId) {
    logger.debug("get network address, address id: {}", addressId);
    ElasticSearchClient client = getClient();
    GetRequestBuilder getRequestBuilder = client.prepareGet(NetworkAddressTable.TABLE, String.valueOf(addressId));
    GetResponse getResponse = getRequestBuilder.get();
    if (getResponse.isExists()) {
        return (String) getResponse.getSource().get(NetworkAddressTable.COLUMN_NETWORK_ADDRESS);
    }
    return Const.EMPTY_STRING;
}
Also used : ElasticSearchClient(org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient) GetResponse(org.elasticsearch.action.get.GetResponse) GetRequestBuilder(org.elasticsearch.action.get.GetRequestBuilder)

Example 47 with GetResponse

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.get.GetResponse in project incubator-skywalking by apache.

the class ApplicationAlarmEsPersistenceDAO method get.

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

Example 48 with GetResponse

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.get.GetResponse in project incubator-skywalking by apache.

the class ApplicationReferenceAlarmListEsPersistenceDAO method get.

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

Example 49 with GetResponse

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.get.GetResponse 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 50 with GetResponse

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.get.GetResponse in project incubator-skywalking by apache.

the class ServiceAlarmEsPersistenceDAO method get.

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

Aggregations

GetResponse (org.elasticsearch.action.get.GetResponse)167 Test (org.junit.Test)50 GetRequest (org.elasticsearch.action.get.GetRequest)28 Map (java.util.Map)27 MultiGetResponse (org.elasticsearch.action.get.MultiGetResponse)26 ArrayList (java.util.ArrayList)23 HashMap (java.util.HashMap)21 Date (java.util.Date)18 ESSyncConfig (com.alibaba.otter.canal.client.adapter.es.core.config.ESSyncConfig)17 Dml (com.alibaba.otter.canal.client.adapter.support.Dml)17 LinkedHashMap (java.util.LinkedHashMap)17 IOException (java.io.IOException)16 DataSource (javax.sql.DataSource)14 GetRequestBuilder (org.elasticsearch.action.get.GetRequestBuilder)14 SearchResponse (org.elasticsearch.action.search.SearchResponse)14 DeleteResponse (org.elasticsearch.action.delete.DeleteResponse)12 ElasticsearchException (org.elasticsearch.ElasticsearchException)10 Settings (org.elasticsearch.common.settings.Settings)10 Alias (org.elasticsearch.action.admin.indices.alias.Alias)7 IndexResponse (org.elasticsearch.action.index.IndexResponse)7