You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by pe...@apache.org on 2018/08/18 06:14:37 UTC
[incubator-skywalking] branch 6.0 updated: All of the inventory
register test success.
This is an automated email from the ASF dual-hosted git repository.
pengys pushed a commit to branch 6.0
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git
The following commit(s) were added to refs/heads/6.0 by this push:
new 4c04a59 All of the inventory register test success.
4c04a59 is described below
commit 4c04a599c45d2fdd50cffbf858857798acb512cb
Author: peng-yongsheng <80...@qq.com>
AuthorDate: Sat Aug 18 14:14:28 2018 +0800
All of the inventory register test success.
---
.../transform/SpringSleuthSegmentBuilderTest.java | 6 +-
.../apm/agent/core/context/ContextCarrier.java | 2 +-
.../server/core/cache/EndpointInventoryCache.java | 6 +-
.../server/core/cache/ServiceInventoryCache.java | 13 ++--
.../core/register/ServiceInstanceInventory.java | 42 ++++++++++---
.../service/EndpointInventoryRegister.java | 3 +
.../service/IServiceInstanceInventoryRegister.java | 4 +-
.../service/NetworkAddressInventoryRegister.java | 1 +
.../service/ServiceInstanceInventoryRegister.java | 13 +++-
.../register/provider/RegisterModuleProvider.java | 2 +
.../handler/v5/ApplicationRegisterHandler.java | 2 +-
.../v5/InstanceDiscoveryServiceHandler.java | 70 ++++++++++++++++++++++
...a => NetworkAddressRegisterServiceHandler.java} | 30 ++++++----
.../v5/ApplicationRegisterHandlerTestCase.java | 2 +-
...> InstanceDiscoveryServiceHandlerTestCase.java} | 24 +++++---
...workAddressRegisterServiceHandlerTestCase.java} | 17 +++---
.../v5/ServiceNameDiscoveryHandlerTestCase.java | 3 +-
.../src/test/resources/log4j2.xml | 4 +-
.../elasticsearch/base/ColumnTypeEsMapping.java | 2 +-
.../cache/EndpointInventoryCacheEsDAO.java | 2 +-
.../cache/NetworkAddressInventoryCacheEsDAO.java | 2 +-
.../cache/ServiceInstanceInventoryCacheDAO.java | 2 +-
.../cache/ServiceInventoryCacheEsDAO.java | 2 +-
.../elasticsearch/lock/RegisterLockInstaller.java | 1 +
24 files changed, 192 insertions(+), 63 deletions(-)
diff --git a/apm-collector/apm-collector-thirdparty-receiver/receiver-zipkin/receiver-zipkin-provider/src/test/java/org/apache/skywalking/apm/collector/receiver/zipkin/provider/transform/SpringSleuthSegmentBuilderTest.java b/apm-collector/apm-collector-thirdparty-receiver/receiver-zipkin/receiver-zipkin-provider/src/test/java/org/apache/skywalking/apm/collector/receiver/zipkin/provider/transform/SpringSleuthSegmentBuilderTest.java
index 16a673a..21f0347 100644
--- a/apm-collector/apm-collector-thirdparty-receiver/receiver-zipkin/receiver-zipkin-provider/src/test/java/org/apache/skywalking/apm/collector/receiver/zipkin/provider/transform/SpringSleuthSegmentBuilderTest.java
+++ b/apm-collector/apm-collector-thirdparty-receiver/receiver-zipkin/receiver-zipkin-provider/src/test/java/org/apache/skywalking/apm/collector/receiver/zipkin/provider/transform/SpringSleuthSegmentBuilderTest.java
@@ -125,11 +125,11 @@ public class SpringSleuthSegmentBuilderTest implements SegmentListener {
private List<Span> buildSpringSleuthExampleTrace() throws UnsupportedEncodingException {
List<Span> spans = new LinkedList<>();
- String span = "{\"traceId\":\"5b0e64354eea4fa71a8a1b5bdd791b8a\",\"id\":\"1a8a1b5bdd791b8a\",\"kind\":\"SERVER\",\"name\":\"get /\",\"timestamp\":1527669813700123,\"duration\":11295,\"localEndpoint\":{\"serviceName\":\"frontend\",\"ipv4\":\"192.168.72.220\"},\"remoteEndpoint\":{\"ipv6\":\"::1\",\"port\":55146},\"tags\":{\"http.method\":\"GET\",\"http.path\":\"/\",\"mvc.controller.class\":\"Frontend\",\"mvc.controller.method\":\"callBackend\"}}";
+ String span = "{\"traceId\":\"5b0e64354eea4fa71a8a1b5bdd791b8a\",\"id\":\"1a8a1b5bdd791b8a\",\"kind\":\"SERVER\",\"name\":\"get /\",\"timestamp\":1527669813700123,\"duration\":11295,\"localEndpoint\":{\"serviceName\":\"frontend\",\"ipv4s\":\"192.168.72.220\"},\"remoteEndpoint\":{\"ipv6\":\"::1\",\"port\":55146},\"tags\":{\"http.method\":\"GET\",\"http.path\":\"/\",\"mvc.controller.class\":\"Frontend\",\"mvc.controller.method\":\"callBackend\"}}";
spans.add(SpanBytesDecoder.JSON_V2.decodeOne(span.getBytes("UTF-8")));
- span = "{\"traceId\":\"5b0e64354eea4fa71a8a1b5bdd791b8a\",\"parentId\":\"1a8a1b5bdd791b8a\",\"id\":\"d7d5b93dcda767c8\",\"kind\":\"CLIENT\",\"name\":\"get\",\"timestamp\":1527669813702456,\"duration\":6672,\"localEndpoint\":{\"serviceName\":\"frontend\",\"ipv4\":\"192.168.72.220\"},\"tags\":{\"http.method\":\"GET\",\"http.path\":\"/api\"}}";
+ span = "{\"traceId\":\"5b0e64354eea4fa71a8a1b5bdd791b8a\",\"parentId\":\"1a8a1b5bdd791b8a\",\"id\":\"d7d5b93dcda767c8\",\"kind\":\"CLIENT\",\"name\":\"get\",\"timestamp\":1527669813702456,\"duration\":6672,\"localEndpoint\":{\"serviceName\":\"frontend\",\"ipv4s\":\"192.168.72.220\"},\"tags\":{\"http.method\":\"GET\",\"http.path\":\"/api\"}}";
spans.add(SpanBytesDecoder.JSON_V2.decodeOne(span.getBytes("UTF-8")));
- span = "{\"traceId\":\"5b0e64354eea4fa71a8a1b5bdd791b8a\",\"parentId\":\"1a8a1b5bdd791b8a\",\"id\":\"d7d5b93dcda767c8\",\"kind\":\"SERVER\",\"name\":\"get /api\",\"timestamp\":1527669813705106,\"duration\":4802,\"localEndpoint\":{\"serviceName\":\"backend\",\"ipv4\":\"192.168.72.220\"},\"remoteEndpoint\":{\"ipv4\":\"127.0.0.1\",\"port\":55147},\"tags\":{\"http.method\":\"GET\",\"http.path\":\"/api\",\"mvc.controller.class\":\"Backend\",\"mvc.controller.method\":\"printDate\"},\"s [...]
+ span = "{\"traceId\":\"5b0e64354eea4fa71a8a1b5bdd791b8a\",\"parentId\":\"1a8a1b5bdd791b8a\",\"id\":\"d7d5b93dcda767c8\",\"kind\":\"SERVER\",\"name\":\"get /api\",\"timestamp\":1527669813705106,\"duration\":4802,\"localEndpoint\":{\"serviceName\":\"backend\",\"ipv4s\":\"192.168.72.220\"},\"remoteEndpoint\":{\"ipv4s\":\"127.0.0.1\",\"port\":55147},\"tags\":{\"http.method\":\"GET\",\"http.path\":\"/api\",\"mvc.controller.class\":\"Backend\",\"mvc.controller.method\":\"printDate\"},\ [...]
spans.add(SpanBytesDecoder.JSON_V2.decodeOne(span.getBytes("UTF-8")));
return SpanBytesDecoder.JSON_V2.decodeList(spans.toString().getBytes("UTF-8"));
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/ContextCarrier.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/ContextCarrier.java
index b45c805..52c5ae8 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/ContextCarrier.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/ContextCarrier.java
@@ -57,7 +57,7 @@ public class ContextCarrier implements Serializable {
private int entryApplicationInstanceId = DictionaryUtil.nullValue();
/**
- * peer(ipv4/ipv6/hostname + port) of the server, from client side.
+ * peer(ipv4s/ipv6/hostname + port) of the server, from client side.
*/
private String peerHost;
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/cache/EndpointInventoryCache.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/cache/EndpointInventoryCache.java
index b46c34d..8cce526 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/cache/EndpointInventoryCache.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/cache/EndpointInventoryCache.java
@@ -52,18 +52,18 @@ public class EndpointInventoryCache implements Service {
}
return cacheDAO;
}
-
+
public int getEndpointId(int serviceId, String endpointName) {
String id = EndpointInventory.buildId(serviceId, endpointName);
int endpointId = Const.NONE;
try {
- endpointId = endpointNameCache.get(EndpointInventory.buildId(serviceId, endpointName), () -> getCacheDAO().getEndpointId(serviceId, endpointName));
+ endpointId = endpointNameCache.get(id, () -> getCacheDAO().getEndpointId(serviceId, endpointName));
} catch (Throwable e) {
logger.error(e.getMessage(), e);
}
- if (serviceId == Const.NONE) {
+ if (endpointId == Const.NONE) {
endpointId = getCacheDAO().getEndpointId(serviceId, endpointName);
if (endpointId != Const.NONE) {
endpointNameCache.put(id, endpointId);
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/cache/ServiceInventoryCache.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/cache/ServiceInventoryCache.java
index e4cf969..4213aca 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/cache/ServiceInventoryCache.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/cache/ServiceInventoryCache.java
@@ -19,6 +19,7 @@
package org.apache.skywalking.oap.server.core.cache;
import com.google.common.cache.*;
+import org.apache.skywalking.oap.server.core.Const;
import org.apache.skywalking.oap.server.core.register.ServiceInventory;
import org.apache.skywalking.oap.server.core.storage.StorageModule;
import org.apache.skywalking.oap.server.core.storage.cache.IServiceInventoryCacheDAO;
@@ -53,16 +54,16 @@ public class ServiceInventoryCache implements Service {
}
public int getServiceId(String serviceName) {
- int serviceId = 0;
+ int serviceId = Const.NONE;
try {
serviceId = serviceNameCache.get(ServiceInventory.buildId(serviceName), () -> getCacheDAO().getServiceId(serviceName));
} catch (Throwable e) {
logger.error(e.getMessage(), e);
}
- if (serviceId == 0) {
+ if (serviceId == Const.NONE) {
serviceId = getCacheDAO().getServiceId(serviceName);
- if (serviceId != 0) {
+ if (serviceId != Const.NONE) {
serviceNameCache.put(ServiceInventory.buildId(serviceName), serviceId);
}
}
@@ -70,16 +71,16 @@ public class ServiceInventoryCache implements Service {
}
public int getServiceId(int addressId) {
- int serviceId = 0;
+ int serviceId = Const.NONE;
try {
serviceId = addressIdCache.get(ServiceInventory.buildId(addressId), () -> getCacheDAO().getServiceId(addressId));
} catch (Throwable e) {
logger.error(e.getMessage(), e);
}
- if (serviceId == 0) {
+ if (serviceId == Const.NONE) {
serviceId = getCacheDAO().getServiceId(addressId);
- if (serviceId != 0) {
+ if (serviceId != Const.NONE) {
addressIdCache.put(ServiceInventory.buildId(addressId), serviceId);
}
}
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/ServiceInstanceInventory.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/ServiceInstanceInventory.java
index 723244e..dc6807c 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/ServiceInstanceInventory.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/ServiceInstanceInventory.java
@@ -18,6 +18,8 @@
package org.apache.skywalking.oap.server.core.register;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
import java.util.*;
import lombok.*;
import org.apache.skywalking.oap.server.core.Const;
@@ -40,13 +42,13 @@ public class ServiceInstanceInventory extends RegisterSource {
public static final String MODEL_NAME = "service_instance_inventory";
public static final String NAME = "name";
- public static final String SERVICE_ID = "service_id";
- public static final String IS_ADDRESS = "is_address";
- public static final String ADDRESS_ID = "address_id";
+ private static final String SERVICE_ID = "service_id";
+ private static final String IS_ADDRESS = "is_address";
+ private static final String ADDRESS_ID = "address_id";
private static final String OS_NAME = "os_name";
private static final String HOST_NAME = "host_name";
private static final String PROCESS_NO = "process_no";
- private static final String IPV4 = "ipv4";
+ private static final String IPV4S = "ipv4s";
@Setter @Getter @Column(columnName = NAME, matchQuery = true) private String name = Const.EMPTY_STRING;
@Setter @Getter @Column(columnName = SERVICE_ID) private int serviceId;
@@ -55,7 +57,7 @@ public class ServiceInstanceInventory extends RegisterSource {
@Setter @Getter @Column(columnName = OS_NAME) private String osName;
@Setter @Getter @Column(columnName = HOST_NAME) private String hostName;
@Setter @Getter @Column(columnName = PROCESS_NO) private int processNo;
- @Setter @Getter @Column(columnName = IPV4) private String ipv4;
+ @Setter @Getter @Column(columnName = IPV4S) private String ipv4s;
public static String buildId(int serviceId, String serviceInstanceName) {
return serviceId + Const.ID_SPLIT + serviceInstanceName + Const.ID_SPLIT + BooleanUtils.FALSE + Const.ID_SPLIT + Const.NONE;
@@ -117,7 +119,7 @@ public class ServiceInstanceInventory extends RegisterSource {
remoteBuilder.setDataStrings(0, name);
remoteBuilder.setDataStrings(1, osName);
remoteBuilder.setDataStrings(2, hostName);
- remoteBuilder.setDataStrings(3, ipv4);
+ remoteBuilder.setDataStrings(3, ipv4s);
return remoteBuilder;
}
@@ -134,7 +136,7 @@ public class ServiceInstanceInventory extends RegisterSource {
setName(remoteData.getDataStrings(0));
setOsName(remoteData.getDataStrings(1));
setHostName(remoteData.getDataStrings(2));
- setIpv4(remoteData.getDataStrings(3));
+ setIpv4s(remoteData.getDataStrings(3));
}
public static class Builder implements StorageBuilder<ServiceInstanceInventory> {
@@ -153,7 +155,7 @@ public class ServiceInstanceInventory extends RegisterSource {
inventory.setName((String)dbMap.get(NAME));
inventory.setOsName((String)dbMap.get(OS_NAME));
inventory.setHostName((String)dbMap.get(HOST_NAME));
- inventory.setIpv4((String)dbMap.get(IPV4));
+ inventory.setIpv4s((String)dbMap.get(IPV4S));
return inventory;
}
@@ -171,8 +173,30 @@ public class ServiceInstanceInventory extends RegisterSource {
map.put(NAME, storageData.getName());
map.put(OS_NAME, storageData.getOsName());
map.put(HOST_NAME, storageData.getHostName());
- map.put(IPV4, storageData.getIpv4());
+ map.put(IPV4S, storageData.getIpv4s());
return map;
}
}
+
+ public static class AgentOsInfo {
+ @Setter @Getter private String osName;
+ @Setter @Getter private String hostname;
+ @Setter @Getter private int processNo;
+ @Getter private List<String> ipv4s;
+
+ public AgentOsInfo() {
+ this.ipv4s = new ArrayList<>();
+ }
+
+ public static String ipv4sSerialize(List<String> ipv4) {
+ Gson gson = new Gson();
+ return gson.toJson(ipv4);
+ }
+
+ public static List<String> ipv4sDeserialize(String ipv4s) {
+ Gson gson = new Gson();
+ return gson.fromJson(ipv4s, new TypeToken<List<String>>() {
+ }.getType());
+ }
+ }
}
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/EndpointInventoryRegister.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/EndpointInventoryRegister.java
index 8bfa355..b3cd3dc 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/EndpointInventoryRegister.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/EndpointInventoryRegister.java
@@ -21,6 +21,7 @@ package org.apache.skywalking.oap.server.core.register.service;
import org.apache.skywalking.oap.server.core.*;
import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache;
import org.apache.skywalking.oap.server.core.register.EndpointInventory;
+import org.apache.skywalking.oap.server.core.register.worker.InventoryProcess;
import org.apache.skywalking.oap.server.library.module.ModuleManager;
import org.slf4j.*;
@@ -59,6 +60,8 @@ public class EndpointInventoryRegister implements IEndpointInventoryRegister {
long now = System.currentTimeMillis();
endpointInventory.setRegisterTime(now);
endpointInventory.setHeartbeatTime(now);
+
+ InventoryProcess.INSTANCE.in(endpointInventory);
}
return endpointId;
}
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/IServiceInstanceInventoryRegister.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/IServiceInstanceInventoryRegister.java
index fd5a38a..acee9a8 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/IServiceInstanceInventoryRegister.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/IServiceInstanceInventoryRegister.java
@@ -18,6 +18,7 @@
package org.apache.skywalking.oap.server.core.register.service;
+import org.apache.skywalking.oap.server.core.register.ServiceInstanceInventory;
import org.apache.skywalking.oap.server.library.module.Service;
/**
@@ -25,7 +26,8 @@ import org.apache.skywalking.oap.server.library.module.Service;
*/
public interface IServiceInstanceInventoryRegister extends Service {
- int getOrCreate(int serviceId, String serviceInstanceName, long registerTime);
+ int getOrCreate(int serviceId, String serviceInstanceName, long registerTime,
+ ServiceInstanceInventory.AgentOsInfo osInfo);
int getOrCreate(int serviceId, int addressId, long registerTime);
}
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/NetworkAddressInventoryRegister.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/NetworkAddressInventoryRegister.java
index ba29702..ba7f107 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/NetworkAddressInventoryRegister.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/NetworkAddressInventoryRegister.java
@@ -81,6 +81,7 @@ public class NetworkAddressInventoryRegister implements INetworkAddressInventory
long now = System.currentTimeMillis();
newNetworkAddress.setRegisterTime(now);
newNetworkAddress.setHeartbeatTime(now);
+
InventoryProcess.INSTANCE.in(newNetworkAddress);
}
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/ServiceInstanceInventoryRegister.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/ServiceInstanceInventoryRegister.java
index a4b99eb..bf67627 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/ServiceInstanceInventoryRegister.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/ServiceInstanceInventoryRegister.java
@@ -18,9 +18,10 @@
package org.apache.skywalking.oap.server.core.register.service;
-import org.apache.skywalking.oap.server.core.*;
+import org.apache.skywalking.oap.server.core.Const;
import org.apache.skywalking.oap.server.core.register.ServiceInstanceInventory;
import org.apache.skywalking.oap.server.core.register.worker.InventoryProcess;
+import org.apache.skywalking.oap.server.core.storage.StorageModule;
import org.apache.skywalking.oap.server.core.storage.cache.IServiceInstanceInventoryCacheDAO;
import org.apache.skywalking.oap.server.library.module.ModuleManager;
import org.apache.skywalking.oap.server.library.util.BooleanUtils;
@@ -44,12 +45,13 @@ public class ServiceInstanceInventoryRegister implements IServiceInstanceInvento
private IServiceInstanceInventoryCacheDAO getCacheDAO() {
if (isNull(cacheDAO)) {
- cacheDAO = moduleManager.find(CoreModule.NAME).getService(IServiceInstanceInventoryCacheDAO.class);
+ cacheDAO = moduleManager.find(StorageModule.NAME).getService(IServiceInstanceInventoryCacheDAO.class);
}
return cacheDAO;
}
- @Override public int getOrCreate(int serviceId, String serviceInstanceName, long registerTime) {
+ @Override public int getOrCreate(int serviceId, String serviceInstanceName, long registerTime,
+ ServiceInstanceInventory.AgentOsInfo osInfo) {
if (logger.isDebugEnabled()) {
logger.debug("Get or create service instance by service instance name, service id: {}, service instance name: {}, registerTime: {}", serviceId, serviceInstanceName, registerTime);
}
@@ -66,6 +68,11 @@ public class ServiceInstanceInventoryRegister implements IServiceInstanceInvento
serviceInstanceInventory.setRegisterTime(registerTime);
serviceInstanceInventory.setHeartbeatTime(registerTime);
+ serviceInstanceInventory.setOsName(osInfo.getOsName());
+ serviceInstanceInventory.setHostName(osInfo.getHostname());
+ serviceInstanceInventory.setProcessNo(osInfo.getProcessNo());
+ serviceInstanceInventory.setIpv4s(ServiceInstanceInventory.AgentOsInfo.ipv4sSerialize(osInfo.getIpv4s()));
+
InventoryProcess.INSTANCE.in(serviceInstanceInventory);
}
return serviceInstanceId;
diff --git a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/RegisterModuleProvider.java b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/RegisterModuleProvider.java
index 38fd9bf..6a1706a 100644
--- a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/RegisterModuleProvider.java
+++ b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/RegisterModuleProvider.java
@@ -47,7 +47,9 @@ public class RegisterModuleProvider extends ModuleProvider {
@Override public void start() {
GRPCHandlerRegister grpcHandlerRegister = getManager().find(CoreModule.NAME).getService(GRPCHandlerRegister.class);
grpcHandlerRegister.addHandler(new ApplicationRegisterHandler(getManager()));
+ grpcHandlerRegister.addHandler(new InstanceDiscoveryServiceHandler(getManager()));
grpcHandlerRegister.addHandler(new ServiceNameDiscoveryHandler(getManager()));
+ grpcHandlerRegister.addHandler(new NetworkAddressRegisterServiceHandler(getManager()));
}
@Override public void notifyAfterCompleted() {
diff --git a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/ApplicationRegisterHandler.java b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/ApplicationRegisterHandler.java
index 97b3aca..ea698bc 100644
--- a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/ApplicationRegisterHandler.java
+++ b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/ApplicationRegisterHandler.java
@@ -42,7 +42,7 @@ public class ApplicationRegisterHandler extends ApplicationRegisterServiceGrpc.A
@Override
public void applicationCodeRegister(Application request, StreamObserver<ApplicationMapping> responseObserver) {
if (logger.isDebugEnabled()) {
- logger.debug("register application");
+ logger.debug("Register application, application code: {}", request.getApplicationCode());
}
ApplicationMapping.Builder builder = ApplicationMapping.newBuilder();
diff --git a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/InstanceDiscoveryServiceHandler.java b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/InstanceDiscoveryServiceHandler.java
new file mode 100644
index 0000000..4295b09
--- /dev/null
+++ b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/InstanceDiscoveryServiceHandler.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.server.receiver.register.provider.handler.v5;
+
+import io.grpc.stub.StreamObserver;
+import org.apache.skywalking.apm.network.language.agent.*;
+import org.apache.skywalking.oap.server.core.CoreModule;
+import org.apache.skywalking.oap.server.core.register.ServiceInstanceInventory;
+import org.apache.skywalking.oap.server.core.register.service.IServiceInstanceInventoryRegister;
+import org.apache.skywalking.oap.server.library.module.ModuleManager;
+import org.apache.skywalking.oap.server.library.server.grpc.GRPCHandler;
+import org.slf4j.*;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstanceDiscoveryServiceHandler extends InstanceDiscoveryServiceGrpc.InstanceDiscoveryServiceImplBase implements GRPCHandler {
+
+ private static final Logger logger = LoggerFactory.getLogger(InstanceDiscoveryServiceHandler.class);
+
+ private final IServiceInstanceInventoryRegister serviceInstanceInventoryRegister;
+// private final IInstanceHeartBeatService instanceHeartBeatService;
+
+ public InstanceDiscoveryServiceHandler(ModuleManager moduleManager) {
+ this.serviceInstanceInventoryRegister = moduleManager.find(CoreModule.NAME).getService(IServiceInstanceInventoryRegister.class);
+// this.instanceHeartBeatService = moduleManager.find(CoreModule.NAME).getService(IInstanceHeartBeatService.class);
+ }
+
+ @Override
+ public void registerInstance(ApplicationInstance request,
+ StreamObserver<ApplicationInstanceMapping> responseObserver) {
+ OSInfo osinfo = request.getOsinfo();
+ ServiceInstanceInventory.AgentOsInfo agentOsInfo = new ServiceInstanceInventory.AgentOsInfo();
+ agentOsInfo.setHostname(osinfo.getHostname());
+ agentOsInfo.setOsName(osinfo.getOsName());
+ agentOsInfo.setProcessNo(osinfo.getProcessNo());
+ agentOsInfo.getIpv4s().addAll(osinfo.getIpv4SList());
+
+ int serviceInstanceId = serviceInstanceInventoryRegister.getOrCreate(request.getApplicationId(), request.getAgentUUID(), request.getRegisterTime(), agentOsInfo);
+ ApplicationInstanceMapping.Builder builder = ApplicationInstanceMapping.newBuilder();
+ builder.setApplicationId(request.getApplicationId());
+ builder.setApplicationInstanceId(serviceInstanceId);
+ responseObserver.onNext(builder.build());
+ responseObserver.onCompleted();
+ }
+
+ @Override public void heartbeat(ApplicationInstanceHeartbeat request, StreamObserver<Downstream> responseObserver) {
+// int instanceId = request.getApplicationInstanceId();
+// long heartBeatTime = request.getHeartbeatTime();
+// this.instanceHeartBeatService.heartBeat(instanceId, heartBeatTime);
+// responseObserver.onNext(Downstream.getDefaultInstance());
+// responseObserver.onCompleted();
+ }
+}
diff --git a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/ApplicationRegisterHandler.java b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/NetworkAddressRegisterServiceHandler.java
similarity index 54%
copy from oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/ApplicationRegisterHandler.java
copy to oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/NetworkAddressRegisterServiceHandler.java
index 97b3aca..6df497b 100644
--- a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/ApplicationRegisterHandler.java
+++ b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/NetworkAddressRegisterServiceHandler.java
@@ -18,10 +18,11 @@
package org.apache.skywalking.oap.server.receiver.register.provider.handler.v5;
+import com.google.protobuf.ProtocolStringList;
import io.grpc.stub.StreamObserver;
import org.apache.skywalking.apm.network.language.agent.*;
import org.apache.skywalking.oap.server.core.*;
-import org.apache.skywalking.oap.server.core.register.service.IServiceInventoryRegister;
+import org.apache.skywalking.oap.server.core.register.service.INetworkAddressInventoryRegister;
import org.apache.skywalking.oap.server.library.module.ModuleManager;
import org.apache.skywalking.oap.server.library.server.grpc.GRPCHandler;
import org.slf4j.*;
@@ -29,29 +30,32 @@ import org.slf4j.*;
/**
* @author peng-yongsheng
*/
-public class ApplicationRegisterHandler extends ApplicationRegisterServiceGrpc.ApplicationRegisterServiceImplBase implements GRPCHandler {
+public class NetworkAddressRegisterServiceHandler extends NetworkAddressRegisterServiceGrpc.NetworkAddressRegisterServiceImplBase implements GRPCHandler {
- private static final Logger logger = LoggerFactory.getLogger(ApplicationRegisterHandler.class);
+ private static final Logger logger = LoggerFactory.getLogger(NetworkAddressRegisterServiceHandler.class);
- private final IServiceInventoryRegister serviceInventoryRegister;
+ private final INetworkAddressInventoryRegister networkAddressInventoryRegister;
- public ApplicationRegisterHandler(ModuleManager moduleManager) {
- serviceInventoryRegister = moduleManager.find(CoreModule.NAME).getService(IServiceInventoryRegister.class);
+ public NetworkAddressRegisterServiceHandler(ModuleManager moduleManager) {
+ this.networkAddressInventoryRegister = moduleManager.find(CoreModule.NAME).getService(INetworkAddressInventoryRegister.class);
}
@Override
- public void applicationCodeRegister(Application request, StreamObserver<ApplicationMapping> responseObserver) {
+ public void batchRegister(NetworkAddresses request, StreamObserver<NetworkAddressMappings> responseObserver) {
if (logger.isDebugEnabled()) {
logger.debug("register application");
}
- ApplicationMapping.Builder builder = ApplicationMapping.newBuilder();
- String serviceName = request.getApplicationCode();
- int serviceId = serviceInventoryRegister.getOrCreate(serviceName);
+ ProtocolStringList addressesList = request.getAddressesList();
- if (serviceId != Const.NONE) {
- KeyWithIntegerValue value = KeyWithIntegerValue.newBuilder().setKey(serviceName).setValue(serviceId).build();
- builder.setApplication(value);
+ NetworkAddressMappings.Builder builder = NetworkAddressMappings.newBuilder();
+ for (String networkAddress : addressesList) {
+ int addressId = networkAddressInventoryRegister.getOrCreate(networkAddress);
+
+ if (addressId != Const.NONE) {
+ KeyWithIntegerValue value = KeyWithIntegerValue.newBuilder().setKey(networkAddress).setValue(addressId).build();
+ builder.addAddressIds(value);
+ }
}
responseObserver.onNext(builder.build());
responseObserver.onCompleted();
diff --git a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/ApplicationRegisterHandlerTestCase.java b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/ApplicationRegisterHandlerTestCase.java
index a4e3a08..19dbe67 100644
--- a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/ApplicationRegisterHandlerTestCase.java
+++ b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/ApplicationRegisterHandlerTestCase.java
@@ -38,6 +38,6 @@ public class ApplicationRegisterHandlerTestCase {
application.setApplicationCode("dubbox-consumer");
ApplicationMapping applicationMapping = stub.applicationCodeRegister(application.build());
- logger.debug("application id: {}", applicationMapping.getApplication().getValue());
+ logger.info("application id: {}", applicationMapping.getApplication().getValue());
}
}
diff --git a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/ApplicationRegisterHandlerTestCase.java b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/InstanceDiscoveryServiceHandlerTestCase.java
similarity index 54%
copy from oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/ApplicationRegisterHandlerTestCase.java
copy to oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/InstanceDiscoveryServiceHandlerTestCase.java
index a4e3a08..20a0226 100644
--- a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/ApplicationRegisterHandlerTestCase.java
+++ b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/InstanceDiscoveryServiceHandlerTestCase.java
@@ -25,19 +25,29 @@ import org.slf4j.*;
/**
* @author peng-yongsheng
*/
-public class ApplicationRegisterHandlerTestCase {
+public class InstanceDiscoveryServiceHandlerTestCase {
- private static final Logger logger = LoggerFactory.getLogger(ApplicationRegisterHandlerTestCase.class);
+ private static final Logger logger = LoggerFactory.getLogger(InstanceDiscoveryServiceHandlerTestCase.class);
public static void main(String[] args) {
ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 11800).usePlaintext(true).build();
- ApplicationRegisterServiceGrpc.ApplicationRegisterServiceBlockingStub stub = ApplicationRegisterServiceGrpc.newBlockingStub(channel);
+ InstanceDiscoveryServiceGrpc.InstanceDiscoveryServiceBlockingStub stub = InstanceDiscoveryServiceGrpc.newBlockingStub(channel);
- Application.Builder application = Application.newBuilder();
- application.setApplicationCode("dubbox-consumer");
+ ApplicationInstance.Builder applicationInstance = ApplicationInstance.newBuilder();
+ applicationInstance.setApplicationId(1);
+ applicationInstance.setAgentUUID("Test");
+ applicationInstance.setRegisterTime(System.currentTimeMillis());
- ApplicationMapping applicationMapping = stub.applicationCodeRegister(application.build());
- logger.debug("application id: {}", applicationMapping.getApplication().getValue());
+ OSInfo.Builder osInfo = OSInfo.newBuilder();
+ osInfo.setOsName("mac os");
+ osInfo.setHostname("pengys");
+ osInfo.setProcessNo(1);
+ osInfo.addIpv4S("10.0.0.1");
+ osInfo.addIpv4S("10.0.0.2");
+ applicationInstance.setOsinfo(osInfo);
+
+ ApplicationInstanceMapping instanceMapping = stub.registerInstance(applicationInstance.build());
+ logger.info("application id: {}, application instance id: {}", instanceMapping.getApplicationId(), instanceMapping.getApplicationInstanceId());
}
}
diff --git a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/ApplicationRegisterHandlerTestCase.java b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/NetworkAddressRegisterServiceHandlerTestCase.java
similarity index 65%
copy from oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/ApplicationRegisterHandlerTestCase.java
copy to oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/NetworkAddressRegisterServiceHandlerTestCase.java
index a4e3a08..52ecded 100644
--- a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/ApplicationRegisterHandlerTestCase.java
+++ b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/NetworkAddressRegisterServiceHandlerTestCase.java
@@ -25,19 +25,22 @@ import org.slf4j.*;
/**
* @author peng-yongsheng
*/
-public class ApplicationRegisterHandlerTestCase {
+public class NetworkAddressRegisterServiceHandlerTestCase {
- private static final Logger logger = LoggerFactory.getLogger(ApplicationRegisterHandlerTestCase.class);
+ private static final Logger logger = LoggerFactory.getLogger(NetworkAddressRegisterServiceHandlerTestCase.class);
public static void main(String[] args) {
ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 11800).usePlaintext(true).build();
- ApplicationRegisterServiceGrpc.ApplicationRegisterServiceBlockingStub stub = ApplicationRegisterServiceGrpc.newBlockingStub(channel);
+ NetworkAddressRegisterServiceGrpc.NetworkAddressRegisterServiceBlockingStub stub = NetworkAddressRegisterServiceGrpc.newBlockingStub(channel);
- Application.Builder application = Application.newBuilder();
- application.setApplicationCode("dubbox-consumer");
+ NetworkAddresses.Builder networkAddresses = NetworkAddresses.newBuilder();
+ networkAddresses.addAddresses("127.0.0.1:8080");
- ApplicationMapping applicationMapping = stub.applicationCodeRegister(application.build());
- logger.debug("application id: {}", applicationMapping.getApplication().getValue());
+ NetworkAddressMappings addressMappings = stub.batchRegister(networkAddresses.build());
+
+ for (KeyWithIntegerValue value : addressMappings.getAddressIdsList()) {
+ logger.info("key: {}, value: {}", value.getKey(), value.getValue());
+ }
}
}
diff --git a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/ServiceNameDiscoveryHandlerTestCase.java b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/ServiceNameDiscoveryHandlerTestCase.java
index 5a00044..b324d9c 100644
--- a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/ServiceNameDiscoveryHandlerTestCase.java
+++ b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v5/ServiceNameDiscoveryHandlerTestCase.java
@@ -41,8 +41,9 @@ public class ServiceNameDiscoveryHandlerTestCase {
serviceNameCollection.addElements(serviceNameElement);
ServiceNameMappingCollection collection = stub.discovery(serviceNameCollection.build());
+
for (ServiceNameMappingElement element : collection.getElementsList()) {
- logger.debug("service id: {}", element.getServiceId());
+ logger.info("service id: {}", element.getServiceId());
}
}
}
diff --git a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/resources/log4j2.xml b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/resources/log4j2.xml
index 6eb5b3f..cd67282 100644
--- a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/resources/log4j2.xml
+++ b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/test/resources/log4j2.xml
@@ -17,14 +17,14 @@
~
-->
-<Configuration status="DEBUG">
+<Configuration status="INFO">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout charset="UTF-8" pattern="%d - %c -%-4r [%t] %-5p %x - %m%n"/>
</Console>
</Appenders>
<Loggers>
- <Root level="DEBUG">
+ <Root level="INFO">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/ColumnTypeEsMapping.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/ColumnTypeEsMapping.java
index 41bcb78..c7ceeed 100644
--- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/ColumnTypeEsMapping.java
+++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/ColumnTypeEsMapping.java
@@ -33,7 +33,7 @@ public class ColumnTypeEsMapping implements DataTypeMapping {
} else if (Double.class.equals(type) || double.class.equals(type)) {
return "double";
} else if (String.class.equals(type)) {
- return "text";
+ return "keyword";
} else {
throw new IllegalArgumentException("Unsupported data type: " + type.getName());
}
diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/EndpointInventoryCacheEsDAO.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/EndpointInventoryCacheEsDAO.java
index bb8ee22..ecdf877 100644
--- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/EndpointInventoryCacheEsDAO.java
+++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/EndpointInventoryCacheEsDAO.java
@@ -48,7 +48,7 @@ public class EndpointInventoryCacheEsDAO extends EsDAO implements IEndpointInven
String id = EndpointInventory.buildId(serviceId, endpointName);
GetResponse response = getClient().get(EndpointInventory.MODEL_NAME, id);
if (response.isExists()) {
- return response.getField(RegisterSource.SEQUENCE).getValue();
+ return (int)response.getSource().getOrDefault(RegisterSource.SEQUENCE, 0);
} else {
return Const.NONE;
}
diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/NetworkAddressInventoryCacheEsDAO.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/NetworkAddressInventoryCacheEsDAO.java
index b832518..9022f86 100644
--- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/NetworkAddressInventoryCacheEsDAO.java
+++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/NetworkAddressInventoryCacheEsDAO.java
@@ -48,7 +48,7 @@ public class NetworkAddressInventoryCacheEsDAO extends EsDAO implements INetwork
String id = NetworkAddressInventory.buildId(networkAddress);
GetResponse response = getClient().get(NetworkAddressInventory.MODEL_NAME, id);
if (response.isExists()) {
- return response.getField(RegisterSource.SEQUENCE).getValue();
+ return (int)response.getSource().getOrDefault(RegisterSource.SEQUENCE, 0);
} else {
return Const.NONE;
}
diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/ServiceInstanceInventoryCacheDAO.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/ServiceInstanceInventoryCacheDAO.java
index e56215d..ecfb568 100644
--- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/ServiceInstanceInventoryCacheDAO.java
+++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/ServiceInstanceInventoryCacheDAO.java
@@ -76,7 +76,7 @@ public class ServiceInstanceInventoryCacheDAO extends EsDAO implements IServiceI
try {
GetResponse response = getClient().get(ServiceInstanceInventory.MODEL_NAME, id);
if (response.isExists()) {
- return response.getField(RegisterSource.SEQUENCE).getValue();
+ return (int)response.getSource().getOrDefault(RegisterSource.SEQUENCE, 0);
} else {
return Const.NONE;
}
diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/ServiceInventoryCacheEsDAO.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/ServiceInventoryCacheEsDAO.java
index c0afba8..8c5e2c0 100644
--- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/ServiceInventoryCacheEsDAO.java
+++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/ServiceInventoryCacheEsDAO.java
@@ -57,7 +57,7 @@ public class ServiceInventoryCacheEsDAO extends EsDAO implements IServiceInvento
try {
GetResponse response = getClient().get(ServiceInventory.MODEL_NAME, id);
if (response.isExists()) {
- return response.getField(RegisterSource.SEQUENCE).getValue();
+ return (int)response.getSource().getOrDefault(RegisterSource.SEQUENCE, 0);
} else {
return Const.NONE;
}
diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/lock/RegisterLockInstaller.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/lock/RegisterLockInstaller.java
index dc1be5b..383f7b4 100644
--- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/lock/RegisterLockInstaller.java
+++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/lock/RegisterLockInstaller.java
@@ -48,6 +48,7 @@ public class RegisterLockInstaller {
putIfAbsent(Scope.Endpoint.ordinal());
putIfAbsent(Scope.ServiceInstance.ordinal());
putIfAbsent(Scope.Service.ordinal());
+ putIfAbsent(Scope.NetworkAddress.ordinal());
} catch (IOException e) {
throw new StorageException(e.getMessage());
}