Skip to content

Commit 914b7f5

Browse files
committed
Merge remote-tracking branch 'origin/3.2' into service-payload
* origin/3.2: (32 commits) dubbo-security Jackson error (apache#11622) sync meter to spring boot management (apache#11630) Rest bugfix & optimization (apache#11617) Observability task: metadata center (apache#11593) Enhance the way to get dubbo version (apache#11574) Bump protobuf-java from 3.21.12 to 3.22.0 (apache#11615) Bump maven-surefire-plugin from 3.0.0-M8 to 3.0.0-M9 (apache#11613) Bump micrometer-bom from 1.10.3 to 1.10.4 (apache#11611) Bump libthrift from 0.17.0 to 0.18.0 (apache#11614) Bump maven-failsafe-plugin from 3.0.0-M8 to 3.0.0-M9 (apache#11612) Bump reactor-core from 3.5.2 to 3.5.3 (apache#11610) Bump byte-buddy from 1.13.0 to 1.14.0 (apache#11609) Bump maven-javadoc-plugin from 3.4.1 to 3.5.0 (apache#11608) Bump micrometer-tracing-bom from 1.0.1 to 1.0.2 (apache#11607) 3.2 consumer proxy invocation handler (apache#11108) Update DubboReference.java (apache#11621) Bump version to 3.1.8-SNAPSHOT Add Consumer Metrics (apache#11542) Backport of remove apache-rat-plugin. (apache#11523) (apache#11592) Update codecov config (apache#11582) ...
2 parents db21b8c + 638b193 commit 914b7f5

File tree

292 files changed

+9792
-1346
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

292 files changed

+9792
-1346
lines changed

.github/workflows/build-and-test-pr.yml

-9
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,6 @@ jobs:
7979
with:
8080
name: "class-file"
8181
path: ${{ github.workspace }}/class.zip
82-
- name: "Pack rat file if failure"
83-
if: failure()
84-
run: 7z a ${{ github.workspace }}/rat.zip *rat.txt -r
85-
- name: "Upload rat file if failure"
86-
if: failure()
87-
uses: actions/upload-artifact@v3
88-
with:
89-
name: "rat-file"
90-
path: ${{ github.workspace }}/rat.zip
9182
- name: "Pack checkstyle file if failure"
9283
if: failure()
9384
run: 7z a ${{ github.workspace }}/checkstyle.zip *checkstyle* -r

.codecov.yml codecov.yml

+11-5
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,23 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
coverage:
16+
codecov:
1717
require_ci_to_pass: false
1818
notify:
1919
wait_for_ci: false
20+
coverage:
2021
status:
2122
# pull-requests only
2223
patch:
2324
default:
2425
threshold: 0.1%
2526
ignore:
26-
- "dubbo-demo/.*"
27-
- "dubbo-common/src/main/java/org/apache/dubbo/common/json/*.java" # internal JSON impl is deprecate, ignore test coverage for them
28-
- "dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/AnnotationBean.java" # Deprecated
29-
- "dubbo-rpc/dubbo-rpc-thrift/.*"
27+
- "**/dubbo-demo/**"
28+
- "**/dubbo-compiler/**"
29+
- "**/dubbo-test/**"
30+
- "**/dubbo-compatible/**"
31+
- "**/dubbo-native/**"
32+
- "**/dubbo-native-plugin/**"
33+
- "**/dubbo-common/src/main/java/org/apache/dubbo/common/json/*.java" # internal JSON impl is deprecate, ignore test coverage for them
34+
- "**/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/AnnotationBean.java" # Deprecated
35+
- "**/dubbo-rpc/dubbo-rpc-thrift/**"

dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/filter/FilterChainBuilder.java

+4
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,10 @@ public Result invoke(Invocation invocation) throws RpcException {
237237
return asyncResult;
238238
}
239239

240+
public Invoker<T> getFilterInvoker() {
241+
return filterInvoker;
242+
}
243+
240244
@Override
241245
public Class<T> getInterface() {
242246
return filterInvoker.getInterface();

dubbo-common/pom.xml

+32-2
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,38 @@
100100
<groupId>javax.annotation</groupId>
101101
<artifactId>javax.annotation-api</artifactId>
102102
</dependency>
103-
104-
105103
</dependencies>
106104

105+
<build>
106+
<plugins>
107+
<plugin>
108+
<groupId>org.apache.maven.plugins</groupId>
109+
<artifactId>maven-antrun-plugin</artifactId>
110+
<executions>
111+
<execution>
112+
<id>get-version-infos</id>
113+
<phase>compile</phase>
114+
<configuration>
115+
<failOnError>true</failOnError>
116+
<target>
117+
<property name="version_file"
118+
value="${project.build.outputDirectory}/META-INF/version"/>
119+
<!-- get the current version of dubbo -->
120+
<echo message="revision=${revision}${line.separator}" file="${version_file}"/>
121+
<echo message="git.commit.id=" file="${version_file}" append="true"/>
122+
<!-- get the latest commit id -->
123+
<exec executable="git" output="${version_file}" error=".git.exec.error" append="true"
124+
timeout="3000" failifexecutionfails="false">
125+
<arg line="rev-parse HEAD"/>
126+
</exec>
127+
</target>
128+
</configuration>
129+
<goals>
130+
<goal>run</goal>
131+
</goals>
132+
</execution>
133+
</executions>
134+
</plugin>
135+
</plugins>
136+
</build>
107137
</project>

dubbo-common/src/main/java/org/apache/dubbo/common/Version.java

+26-2
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,19 @@
1919
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
2020
import org.apache.dubbo.common.logger.LoggerFactory;
2121
import org.apache.dubbo.common.utils.ClassUtils;
22+
import org.apache.dubbo.common.utils.ConfigUtils;
2223
import org.apache.dubbo.common.utils.StringUtils;
2324

2425
import java.io.IOException;
2526
import java.net.URL;
2627
import java.security.CodeSource;
28+
import java.util.Collections;
2729
import java.util.Enumeration;
2830
import java.util.HashMap;
2931
import java.util.HashSet;
3032
import java.util.Map;
33+
import java.util.Optional;
34+
import java.util.Properties;
3135
import java.util.Set;
3236
import java.util.regex.Matcher;
3337
import java.util.regex.Pattern;
@@ -46,8 +50,9 @@ public final class Version {
4650
public static final String DEFAULT_DUBBO_PROTOCOL_VERSION = "2.0.2";
4751
// version 1.0.0 represents Dubbo rpc protocol before v2.6.2
4852
public static final int LEGACY_DUBBO_PROTOCOL_VERSION = 10000; // 1.0.0
49-
// Dubbo implementation version, usually is jar version.
50-
private static final String VERSION = getVersion(Version.class, "");
53+
// Dubbo implementation version.
54+
private static String VERSION;
55+
private static String LATEST_COMMIT_ID;
5156

5257
/**
5358
* For protocol compatibility purpose.
@@ -61,6 +66,21 @@ public final class Version {
6166
static {
6267
// check if there's duplicated jar
6368
Version.checkDuplicate(Version.class);
69+
70+
// get dubbo version and last commit id
71+
try {
72+
Properties properties =
73+
ConfigUtils.loadProperties(Collections.emptySet(), "META-INF/version");
74+
75+
VERSION = Optional.ofNullable(properties.getProperty("revision"))
76+
.filter(StringUtils::isNotBlank)
77+
.orElseGet(() -> getVersion(Version.class, ""));
78+
LATEST_COMMIT_ID = Optional.ofNullable(properties.getProperty("git.commit.id")).orElse("");
79+
} catch (Throwable e) {
80+
logger.warn(COMMON_UNEXPECTED_EXCEPTION, "", "", "continue the old logic, ignore exception " + e.getMessage(), e);
81+
VERSION = getVersion(Version.class, "");
82+
LATEST_COMMIT_ID = "";
83+
}
6484
}
6585

6686
private Version() {
@@ -74,6 +94,10 @@ public static String getVersion() {
7494
return VERSION;
7595
}
7696

97+
public static String getLastCommitId() {
98+
return LATEST_COMMIT_ID;
99+
}
100+
77101
/**
78102
* Compare versions
79103
*

dubbo-common/src/main/java/org/apache/dubbo/common/beans/factory/ScopeBeanFactory.java

+9
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,15 @@ private int getNextId(Class<?> beanClass) {
186186
return ConcurrentHashMapUtils.computeIfAbsent(beanNameIdCounterMap, beanClass, key -> new AtomicInteger()).incrementAndGet();
187187
}
188188

189+
@SuppressWarnings("unchecked")
190+
public <T> List<T> getBeansOfType(Class<T> type) {
191+
List<T> currentBeans = (List<T>) registeredBeanInfos.stream().filter(beanInfo -> type.isInstance(beanInfo.instance)).map(beanInfo -> beanInfo.instance).collect(Collectors.toList());
192+
if (parent != null) {
193+
currentBeans.addAll(parent.getBeansOfType(type));
194+
}
195+
return currentBeans;
196+
}
197+
189198
public <T> T getBean(Class<T> type) {
190199
return this.getBean(null, type);
191200
}

dubbo-common/src/main/java/org/apache/dubbo/common/config/Environment.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ public String getLocalMigrationRule() {
315315
return localMigrationRule;
316316
}
317317

318-
public void refreshClassLoaders() {
318+
public synchronized void refreshClassLoaders() {
319319
propertiesConfiguration.refresh();
320320
loadMigrationRule();
321321
this.globalConfiguration = null;

dubbo-common/src/main/java/org/apache/dubbo/common/config/ModuleEnvironment.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public String getLocalMigrationRule() {
220220
}
221221

222222
@Override
223-
public void refreshClassLoaders() {
223+
public synchronized void refreshClassLoaders() {
224224
orderedPropertiesConfiguration.refresh();
225225
applicationDelegate.refreshClassLoaders();
226226
}

dubbo-common/src/main/java/org/apache/dubbo/common/json/JSON.java

-1
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,4 @@ public interface JSON {
4848
List<Map<String, ?>> checkObjectList(List<?> rawList);
4949

5050
List<String> checkStringList(List<?> rawList);
51-
5251
}

dubbo-common/src/main/java/org/apache/dubbo/common/json/impl/FastJson2Impl.java

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.util.List;
2323

2424
public class FastJson2Impl extends AbstractJSONImpl {
25-
2625
@Override
2726
public <T> T toJavaObject(String json, Type type) {
2827
return com.alibaba.fastjson2.JSON.parseObject(json, type);

dubbo-common/src/main/java/org/apache/dubbo/common/json/impl/FastJsonImpl.java

+1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,5 @@ public <T> List<T> toJavaList(String json, Class<T> clazz) {
3737
public String toJson(Object obj) {
3838
return com.alibaba.fastjson.JSON.toJSONString(obj, SerializerFeature.DisableCircularReferenceDetect);
3939
}
40+
4041
}

dubbo-common/src/main/java/org/apache/dubbo/common/json/impl/JacksonImpl.java

+3
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,18 @@
1616
*/
1717
package org.apache.dubbo.common.json.impl;
1818

19+
1920
import com.fasterxml.jackson.annotation.JsonInclude.Include;
2021
import com.fasterxml.jackson.databind.MapperFeature;
22+
import com.fasterxml.jackson.databind.ObjectMapper;
2123
import com.fasterxml.jackson.databind.json.JsonMapper;
2224
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
2325

2426
import java.lang.reflect.Type;
2527
import java.util.List;
2628

2729
public class JacksonImpl extends AbstractJSONImpl {
30+
private ObjectMapper objectMapper = new ObjectMapper();
2831

2932
private volatile Object jacksonCache = null;
3033

dubbo-common/src/main/java/org/apache/dubbo/config/MetricsConfig.java

+16-3
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
1616
*/
1717
package org.apache.dubbo.config;
1818

19-
import java.util.HashMap;
20-
import java.util.Map;
21-
2219
import org.apache.dubbo.common.URL;
2320
import org.apache.dubbo.common.utils.UrlUtils;
2421
import org.apache.dubbo.config.nested.AggregationConfig;
2522
import org.apache.dubbo.config.nested.PrometheusConfig;
2623
import org.apache.dubbo.config.support.Nested;
2724
import org.apache.dubbo.rpc.model.ApplicationModel;
2825

26+
import java.util.HashMap;
27+
import java.util.Map;
28+
2929
/**
3030
* MetricsConfig
3131
*/
@@ -40,6 +40,11 @@ public class MetricsConfig extends AbstractConfig {
4040
*/
4141
private Boolean enableJvmMetrics;
4242

43+
/**
44+
* Enable jvm metrics when collecting.
45+
*/
46+
private Boolean enableMetadataMetrics;
47+
4348
/**
4449
* @deprecated After metrics config is refactored.
4550
* This parameter should no longer use and will be deleted in the future.
@@ -137,5 +142,13 @@ public Integer getExportServicePort() {
137142
public void setExportServicePort(Integer exportServicePort) {
138143
this.exportServicePort = exportServicePort;
139144
}
145+
146+
public Boolean getEnableMetadataMetrics() {
147+
return enableMetadataMetrics;
148+
}
149+
150+
public void setEnableMetadataMetrics(Boolean enableMetadataMetrics) {
151+
this.enableMetadataMetrics = enableMetadataMetrics;
152+
}
140153
}
141154

dubbo-common/src/main/java/org/apache/dubbo/config/annotation/DubboReference.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
String proxy() default "";
164164

165165
/**
166-
* Service stub name, use interface name + Local if not set
166+
* Service stub name, use interface name + Stub if not set
167167
*/
168168
String stub() default "";
169169

0 commit comments

Comments
 (0)