Skip to content

Commit

Permalink
Merge branch 'jd-opensource:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanjinzhong authored Sep 2, 2024
2 parents 54bd745 + a964f33 commit 74786aa
Show file tree
Hide file tree
Showing 274 changed files with 9,229 additions and 516 deletions.
21 changes: 3 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,16 @@ on:
branches: [ "main" ]

jobs:
build-jdk8:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn clean -DskipTests=true -Dmaven.javadoc.skip=true -B package --file pom.xml

build-jdk11:
build-jdk17:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build an image using JDK 8
FROM openjdk:8u342-jdk AS builder
# Build an image using JDK 17
FROM openjdk:17-oracle AS builder

# Set up a working directory
WORKDIR /app
Expand Down
6 changes: 6 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,10 @@ Please visit this web site for more information of this project:
* https://github.com/google/guava

The Apache Software License, Version 2.0.
================================================================

This software includes code from Apache dubbo:

Please visit this web site for more information of this project:
* https://github.com/apache/dubbo
================================================================
2 changes: 1 addition & 1 deletion README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

### 需求

编译需求: JDK 8+ 与 Maven 3.2.5+
编译需求: JDK 17+ 与 Maven 3.2.5+

## 主要特性

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Following the traditional SDK governance model and Sidecar governance model, an

### Requirements

Compile requirement: JDK 8+ and Maven 3.2.5+
Compile requirement: JDK 17+ and Maven 3.2.5+

## Main Features

Expand Down
13 changes: 13 additions & 0 deletions RELEASE-zh.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# 发布历史

## 1.2.0

1. 支持spring cloud 2023.
2. 支持认证策略.
3. 修复通用问题和稳定性提升.

## 1.1.0

1. 支持完整的服务熔断策略.
2. 增加了出流量监听器,重构了治理增强切面.
3. 支持rabbitmq和pulsar链路透传.
4. 修复通用问题和稳定性提升.

## 1.0.0

## 特性
Expand Down
13 changes: 13 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Release History

## 1.2.0

1. Add spring cloud 2023 support.
2. Add auth inbound filter
3. Fixed some general bugs and improved stability.

## 1.1.0

1. Add complete circuit-break policy support.
2. Add OutboundListener support to refine more governance enhancement pointcuts.
3. Add rabbitmq, pulsar tag transmission support.
4. Fixed some general bugs and improved stability.

## 1.0.0

## Features
Expand Down
Binary file modified docs/image/weixin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 27 additions & 2 deletions joylive-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
</scm>

<properties>
<revision>1.2.0-SNAPSHOT</revision>
<revision>1.3.0-SNAPSHOT</revision>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -178,6 +178,11 @@
<artifactId>joylive-registry-springgateway3</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.jd.live</groupId>
<artifactId>joylive-registry-springgateway4</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.jd.live</groupId>
<artifactId>joylive-registry-dubbo3</artifactId>
Expand All @@ -198,16 +203,36 @@
<artifactId>joylive-registry-sofarpc</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.jd.live</groupId>
<artifactId>joylive-router-springweb5</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.jd.live</groupId>
<artifactId>joylive-router-springweb6</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.jd.live</groupId>
<artifactId>joylive-router-springcloud3</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.jd.live</groupId>
<artifactId>joylive-router-springcloud4</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.jd.live</groupId>
<artifactId>joylive-router-springgateway3</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.jd.live</groupId>
<artifactId>joylive-router-springgateway4</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.jd.live</groupId>
<artifactId>joylive-router-dubbo3</artifactId>
Expand Down Expand Up @@ -330,7 +355,7 @@
</dependency>
<dependency>
<groupId>com.jd.live</groupId>
<artifactId>joylive-transmission-springcloud3</artifactId>
<artifactId>joylive-transmission-springweb5</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@
public class RejectException extends LiveException {

public RejectException() {
super(null, null, false, false);
}

public RejectException(String message) {
super(message);
super(message, null, false, false);
}

public RejectException(String message, Throwable cause) {
super(message, cause);
super(message, cause, false, false);
}

public RejectException(Throwable cause) {
super(cause);
super(cause == null ? null : cause.getMessage(), cause, false, false);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,18 @@
public class VariableException extends LiveException {

public VariableException() {
super(null, null, false, false);
}

public VariableException(String message) {
super(message);
super(message, null, false, false);
}

public VariableException(String message, Throwable cause) {
super(message, cause);
super(message, cause, false, false);
}

public VariableException(Throwable cause) {
super(cause);
super(cause == null ? null : cause.getMessage(), cause, false, false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ public interface Constants {
*/
String LABEL_REGION = LABEL_LIVE_PREFIX + "region";

/**
* Constant for the instance ip.
*/
String LABEL_INSTANCE_IP = LABEL_LIVE_PREFIX + "instance-ip";

/**
* Constant for the live agent version.
*/
String LABEL_AGENT_VERSION = LABEL_LIVE_PREFIX + "agent-version";

/**
* Prefix for lane-related constants.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,31 @@ public void label(BiConsumer<String, String> consumer) {
}
}

/**
* Applies sync metadata to the application based on its properties.
*
* @param consumer label consumer
*/
public void sync(BiConsumer<String, String> consumer) {
if (consumer != null) {
accept(consumer, Constants.LABEL_APPLICATION, name);
accept(consumer, Constants.LABEL_INSTANCE_ID, instance);
if (location != null) {
accept(consumer, Constants.LABEL_REGION, location.getRegion());
accept(consumer, Constants.LABEL_ZONE, location.getZone());
accept(consumer, Constants.LABEL_LIVE_SPACE_ID, location.getLiveSpaceId());
accept(consumer, Constants.LABEL_UNIT, location.getUnit());
accept(consumer, Constants.LABEL_CELL, location.getCell());
accept(consumer, Constants.LABEL_LANE, location.getLane());
accept(consumer, Constants.LABEL_CLUSTER, location.getCluster());
accept(consumer, Constants.LABEL_INSTANCE_IP, location.getIp());
}
if (meta != null) {
accept(consumer, Constants.LABEL_AGENT_VERSION, meta.get(Constants.LABEL_AGENT_VERSION));
}
}
}

/**
* Helper method for applying labels.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ public String getParameter(String key) {
public String getUri() {
if (url == null) {
StringBuilder sb = new StringBuilder(128);
sb.append(schema).append("://").append(host);
if (schema != null) {
sb.append(schema).append("://");
}
sb.append(host);
if (port != null) {
sb.append(":").append(port);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
import com.jd.live.agent.core.util.shutdown.ShutdownHookAdapter;
import com.jd.live.agent.core.util.time.TimeScheduler;
import com.jd.live.agent.core.util.time.Timer;
import com.jd.live.agent.core.util.type.Artifact;
import com.jd.live.agent.core.util.version.JVM;
import com.jd.live.agent.core.util.version.VersionExpression;

Expand All @@ -77,6 +78,7 @@
import java.io.Reader;
import java.lang.instrument.Instrumentation;
import java.lang.reflect.InvocationTargetException;
import java.security.CodeSource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -474,6 +476,7 @@ private Application createApplication() {
injector.inject(app);
AppService appService = app.getService();
Location location = app.getLocation();
Map<String, String> meta = app.getMeta();
if (location == null) {
location = new Location();
app.setLocation(location);
Expand All @@ -482,6 +485,11 @@ private Application createApplication() {
appService = new AppService();
app.setService(appService);
}
if (meta == null) {
meta = new HashMap<>();
app.setMeta(meta);
}
setAgentVersion();
location.setIp(Ipv4.getLocalIp());
location.setHost(Ipv4.getLocalHost());
setProperty(Constants.LABEL_INSTANCE_ID, app.getInstance());
Expand Down Expand Up @@ -615,6 +623,17 @@ private void setupLogger() {
location.getUnit(), location.getCell(), location.getLane()));
}

private void setAgentVersion() {
try {
CodeSource codeSource = this.getClass().getProtectionDomain().getCodeSource();
Artifact artifact = new Artifact(codeSource.getLocation().getPath());
String agentVersion = artifact.getVersion();
application.getMeta().put(Constants.LABEL_AGENT_VERSION, agentVersion);
} catch (Throwable t) {
logger.error(t.getMessage(), t);
}
}

private boolean supportEnhance() {
String version = agentConfig.getEnhanceConfig().getJavaVersion();
version = version == null || version.isEmpty() ? EnhanceConfig.SUPPORT_JAVA_VERSION : version;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@
public class CircuitBreakException extends LiveException {

public CircuitBreakException() {
super(null, null, false, false);
}

public CircuitBreakException(String message) {
super(message);
super(message, null, false, false);
}

public CircuitBreakException(String message, Throwable cause) {
super(message, cause);
super(message, cause, false, false);
}

public CircuitBreakException(Throwable cause) {
super(cause);
super(cause == null ? null : cause.getMessage(), cause, false, false);
}

public CircuitBreakException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,19 @@
public class RetryException extends LiveException {

public RetryException() {
super(null, null, false, false);
}

public RetryException(String message) {
super(message);
super(message, null, false, false);
}

public RetryException(String message, Throwable cause) {
super(message, cause);
super(message, cause, false, false);
}

public RetryException(Throwable cause) {
super(cause);
super(cause == null ? null : cause.getMessage(), cause, false, false);
}

public RetryException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
Expand Down
Loading

0 comments on commit 74786aa

Please sign in to comment.