diff --git a/all/pom.xml b/all/pom.xml
index 271a754f1..0fc29d63f 100644
--- a/all/pom.xml
+++ b/all/pom.xml
@@ -56,12 +56,12 @@
1.8
utf-8
1.7.21
- 1.3.15
+ 1.4.0
3.29.2-GA
4.1.44.Final
3.5.3
3.6.3.Final
- 1.6.6
+ 1.6.10
3.0.8
1.4.1
1.9.8
diff --git a/bom/pom.xml b/bom/pom.xml
index 4ce1bd589..3826b3c47 100644
--- a/bom/pom.xml
+++ b/bom/pom.xml
@@ -53,8 +53,8 @@
4.13.1
- 1.6.6
- 1.3.15
+ 1.6.10
+ 1.4.0
3.0.8
1.4.1
diff --git a/bootstrap/bootstrap-api/src/main/java/com/alipay/sofa/rpc/bootstrap/DefaultProviderBootstrap.java b/bootstrap/bootstrap-api/src/main/java/com/alipay/sofa/rpc/bootstrap/DefaultProviderBootstrap.java
index e7e46737b..0d7cff051 100644
--- a/bootstrap/bootstrap-api/src/main/java/com/alipay/sofa/rpc/bootstrap/DefaultProviderBootstrap.java
+++ b/bootstrap/bootstrap-api/src/main/java/com/alipay/sofa/rpc/bootstrap/DefaultProviderBootstrap.java
@@ -26,6 +26,9 @@
import com.alipay.sofa.rpc.config.ServerConfig;
import com.alipay.sofa.rpc.context.RpcRuntimeContext;
import com.alipay.sofa.rpc.core.exception.SofaRpcRuntimeException;
+import com.alipay.sofa.rpc.event.EventBus;
+import com.alipay.sofa.rpc.event.ProviderProcessorRegisterEvent;
+import com.alipay.sofa.rpc.event.ProviderProcessorUnRegistryEvent;
import com.alipay.sofa.rpc.ext.Extension;
import com.alipay.sofa.rpc.invoke.Invoker;
import com.alipay.sofa.rpc.listener.ConfigListener;
@@ -175,6 +178,9 @@ private void doExport() {
Server server = serverConfig.buildIfAbsent();
// 注册请求调用器
server.registerProcessor(providerConfig, providerProxyInvoker);
+ if (EventBus.isEnable(ProviderProcessorRegisterEvent.class)) {
+ EventBus.post(new ProviderProcessorRegisterEvent(providerConfig, serverConfig));
+ }
if (serverConfig.isAutoStart()) {
server.start();
}
@@ -306,6 +312,9 @@ public void unExport() {
if (server != null) {
try {
server.unRegisterProcessor(providerConfig, serverConfig.isAutoStart());
+ if (EventBus.isEnable(ProviderProcessorUnRegistryEvent.class)) {
+ EventBus.post(new ProviderProcessorUnRegistryEvent(providerConfig, serverConfig));
+ }
} catch (Exception e) {
if (LOGGER.isWarnEnabled(appName)) {
// TODO WARN
diff --git a/core/api/src/main/java/com/alipay/sofa/rpc/context/RecordContextResolver.java b/core/api/src/main/java/com/alipay/sofa/rpc/context/RecordContextResolver.java
new file mode 100644
index 000000000..479f29d68
--- /dev/null
+++ b/core/api/src/main/java/com/alipay/sofa/rpc/context/RecordContextResolver.java
@@ -0,0 +1,43 @@
+/*
+ * 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 com.alipay.sofa.rpc.context;
+
+import com.alipay.sofa.common.insight.RecordContext;
+import com.alipay.sofa.rpc.common.RemotingConstants;
+import com.alipay.sofa.rpc.core.request.SofaRequest;
+
+import java.util.Map;
+
+/**
+ * @author Even
+ * @date 2024/4/29 21:03
+ */
+public class RecordContextResolver {
+
+ public static void carryWithRequest(RecordContext recordContext, SofaRequest sofaRequest) {
+ recordContext.setTargetServiceUniqueName(sofaRequest.getTargetServiceUniqueName());
+ recordContext.setMethodName(sofaRequest.getMethodName());
+ Object traceContext = sofaRequest.getRequestProp(RemotingConstants.RPC_TRACE_NAME);
+ if (traceContext instanceof Map) {
+ Map ctxMap = (Map) traceContext;
+ String traceId = ctxMap.get(RemotingConstants.TRACE_ID_KEY);
+ String rpcId = ctxMap.get(RemotingConstants.RPC_ID_KEY);
+ recordContext.setTraceId(traceId);
+ recordContext.setRpcId(rpcId);
+ }
+ }
+}
diff --git a/core/api/src/main/java/com/alipay/sofa/rpc/event/ProviderProcessorRegisterEvent.java b/core/api/src/main/java/com/alipay/sofa/rpc/event/ProviderProcessorRegisterEvent.java
new file mode 100644
index 000000000..fd9321260
--- /dev/null
+++ b/core/api/src/main/java/com/alipay/sofa/rpc/event/ProviderProcessorRegisterEvent.java
@@ -0,0 +1,44 @@
+/*
+ * 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 com.alipay.sofa.rpc.event;
+
+import com.alipay.sofa.rpc.config.ProviderConfig;
+import com.alipay.sofa.rpc.config.ServerConfig;
+
+/**
+ * @author Even
+ * @date 2024/4/28 17:18
+ */
+public class ProviderProcessorRegisterEvent implements Event {
+
+ private final ProviderConfig providerConfig;
+
+ private final ServerConfig serverConfig;
+
+ public ProviderProcessorRegisterEvent(ProviderConfig providerConfig, ServerConfig serverConfig) {
+ this.providerConfig = providerConfig;
+ this.serverConfig = serverConfig;
+ }
+
+ public ProviderConfig getProviderConfig() {
+ return providerConfig;
+ }
+
+ public ServerConfig getServerConfig() {
+ return serverConfig;
+ }
+}
diff --git a/core/api/src/main/java/com/alipay/sofa/rpc/event/ProviderProcessorUnRegistryEvent.java b/core/api/src/main/java/com/alipay/sofa/rpc/event/ProviderProcessorUnRegistryEvent.java
new file mode 100644
index 000000000..26fb38fcd
--- /dev/null
+++ b/core/api/src/main/java/com/alipay/sofa/rpc/event/ProviderProcessorUnRegistryEvent.java
@@ -0,0 +1,44 @@
+/*
+ * 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 com.alipay.sofa.rpc.event;
+
+import com.alipay.sofa.rpc.config.ProviderConfig;
+import com.alipay.sofa.rpc.config.ServerConfig;
+
+/**
+ * @author Even
+ * @date 2024/4/28 17:19
+ */
+public class ProviderProcessorUnRegistryEvent implements Event {
+
+ private final ProviderConfig providerConfig;
+
+ private final ServerConfig serverConfig;
+
+ public ProviderProcessorUnRegistryEvent(ProviderConfig providerConfig, ServerConfig serverConfig) {
+ this.providerConfig = providerConfig;
+ this.serverConfig = serverConfig;
+ }
+
+ public ProviderConfig getProviderConfig() {
+ return providerConfig;
+ }
+
+ public ServerConfig getServerConfig() {
+ return serverConfig;
+ }
+}
diff --git a/remoting/remoting-bolt/src/main/java/com/alipay/sofa/rpc/server/bolt/BoltServerProcessor.java b/remoting/remoting-bolt/src/main/java/com/alipay/sofa/rpc/server/bolt/BoltServerProcessor.java
index 5939d7683..ab209534e 100644
--- a/remoting/remoting-bolt/src/main/java/com/alipay/sofa/rpc/server/bolt/BoltServerProcessor.java
+++ b/remoting/remoting-bolt/src/main/java/com/alipay/sofa/rpc/server/bolt/BoltServerProcessor.java
@@ -31,6 +31,7 @@
import com.alipay.sofa.rpc.common.utils.CommonUtils;
import com.alipay.sofa.rpc.config.ProviderConfig;
import com.alipay.sofa.rpc.config.UserThreadPoolManager;
+import com.alipay.sofa.rpc.context.RecordContextResolver;
import com.alipay.sofa.rpc.context.RpcInternalContext;
import com.alipay.sofa.rpc.context.RpcInvokeContext;
import com.alipay.sofa.rpc.context.RpcRuntimeContext;
@@ -211,6 +212,7 @@ public void handleRequest(BizContext bizCtx, AsyncContext asyncCtx, SofaRequest
LOGGER.errorWithApp(appName, e.getMessage(), e);
}
} finally {
+ RecordContextResolver.carryWithRequest(bizCtx.getInvokeContext().getRecordContext(), request);
processingCount.decrementAndGet();
if (!isAsyncChain) {
if (EventBus.isEnable(ServerEndHandleEvent.class)) {