You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2018/12/28 06:12:19 UTC

[GitHub] wu-sheng closed pull request #1929: Agent metadata clear to trigger re-register action for avoid restart agent when backend server metadata was mistakenly deleted

wu-sheng closed pull request #1929: Agent metadata clear to trigger re-register action for avoid restart agent when backend server metadata was mistakenly deleted
URL: https://github.com/apache/incubator-skywalking/pull/1929
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/apm-commons/apm-datacarrier/src/main/java/org/apache/skywalking/apm/commons/datacarrier/DataCarrier.java b/apm-commons/apm-datacarrier/src/main/java/org/apache/skywalking/apm/commons/datacarrier/DataCarrier.java
index 76ad609bf5..bd9f9a65a0 100644
--- a/apm-commons/apm-datacarrier/src/main/java/org/apache/skywalking/apm/commons/datacarrier/DataCarrier.java
+++ b/apm-commons/apm-datacarrier/src/main/java/org/apache/skywalking/apm/commons/datacarrier/DataCarrier.java
@@ -152,4 +152,10 @@ public void shutdownConsumers() {
             consumerPool.close();
         }
     }
+
+    public void clear() {
+        for (int i = 0; i < channels.getChannelSize(); i++) {
+            channels.getBuffer(i).clear();
+        }
+    }
 }
diff --git a/apm-commons/apm-datacarrier/src/main/java/org/apache/skywalking/apm/commons/datacarrier/buffer/Buffer.java b/apm-commons/apm-datacarrier/src/main/java/org/apache/skywalking/apm/commons/datacarrier/buffer/Buffer.java
index 4fbb478693..d9cbb34b87 100644
--- a/apm-commons/apm-datacarrier/src/main/java/org/apache/skywalking/apm/commons/datacarrier/buffer/Buffer.java
+++ b/apm-commons/apm-datacarrier/src/main/java/org/apache/skywalking/apm/commons/datacarrier/buffer/Buffer.java
@@ -91,4 +91,10 @@ public int getBufferSize() {
         return result;
     }
 
+    public void clear() {
+        for (Object obj : buffer) {
+            obj = null;
+        }
+    }
+
 }
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java
index a3a049e183..99ccee5965 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java
@@ -71,6 +71,21 @@
          */
         public static boolean IS_OPEN_DEBUGGING_CLASS = false;
 
+        /**
+         * Specify register.status dir ,This is an option, the default is AGENT_HOME/option/reset.status.
+         */
+        public static String REGISTER_STATUS_DIR = "skywalking-agent/option";
+
+        /**
+         * Specify process_uuid to ensure that the whole show is unique, for example: applicationName_ip_12
+         */
+        public static String PROCESS_UUID = "";
+        
+        /**
+         * enabled means that the reset function is enabled, and disabled means that the reset function is not enabled. A reset can be triggered by modifying the configuration file only if the reset feature is enabled.
+         */
+        public static String RESETER_LISTENER = "disabled";
+
         /**
          * Active V2 header in default
          */
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/EndpointNameDictionary.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/EndpointNameDictionary.java
index ac56aa6087..112973f5c3 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/EndpointNameDictionary.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/EndpointNameDictionary.java
@@ -52,6 +52,11 @@ public PossibleFound findOnly(int serviceId, String endpointName) {
         return find0(serviceId, endpointName, false, false, false);
     }
 
+    public void clearEndpointNameDictionary() {
+        unRegisterEndpoints.clear();
+        endpointDictionary.clear();
+
+    }
     private PossibleFound find0(int serviceId, String endpointName,
         boolean isEntry, boolean isExit, boolean registerWhenNotFound) {
         if (endpointName == null || endpointName.length() == 0) {
@@ -166,5 +171,6 @@ DetectPoint getSpanType() {
                 ", isExit=" + isExit +
                 '}';
         }
+
     }
 }
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/NetworkAddressDictionary.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/NetworkAddressDictionary.java
index 2e9e2aa743..c74d16e0c3 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/NetworkAddressDictionary.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/NetworkAddressDictionary.java
@@ -53,6 +53,12 @@ public PossibleFound find(String networkAddress) {
         }
     }
 
+    public void clearNetworkAddressDictionary() {
+        unRegisterServices.clear();
+        applicationDictionary.clear();
+
+    }
+
     public void syncRemoteDictionary(
         RegisterGrpc.RegisterBlockingStub networkAddressRegisterServiceBlockingStub) {
         if (unRegisterServices.size() > 0) {
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/listener/ResetConfListener.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/listener/ResetConfListener.java
new file mode 100644
index 0000000000..4320295c14
--- /dev/null
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/listener/ResetConfListener.java
@@ -0,0 +1,84 @@
+/*
+ * 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.apm.agent.core.listener;
+
+import java.io.File;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import org.apache.skywalking.apm.agent.core.boot.BootService;
+import org.apache.skywalking.apm.agent.core.boot.DefaultImplementor;
+import org.apache.skywalking.apm.agent.core.boot.DefaultNamedThreadFactory;
+import org.apache.skywalking.apm.agent.core.conf.Config;
+import org.apache.skywalking.apm.agent.core.logging.api.ILog;
+import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
+import org.apache.skywalking.apm.util.RunnableWithExceptionProtection;
+
+/**
+ * @author liu-xinyuan
+ **/
+@DefaultImplementor
+public class ResetConfListener implements BootService, Runnable {
+    private static final ILog logger = LogManager.getLogger(ResetConfListener.class);
+    private File configFile = null;
+
+    @Override public void prepare() throws Throwable {
+
+    }
+
+    @Override public void boot() {
+        if ("enabled".equals(Config.Agent.RESETER_LISTENER)) {
+            Executors.newSingleThreadScheduledExecutor(new DefaultNamedThreadFactory("ResetConfListener"))
+                .scheduleAtFixedRate(new RunnableWithExceptionProtection(this, new RunnableWithExceptionProtection.CallbackWhenException() {
+                    @Override
+                    public void handle(Throwable t) {
+                        logger.error("unexpected exception.", t);
+                    }
+                }), 0, Config.Collector.APP_AND_SERVICE_REGISTER_CHECK_INTERVAL, TimeUnit.SECONDS);
+
+        } else {
+            logger.info("Since the agent.register_status variable is not set correctly, the reset service is not started -> Agent reset service is inactive.");
+        }
+    }
+    @Override public void onComplete() throws Throwable {
+
+    }
+
+    @Override public void shutdown() throws Throwable {
+
+    }
+
+    @Override public void run() {
+        logger.debug("ResetConfListener running.");
+
+        try {
+            if (Reseter.INSTANCE.predicateReset())
+                Reseter.INSTANCE.setStatus(ResetStatus.DONE).resetRegisterStatus().reportToRegisterFile();
+        } catch (SecurityException e) {
+            logger.warn(e, "Denise read access to the file {}", configFile);
+        } catch (FileNotFoundException e) {
+            logger.warn(e, "not found file {}", configFile);
+        } catch (IOException e) {
+            logger.warn(e.getMessage());
+        }
+
+    }
+
+}
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/listener/ResetStatus.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/listener/ResetStatus.java
new file mode 100644
index 0000000000..ac9de48f47
--- /dev/null
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/listener/ResetStatus.java
@@ -0,0 +1,35 @@
+/*
+ * 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.apm.agent.core.listener;
+
+/**
+ * @author liu-xinyuan
+ **/
+public enum ResetStatus {
+    OFF("OFF"), ON("ON"), DONE("DONE");
+    private String label;
+
+    ResetStatus(String label) {
+        this.label = label;
+    }
+
+    public String value() {
+        return this.label;
+    }
+
+}
\ No newline at end of file
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/listener/Reseter.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/listener/Reseter.java
new file mode 100644
index 0000000000..eab908d140
--- /dev/null
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/listener/Reseter.java
@@ -0,0 +1,168 @@
+/*
+ * 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.apm.agent.core.listener;
+
+import java.io.Closeable;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileLock;
+import java.util.Properties;
+import org.apache.skywalking.apm.agent.core.boot.AgentPackageNotFoundException;
+import org.apache.skywalking.apm.agent.core.boot.AgentPackagePath;
+import org.apache.skywalking.apm.agent.core.boot.ServiceManager;
+import org.apache.skywalking.apm.agent.core.conf.Config;
+import org.apache.skywalking.apm.agent.core.conf.RemoteDownstreamConfig;
+import org.apache.skywalking.apm.agent.core.dictionary.DictionaryUtil;
+import org.apache.skywalking.apm.agent.core.dictionary.EndpointNameDictionary;
+import org.apache.skywalking.apm.agent.core.dictionary.NetworkAddressDictionary;
+import org.apache.skywalking.apm.agent.core.logging.api.ILog;
+import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
+import org.apache.skywalking.apm.agent.core.remote.TraceSegmentServiceClient;
+import org.apache.skywalking.apm.util.StringUtil;
+
+/**
+ * @author liu-xinyuan
+ **/
+public enum Reseter {
+    INSTANCE;
+    private static final ILog logger = LogManager.getLogger(Reseter.class);
+    private static final String SERVICE_ID_NAME = "service_id";
+    private static final String INSTANCE_ID_NAME = "instance_id";
+    private static final String STATUS_NAME = "status";
+    private static final String RESET_CHILD_DIR = "/reset.status";
+    private static final String COMMENT = "#Status has three values: ON (trigger reset), DONE(reset complete), OFF(agent fist boot).\n" +
+        "service_id: the service_id of the current agent.\n" +
+        "Instance_id: the instance_id of the current agent.";
+    private volatile Properties properties = new Properties();
+    private String resetPath;
+    private ResetStatus status = ResetStatus.OFF;
+    private boolean isFirstRun = true;
+    private int detectDuration = 5000;
+
+    public Reseter setStatus(ResetStatus status) {
+        this.status = status;
+        return this;
+    }
+
+    public String getResetPath() throws IOException, SecurityException {
+        if (isFirstRun) {
+            if (StringUtil.isEmpty(Config.Agent.REGISTER_STATUS_DIR)) {
+                try {
+                    Config.Agent.REGISTER_STATUS_DIR = AgentPackagePath.getPath() + "/option";
+                } catch (AgentPackageNotFoundException e) {
+                    e.printStackTrace();
+                }
+            }
+            File statusDir = new File(Config.Agent.REGISTER_STATUS_DIR);
+
+            if (!statusDir.exists() || !statusDir.isDirectory()) {
+                statusDir.mkdir();
+            }
+            resetPath = statusDir.getAbsolutePath() + RESET_CHILD_DIR;
+            init();
+            isFirstRun = false;
+        }
+        return resetPath;
+    }
+
+    public void reportToRegisterFile() throws IOException {
+        FileOutputStream outputStream = null;
+        try {
+            File configFile = new File(resetPath);
+            properties.setProperty(SERVICE_ID_NAME, RemoteDownstreamConfig.Agent.SERVICE_ID + "");
+            properties.setProperty(INSTANCE_ID_NAME, RemoteDownstreamConfig.Agent.SERVICE_INSTANCE_ID + "");
+            properties.setProperty(STATUS_NAME, status.value());
+            outputStream = new FileOutputStream(configFile);
+            properties.store(outputStream, COMMENT);
+        } finally {
+            closeFileStream(outputStream);
+        }
+    }
+
+    public Reseter resetRegisterStatus() {
+        RemoteDownstreamConfig.Agent.SERVICE_ID = DictionaryUtil.nullValue();
+        RemoteDownstreamConfig.Agent.SERVICE_INSTANCE_ID = DictionaryUtil.nullValue();
+        EndpointNameDictionary.INSTANCE.clearEndpointNameDictionary();
+        NetworkAddressDictionary.INSTANCE.clearNetworkAddressDictionary();
+        ServiceManager.INSTANCE.findService(TraceSegmentServiceClient.class).clearCache();
+        status = ResetStatus.DONE;
+        logger.info("clear id successfully,begin trigger reset.");
+        return this;
+    }
+
+    public Boolean predicateReset() throws IOException, SecurityException {
+        File resetFile = new File(getResetPath());
+        FileInputStream inputStream = null;
+        FileLock fileLock = null;
+        FileChannel fileChannel = null;
+        if (System.currentTimeMillis() - resetFile.lastModified() < detectDuration) {
+            try {
+                logger.info("The file reset.status was detected to have been modified in the last {} seconds.", detectDuration);
+                inputStream = new FileInputStream(resetFile);
+                fileChannel = inputStream.getChannel();
+                fileLock = fileChannel.tryLock(0, resetFile.length(), true);
+                if (fileLock == null) {
+                    return false;
+                }
+                properties.clear();
+                properties.load(inputStream);
+            } finally {
+                fileLock.release();
+                fileChannel.close();
+                closeFileStream(inputStream);
+            }
+            if (properties.get(STATUS_NAME) != null && properties.getProperty(STATUS_NAME).equals(ResetStatus.ON.value())) {
+                return true;
+            }
+        }
+        return false;
+
+    }
+
+    public void init() throws IOException {
+        FileOutputStream outputStream = null;
+        try {
+            properties.setProperty(SERVICE_ID_NAME, RemoteDownstreamConfig.Agent.SERVICE_ID + "");
+            properties.setProperty(INSTANCE_ID_NAME, RemoteDownstreamConfig.Agent.SERVICE_INSTANCE_ID + "");
+            properties.setProperty(STATUS_NAME, status.value());
+            File file = new File(resetPath);
+            if (!file.getParentFile().exists()) {
+                file.getParentFile().mkdir();
+            }
+            outputStream = new FileOutputStream(file);
+            properties.store(outputStream, COMMENT);
+        } finally {
+            closeFileStream(outputStream);
+        }
+    }
+
+    public void closeFileStream(Closeable stream) throws IOException {
+        if (stream != null) {
+            try {
+                stream.close();
+            } catch (IOException e) {
+                throw new IOException("file close failed.", e);
+            }
+        } else {
+            throw new IOException("create file outputstream failed");
+        }
+    }
+}
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/ServiceAndEndpointRegisterClient.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/ServiceAndEndpointRegisterClient.java
index 4709736c61..b9e27c4f74 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/ServiceAndEndpointRegisterClient.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/ServiceAndEndpointRegisterClient.java
@@ -32,6 +32,8 @@
 import org.apache.skywalking.apm.agent.core.dictionary.DictionaryUtil;
 import org.apache.skywalking.apm.agent.core.dictionary.EndpointNameDictionary;
 import org.apache.skywalking.apm.agent.core.dictionary.NetworkAddressDictionary;
+import org.apache.skywalking.apm.agent.core.listener.ResetStatus;
+import org.apache.skywalking.apm.agent.core.listener.Reseter;
 import org.apache.skywalking.apm.agent.core.logging.api.ILog;
 import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
 import org.apache.skywalking.apm.agent.core.os.OSUtil;
@@ -46,6 +48,7 @@
 import org.apache.skywalking.apm.network.register.v2.ServiceRegisterMapping;
 import org.apache.skywalking.apm.network.register.v2.Services;
 import org.apache.skywalking.apm.util.RunnableWithExceptionProtection;
+import org.apache.skywalking.apm.util.StringUtil;
 
 /**
  * @author wusheng
@@ -53,7 +56,7 @@
 @DefaultImplementor
 public class ServiceAndEndpointRegisterClient implements BootService, Runnable, GRPCChannelListener {
     private static final ILog logger = LogManager.getLogger(ServiceAndEndpointRegisterClient.class);
-    private static final String PROCESS_UUID = UUID.randomUUID().toString().replaceAll("-", "");
+    private static final String PROCESS_UUID = StringUtil.isEmpty(Config.Agent.PROCESS_UUID) ? UUID.randomUUID().toString().replaceAll("-", "") : Config.Agent.PROCESS_UUID;
 
     private volatile GRPCChannelStatus status = GRPCChannelStatus.DISCONNECT;
     private volatile RegisterGrpc.RegisterBlockingStub registerBlockingStub;
@@ -114,6 +117,7 @@ public void run() {
                             for (KeyIntValuePair registered : serviceRegisterMapping.getServicesList()) {
                                 if (Config.Agent.SERVICE_NAME.equals(registered.getKey())) {
                                     RemoteDownstreamConfig.Agent.SERVICE_ID = registered.getValue();
+                                    Reseter.INSTANCE.reportToRegisterFile();
                                     shouldTry = true;
                                 }
                             }
@@ -136,6 +140,8 @@ public void run() {
                                     int serviceInstanceId = serviceInstance.getValue();
                                     if (serviceInstanceId != DictionaryUtil.nullValue()) {
                                         RemoteDownstreamConfig.Agent.SERVICE_INSTANCE_ID = serviceInstanceId;
+                                        Reseter.INSTANCE.setStatus(ResetStatus.OFF).reportToRegisterFile();
+
                                     }
                                 }
                             }
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/TraceSegmentServiceClient.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/TraceSegmentServiceClient.java
index 0422ccaf3d..7663fb8ad2 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/TraceSegmentServiceClient.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/TraceSegmentServiceClient.java
@@ -22,8 +22,10 @@
 import io.grpc.stub.StreamObserver;
 import java.util.List;
 import org.apache.skywalking.apm.agent.core.boot.*;
+import org.apache.skywalking.apm.agent.core.conf.RemoteDownstreamConfig;
 import org.apache.skywalking.apm.agent.core.context.*;
 import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
+import org.apache.skywalking.apm.agent.core.dictionary.DictionaryUtil;
 import org.apache.skywalking.apm.agent.core.logging.api.*;
 import org.apache.skywalking.apm.commons.datacarrier.DataCarrier;
 import org.apache.skywalking.apm.commons.datacarrier.buffer.BufferStrategy;
@@ -151,7 +153,7 @@ public void onExit() {
 
     @Override
     public void afterFinished(TraceSegment traceSegment) {
-        if (traceSegment.isIgnore()) {
+        if (traceSegment.isIgnore() || RemoteDownstreamConfig.Agent.SERVICE_INSTANCE_ID == DictionaryUtil.nullValue() || RemoteDownstreamConfig.Agent.SERVICE_ID == DictionaryUtil.nullValue()) {
             return;
         }
         if (!carrier.produce(traceSegment)) {
@@ -169,4 +171,9 @@ public void statusChanged(GRPCChannelStatus status) {
         }
         this.status = status;
     }
+
+    public void clearCache() {
+        carrier.clear();
+    }
+
 }
diff --git a/apm-sniffer/apm-agent-core/src/main/resources/META-INF/services/org.apache.skywalking.apm.agent.core.boot.BootService b/apm-sniffer/apm-agent-core/src/main/resources/META-INF/services/org.apache.skywalking.apm.agent.core.boot.BootService
index 273d1dd0a6..5f798f9a33 100644
--- a/apm-sniffer/apm-agent-core/src/main/resources/META-INF/services/org.apache.skywalking.apm.agent.core.boot.BootService
+++ b/apm-sniffer/apm-agent-core/src/main/resources/META-INF/services/org.apache.skywalking.apm.agent.core.boot.BootService
@@ -23,3 +23,4 @@ org.apache.skywalking.apm.agent.core.remote.GRPCChannelManager
 org.apache.skywalking.apm.agent.core.jvm.JVMService
 org.apache.skywalking.apm.agent.core.remote.ServiceAndEndpointRegisterClient
 org.apache.skywalking.apm.agent.core.context.ContextManagerExtendService
+org.apache.skywalking.apm.agent.core.listener.ResetConfListener
\ No newline at end of file
diff --git a/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/boot/ServiceManagerTest.java b/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/boot/ServiceManagerTest.java
index afe858d440..5931a08a26 100644
--- a/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/boot/ServiceManagerTest.java
+++ b/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/boot/ServiceManagerTest.java
@@ -55,7 +55,7 @@ public static void afterClass() {
     public void testServiceDependencies() throws Exception {
         HashMap<Class, BootService> registryService = getFieldValue(ServiceManager.INSTANCE, "bootedServices");
 
-        assertThat(registryService.size(), is(7));
+        assertThat(registryService.size(), is(8));
 
         assertTraceSegmentServiceClient(ServiceManager.INSTANCE.findService(TraceSegmentServiceClient.class));
         assertContextManager(ServiceManager.INSTANCE.findService(ContextManager.class));
diff --git a/apm-sniffer/config/agent.config b/apm-sniffer/config/agent.config
index 37f2b42724..82661d2b21 100644
--- a/apm-sniffer/config/agent.config
+++ b/apm-sniffer/config/agent.config
@@ -43,3 +43,13 @@ collector.backend_service=${SW_AGENT_COLLECTOR_BACKEND_SERVICES:127.0.0.1:11800}
 
 # Logging level
 logging.level=${SW_LOGGING_LEVEL:DEBUG}
+
+#Specify register.status dir,if dir not exists or it is a file then default AGENT_HOME/option
+#agent.register_status_dir=${SW_AGENT_REGISTER_STATUS_DIR:register_dir}
+
+#Specify process_uuid to ensure that the whole show is unique, for example: applicationName_ip_12
+#agent.process_uuid=${SW_AGENT_PROCESS_UUID:applicationName_ip_1}
+
+#enabled means that the reset function is enabled, and disabled means that the reset function is not enabled. A reset can be triggered by modifying the configuration file only if the reset feature is enabled.
+#agent.reseter_listener=${SW_AGENT_RESETER_LISTENER:disabled}
+
diff --git a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v6/grpc/ServiceInstancePingServiceHandler.java b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v6/grpc/ServiceInstancePingServiceHandler.java
index 348aaa6095..706ec2b67a 100644
--- a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v6/grpc/ServiceInstancePingServiceHandler.java
+++ b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v6/grpc/ServiceInstancePingServiceHandler.java
@@ -58,7 +58,7 @@ public ServiceInstancePingServiceHandler(ModuleManager moduleManager) {
         if (Objects.nonNull(serviceInstanceInventory)) {
             serviceInventoryRegister.heartbeat(serviceInstanceInventory.getServiceId(), heartBeatTime);
         } else {
-            logger.warn("Can't found service by service instance id from cache, service instance id is: {}", serviceInstanceId);
+            logger.warn("Can't found service by service instance id from cache, service instance id is: {},instanceUUID or processId is {}", serviceInstanceId,request.getServiceInstanceUUID());
         }
 
         responseObserver.onNext(Commands.getDefaultInstance());


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services