Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade nacos client from 1.4.2 to 2.3.2 #12362

Merged
merged 11 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions apm-dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>oap-server-bom</artifactId>
<version>${project.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
Comment on lines +37 to +47
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to add this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module apache-skywalking-apm without dependencyManagement can not handle dependency conflict and version management

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oap-server has that, and dist itself is just packaging, it should not include any new dependency AFAIK.

<dependencies>
<dependency>
<groupId>org.apache.skywalking</groupId>
Expand Down
53 changes: 25 additions & 28 deletions dist-material/release-docs/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,14 @@ The text of each license is the standard Apache 2.0 license.
https://mvnrepository.com/artifact/build.buf.protoc-gen-validate/protoc-gen-validate/0.6.13 Apache-2.0
https://mvnrepository.com/artifact/com.aayushatharva.brotli4j/brotli4j/1.15.0 Apache-2.0
https://mvnrepository.com/artifact/com.aayushatharva.brotli4j/service/1.15.0 Apache-2.0
https://mvnrepository.com/artifact/com.alibaba.nacos/nacos-api/1.4.2 Apache-2.0
https://mvnrepository.com/artifact/com.alibaba.nacos/nacos-client/1.4.2 Apache-2.0
https://mvnrepository.com/artifact/com.alibaba.nacos/nacos-common/1.4.2 Apache-2.0
https://mvnrepository.com/artifact/com.alibaba.nacos/nacos-auth-plugin/2.3.2 Apache-2.0
https://mvnrepository.com/artifact/com.alibaba.nacos/nacos-client/2.3.2 Apache-2.0
https://mvnrepository.com/artifact/com.alibaba.nacos/nacos-encryption-plugin/2.3.2 Apache-2.0
https://mvnrepository.com/artifact/com.ctrip.framework.apollo/apollo-client/1.8.0 Apache-2.0
https://mvnrepository.com/artifact/com.ctrip.framework.apollo/apollo-core/1.8.0 Apache-2.0
https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations/2.16.1 Apache-2.0
https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core/2.16.1 Apache-2.0
https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind/2.16.1 Apache-2.0
https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations/2.16.0 Apache-2.0
https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core/2.16.0 Apache-2.0
https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind/2.16.0 Apache-2.0
https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/2.15.2 Apache-2.0
https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-guava/2.12.0 Apache-2.0
https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.16.1 Apache-2.0
Expand All @@ -243,15 +243,14 @@ The text of each license is the standard Apache 2.0 license.
https://mvnrepository.com/artifact/com.linecorp.armeria/armeria-graphql-protocol/1.27.3 Apache-2.0
https://mvnrepository.com/artifact/com.linecorp.armeria/armeria-protobuf/1.27.3 Apache-2.0
https://mvnrepository.com/artifact/com.orbitz.consul/consul-client/1.5.3 Apache-2.0
https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp/4.9.0 Apache-2.0
https://mvnrepository.com/artifact/com.squareup.okio/okio/2.8.0 Apache-2.0
https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp/3.14.9 Apache-2.0
https://mvnrepository.com/artifact/com.squareup.okio/okio/1.17.2 Apache-2.0
https://mvnrepository.com/artifact/com.squareup.retrofit2/converter-jackson/2.9.0 Apache-2.0
https://mvnrepository.com/artifact/com.squareup.retrofit2/retrofit/2.9.0 Apache-2.0
https://mvnrepository.com/artifact/com.zaxxer/HikariCP/3.1.0 Apache-2.0
https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils/1.9.4 Apache-2.0
https://mvnrepository.com/artifact/commons-codec/commons-codec/1.11 Apache-2.0
https://mvnrepository.com/artifact/commons-io/commons-io/2.7 Apache-2.0
https://mvnrepository.com/artifact/commons-logging/commons-logging/1.2 Apache-2.0
https://mvnrepository.com/artifact/commons-net/commons-net/3.9.0 Apache-2.0
https://mvnrepository.com/artifact/commons-validator/commons-validator/1.7 Apache-2.0
https://npmjs.com/package/d3-flame-graph/v/4.1.3 4.1.3 Apache-2.0
Expand Down Expand Up @@ -303,29 +302,27 @@ The text of each license is the standard Apache 2.0 license.
https://mvnrepository.com/artifact/io.micrometer/micrometer-observation/1.12.2 Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-buffer/4.1.108.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-codec/4.1.108.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-codec-dns/4.1.106.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-codec-haproxy/4.1.106.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-codec-dns/4.1.108.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-codec-haproxy/4.1.108.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-codec-http/4.1.108.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-codec-http2/4.1.108.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-codec-socks/4.1.108.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-common/4.1.108.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-handler/4.1.108.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-handler-proxy/4.1.108.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-resolver/4.1.106.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-resolver-dns/4.1.106.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-resolver-dns-classes-macos/4.1.106.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-resolver-dns-native-macos/4.1.106.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-resolver/4.1.108.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-resolver-dns/4.1.108.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-resolver-dns-classes-macos/4.1.108.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-resolver-dns-native-macos/4.1.108.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-tcnative-boringssl-static/2.0.52.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-tcnative-boringssl-static/2.0.61.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-tcnative-classes/2.0.61.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-transport/4.1.106.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-transport-classes-epoll/4.1.106.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-transport-classes-kqueue/4.1.106.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-transport-native-epoll/4.1.45.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-transport-native-epoll/4.1.106.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-transport-native-kqueue/4.1.106.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-transport-native-unix-common/4.1.100.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-transport-native-unix-common/4.1.106.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-tcnative-boringssl-static/2.0.65.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-tcnative-classes/2.0.65.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-transport/4.1.108.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-transport-classes-epoll/4.1.108.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-transport-classes-kqueue/4.1.108.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-transport-native-epoll/4.1.108.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-transport-native-kqueue/4.1.108.Final Apache-2.0
https://mvnrepository.com/artifact/io.netty/netty-transport-native-unix-common/4.1.108.Final Apache-2.0
https://mvnrepository.com/artifact/io.perfmark/perfmark-api/0.26.0 Apache-2.0
https://mvnrepository.com/artifact/io.prometheus/simpleclient/0.6.0 Apache-2.0
https://mvnrepository.com/artifact/io.prometheus/simpleclient_common/0.6.0 Apache-2.0
Expand All @@ -337,15 +334,15 @@ The text of each license is the standard Apache 2.0 license.
https://mvnrepository.com/artifact/javax.inject/javax.inject/1 Apache-2.0
https://mvnrepository.com/artifact/joda-time/joda-time/2.10.5 Apache-2.0
https://mvnrepository.com/artifact/net.jodah/failsafe/2.4.4 Apache-2.0
https://mvnrepository.com/artifact/org.apache.commons/commons-lang3/3.11 Apache-2.0
https://mvnrepository.com/artifact/org.apache.commons/commons-lang3/3.12.0 Apache-2.0
https://mvnrepository.com/artifact/org.apache.commons/commons-text/1.4 Apache-2.0
https://mvnrepository.com/artifact/org.apache.curator/curator-client/4.3.0 Apache-2.0
https://mvnrepository.com/artifact/org.apache.curator/curator-framework/4.3.0 Apache-2.0
https://mvnrepository.com/artifact/org.apache.curator/curator-recipes/4.3.0 Apache-2.0
https://mvnrepository.com/artifact/org.apache.curator/curator-x-discovery/4.3.0 Apache-2.0
https://mvnrepository.com/artifact/org.apache.groovy/groovy/4.0.15 Apache-2.0
https://mvnrepository.com/artifact/org.apache.httpcomponents/httpasyncclient/4.1.3 Apache-2.0
https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient/4.5.3 Apache-2.0
https://mvnrepository.com/artifact/org.apache.httpcomponents/httpasyncclient/4.1.5 Apache-2.0
https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient/4.5.13 Apache-2.0
https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore/4.4.13 Apache-2.0
https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore-nio/4.4.13 Apache-2.0
https://mvnrepository.com/artifact/org.apache.kafka/kafka-clients/3.4.0 Apache-2.0
Expand Down
1 change: 1 addition & 0 deletions docs/en/changes/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* Add Python as a supported language for Pulsar.
* Make more proper histogram buckets for the `persistence_timer_bulk_prepare_latency`,
`persistence_timer_bulk_execute_latency` and `persistence_timer_bulk_all_latency` metrics in PersistenceTimer.
* [Break Change] Update Nacos version to 2.3.2. Nacos 1.x server can't serve as cluster coordinator and configuration server.

#### UI

Expand Down
2 changes: 2 additions & 0 deletions docs/en/setup/backend/backend-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ The following settings are provided to set the host and port manually, based on

Set the **cluster/selector** to **nacos** in the yml to enable it.

Nacos 2.x is required.

```yaml
cluster:
selector: ${SW_CLUSTER:nacos}
Expand Down
4 changes: 3 additions & 1 deletion docs/en/setup/backend/dynamic-config-nacos.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Dynamic Configuration Nacos Implementation

[Nacos](https://github.com/alibaba/nacos) is also supported as a Dynamic Configuration Center (DCC). To use it, please configure it as follows:
[Nacos](https://github.com/alibaba/nacos) 2.x is also supported as a Dynamic Configuration Center (DCC).

To use it, please configure it as follows:

```yaml
configuration:
Expand Down
9 changes: 8 additions & 1 deletion oap-server-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<jackson-databind.version>2.16.0</jackson-databind.version>
<simpleclient.version>0.6.0</simpleclient.version>
<apollo.version>1.8.0</apollo.version>
<nacos.version>1.4.2</nacos.version>
<nacos.version>2.3.2</nacos.version>
<curator.version>4.3.0</curator.version>
<curator-test.version>2.12.0</curator-test.version>
<etcd4j.version>2.18.0</etcd4j.version>
Expand All @@ -71,6 +71,7 @@
<armeria.version>1.27.3</armeria.version>
<awaitility.version>3.0.0</awaitility.version>
<httpcore.version>4.4.13</httpcore.version>
<httpasyncclient.version>4.1.5</httpasyncclient.version>
<commons-compress.version>1.21</commons-compress.version>
<banyandb-java-client.version>0.6.0</banyandb-java-client.version>
<kafka-clients.version>3.4.0</kafka-clients.version>
Expand Down Expand Up @@ -518,6 +519,12 @@
<version>${httpclient.version}</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpasyncclient</artifactId>
<version>${httpasyncclient.version}</version>
</dependency>

<dependency>
<groupId>com.google.flatbuffers</groupId>
<artifactId>flatbuffers-java</artifactId>
Expand Down
26 changes: 0 additions & 26 deletions oap-server/server-cluster-plugin/cluster-nacos-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,6 @@
<dependency>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-client</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</exclusion>
<exclusion>
<groupId>net.jcip</groupId>
<artifactId>jcip-annotations</artifactId>
</exclusion>
</exclusions>
Comment on lines -38 to -63
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you exclude this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nacos-client 2.3.2 have make these package optional, not transitivity

</dependency>
<!-- Override the dependency to use the same version of httpcore-nio -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
package org.apache.skywalking.oap.server.cluster.plugin.nacos;

import com.alibaba.nacos.api.naming.NamingService;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import lombok.Getter;
import org.apache.skywalking.oap.server.core.cluster.ClusterCoordinator;
import org.apache.skywalking.oap.server.core.cluster.ClusterNodesQuery;
Expand All @@ -33,6 +36,7 @@
import org.apache.skywalking.oap.server.telemetry.api.MetricsCreator;
import org.apache.skywalking.oap.server.telemetry.none.MetricsCreatorNoop;
import org.apache.skywalking.oap.server.telemetry.none.NoneTelemetryProvider;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand All @@ -46,10 +50,6 @@
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand All @@ -58,17 +58,16 @@
@ExtendWith(MockitoExtension.class)
public class ClusterModuleNacosProviderFunctionalIT {

private String nacosAddress;
private final String username = "nacos";
private final String password = "nacos";

@Container
public final GenericContainer<?> container =
new GenericContainer<>(DockerImageName.parse("nacos/nacos-server:1.4.2"))
new GenericContainer<>(DockerImageName.parse("nacos/nacos-server:v2.3.2-slim"))
.waitingFor(Wait.forLogMessage(".*Nacos started successfully.*", 1))
.withEnv(Collections.singletonMap("MODE", "standalone"))
.withExposedPorts(8848);

.withLogConsumer(outputFrame -> System.out.print(outputFrame.getUtf8String()))
.withExposedPorts(8848, 9848);
private final String username = "nacos";
private final String password = "nacos";
private String nacosAddress;
@Mock
private ModuleManager moduleManager;
@Mock
Expand All @@ -82,6 +81,13 @@ public void before() {
Whitebox.setInternalState(telemetryModule, "loadedProvider", telemetryProvider);
Mockito.when(moduleManager.find(TelemetryModule.NAME)).thenReturn(telemetryModule);
nacosAddress = container.getHost() + ":" + container.getMappedPort(8848);
Integer nacosPortOffset = container.getMappedPort(9848) - container.getMappedPort(8848);
System.setProperty("nacos.server.grpc.port.offset", nacosPortOffset.toString());
Comment on lines +84 to +85
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this about?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nacos 2.x server have two port, 8848(http) and 9948(gRPC) by default. Nacos Client 's implement use 8848(http.port) + 1000(nacos.server.grpc.port.offset) as gRPC port. It works on virtual machine.
But the testContainer will not Mapport the port One-By-One. so i need to configure nacos.server.grpc.port.offset

Doc ref :https://nacos.io/docs/next/manual/user/java-sdk/properties/#24-%E8%BF%9E%E6%8E%A5%E7%9B%B8%E5%85%B3

}

@AfterEach
public void after() {
System.clearProperty("nacos.server.grpc.port.offset");
}

@Test
Expand Down
Loading
Loading