Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3.2' into service-payload
Browse files Browse the repository at this point in the history
* 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)
  ...
  • Loading branch information
mytang0 committed Feb 23, 2023
2 parents db21b8c + 638b193 commit 914b7f5
Show file tree
Hide file tree
Showing 292 changed files with 9,792 additions and 1,346 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/build-and-test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,6 @@ jobs:
with:
name: "class-file"
path: ${{ github.workspace }}/class.zip
- name: "Pack rat file if failure"
if: failure()
run: 7z a ${{ github.workspace }}/rat.zip *rat.txt -r
- name: "Upload rat file if failure"
if: failure()
uses: actions/upload-artifact@v3
with:
name: "rat-file"
path: ${{ github.workspace }}/rat.zip
- name: "Pack checkstyle file if failure"
if: failure()
run: 7z a ${{ github.workspace }}/checkstyle.zip *checkstyle* -r
Expand Down
16 changes: 11 additions & 5 deletions .codecov.yml → codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
coverage:
codecov:
require_ci_to_pass: false
notify:
wait_for_ci: false
coverage:
status:
# pull-requests only
patch:
default:
threshold: 0.1%
ignore:
- "dubbo-demo/.*"
- "dubbo-common/src/main/java/org/apache/dubbo/common/json/*.java" # internal JSON impl is deprecate, ignore test coverage for them
- "dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/AnnotationBean.java" # Deprecated
- "dubbo-rpc/dubbo-rpc-thrift/.*"
- "**/dubbo-demo/**"
- "**/dubbo-compiler/**"
- "**/dubbo-test/**"
- "**/dubbo-compatible/**"
- "**/dubbo-native/**"
- "**/dubbo-native-plugin/**"
- "**/dubbo-common/src/main/java/org/apache/dubbo/common/json/*.java" # internal JSON impl is deprecate, ignore test coverage for them
- "**/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/AnnotationBean.java" # Deprecated
- "**/dubbo-rpc/dubbo-rpc-thrift/**"
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ public Result invoke(Invocation invocation) throws RpcException {
return asyncResult;
}

public Invoker<T> getFilterInvoker() {
return filterInvoker;
}

@Override
public Class<T> getInterface() {
return filterInvoker.getInterface();
Expand Down
34 changes: 32 additions & 2 deletions dubbo-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,38 @@
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</dependency>


</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>get-version-infos</id>
<phase>compile</phase>
<configuration>
<failOnError>true</failOnError>
<target>
<property name="version_file"
value="${project.build.outputDirectory}/META-INF/version"/>
<!-- get the current version of dubbo -->
<echo message="revision=${revision}${line.separator}" file="${version_file}"/>
<echo message="git.commit.id=" file="${version_file}" append="true"/>
<!-- get the latest commit id -->
<exec executable="git" output="${version_file}" error=".git.exec.error" append="true"
timeout="3000" failifexecutionfails="false">
<arg line="rev-parse HEAD"/>
</exec>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
28 changes: 26 additions & 2 deletions dubbo-common/src/main/java/org/apache/dubbo/common/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,19 @@
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.common.utils.ClassUtils;
import org.apache.dubbo.common.utils.ConfigUtils;
import org.apache.dubbo.common.utils.StringUtils;

import java.io.IOException;
import java.net.URL;
import java.security.CodeSource;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Optional;
import java.util.Properties;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand All @@ -46,8 +50,9 @@ public final class Version {
public static final String DEFAULT_DUBBO_PROTOCOL_VERSION = "2.0.2";
// version 1.0.0 represents Dubbo rpc protocol before v2.6.2
public static final int LEGACY_DUBBO_PROTOCOL_VERSION = 10000; // 1.0.0
// Dubbo implementation version, usually is jar version.
private static final String VERSION = getVersion(Version.class, "");
// Dubbo implementation version.
private static String VERSION;
private static String LATEST_COMMIT_ID;

/**
* For protocol compatibility purpose.
Expand All @@ -61,6 +66,21 @@ public final class Version {
static {
// check if there's duplicated jar
Version.checkDuplicate(Version.class);

// get dubbo version and last commit id
try {
Properties properties =
ConfigUtils.loadProperties(Collections.emptySet(), "META-INF/version");

VERSION = Optional.ofNullable(properties.getProperty("revision"))
.filter(StringUtils::isNotBlank)
.orElseGet(() -> getVersion(Version.class, ""));
LATEST_COMMIT_ID = Optional.ofNullable(properties.getProperty("git.commit.id")).orElse("");
} catch (Throwable e) {
logger.warn(COMMON_UNEXPECTED_EXCEPTION, "", "", "continue the old logic, ignore exception " + e.getMessage(), e);
VERSION = getVersion(Version.class, "");
LATEST_COMMIT_ID = "";
}
}

private Version() {
Expand All @@ -74,6 +94,10 @@ public static String getVersion() {
return VERSION;
}

public static String getLastCommitId() {
return LATEST_COMMIT_ID;
}

/**
* Compare versions
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,15 @@ private int getNextId(Class<?> beanClass) {
return ConcurrentHashMapUtils.computeIfAbsent(beanNameIdCounterMap, beanClass, key -> new AtomicInteger()).incrementAndGet();
}

@SuppressWarnings("unchecked")
public <T> List<T> getBeansOfType(Class<T> type) {
List<T> currentBeans = (List<T>) registeredBeanInfos.stream().filter(beanInfo -> type.isInstance(beanInfo.instance)).map(beanInfo -> beanInfo.instance).collect(Collectors.toList());
if (parent != null) {
currentBeans.addAll(parent.getBeansOfType(type));
}
return currentBeans;
}

public <T> T getBean(Class<T> type) {
return this.getBean(null, type);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public String getLocalMigrationRule() {
return localMigrationRule;
}

public void refreshClassLoaders() {
public synchronized void refreshClassLoaders() {
propertiesConfiguration.refresh();
loadMigrationRule();
this.globalConfiguration = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public String getLocalMigrationRule() {
}

@Override
public void refreshClassLoaders() {
public synchronized void refreshClassLoaders() {
orderedPropertiesConfiguration.refresh();
applicationDelegate.refreshClassLoaders();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,4 @@ public interface JSON {
List<Map<String, ?>> checkObjectList(List<?> rawList);

List<String> checkStringList(List<?> rawList);

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.util.List;

public class FastJson2Impl extends AbstractJSONImpl {

@Override
public <T> T toJavaObject(String json, Type type) {
return com.alibaba.fastjson2.JSON.parseObject(json, type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ public <T> List<T> toJavaList(String json, Class<T> clazz) {
public String toJson(Object obj) {
return com.alibaba.fastjson.JSON.toJSONString(obj, SerializerFeature.DisableCircularReferenceDetect);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,18 @@
*/
package org.apache.dubbo.common.json.impl;


import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;

import java.lang.reflect.Type;
import java.util.List;

public class JacksonImpl extends AbstractJSONImpl {
private ObjectMapper objectMapper = new ObjectMapper();

private volatile Object jacksonCache = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
*/
package org.apache.dubbo.config;

import java.util.HashMap;
import java.util.Map;

import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.utils.UrlUtils;
import org.apache.dubbo.config.nested.AggregationConfig;
import org.apache.dubbo.config.nested.PrometheusConfig;
import org.apache.dubbo.config.support.Nested;
import org.apache.dubbo.rpc.model.ApplicationModel;

import java.util.HashMap;
import java.util.Map;

/**
* MetricsConfig
*/
Expand All @@ -40,6 +40,11 @@ public class MetricsConfig extends AbstractConfig {
*/
private Boolean enableJvmMetrics;

/**
* Enable jvm metrics when collecting.
*/
private Boolean enableMetadataMetrics;

/**
* @deprecated After metrics config is refactored.
* This parameter should no longer use and will be deleted in the future.
Expand Down Expand Up @@ -137,5 +142,13 @@ public Integer getExportServicePort() {
public void setExportServicePort(Integer exportServicePort) {
this.exportServicePort = exportServicePort;
}

public Boolean getEnableMetadataMetrics() {
return enableMetadataMetrics;
}

public void setEnableMetadataMetrics(Boolean enableMetadataMetrics) {
this.enableMetadataMetrics = enableMetadataMetrics;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
String proxy() default "";

/**
* Service stub name, use interface name + Local if not set
* Service stub name, use interface name + Stub if not set
*/
String stub() default "";

Expand Down
Loading

0 comments on commit 914b7f5

Please sign in to comment.