diff --git a/CHANGES.md b/CHANGES.md
index 9f921926c9..6ed0bacb7a 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,10 +1,17 @@
-
Changes by Version
==================
Release Notes.
8.10.0
------------------
+
+* [Important] Namespace represents a subnet, such as kubernetes namespace, or 172.10.*.*. Make namespace concept as a
+ part of service naming format.
+* [Important] Add cluster concept, also as a part of service naming format. The cluster name would be
+ 1. Add as {@link #SERVICE_NAME} suffix.
+ 2. Add as exit span's peer, ${CLUSTER} / original peer
+ 3. Cross Process Propagation Header's value addressUsedAtClient[index=8] (Target address of this request used on the
+ client end).
* Support Undertow thread pool metrics collecting.
* Support Tomcat thread pool metric collect.
* Remove plugin for ServiceComb Java Chassis 0.x
@@ -21,10 +28,17 @@ Release Notes.
* Renamed graphql-12.x-plugin to graphql-12.x-15.x-plugin and graphql-12.x-scenario to graphql-12.x-15.x-scenario.
* Add graphql-16plus plugin.
* [Test] Support to configure plugin test base images.
+* [Breaking Change] Remove deprecated `agent.instance_properties` configuration.
+ Recommend `agent.instance_properties_json`.
+* The namespace and cluster would be reported as instance properties, keys are `namespace` and `cluster`. Notice, if
+ instance_properties_json includes these two keys, they would be overrided by the agent core.
+* [Breaking Change] Remove the namespace from `cross process propagation` key.
#### Documentation
-* Add link about java agent injector.
+* Add link about java agent injector.
+* Update configurations doc, remove `agent.instance_properties[key]=value`.
+* Update configurations doc, add `agent.cluster` and update `agent.namespace`.
All issues and pull requests are [here](https://github.com/apache/skywalking/milestone/120?closed=1)
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java
index 46e109b8b2..d9a191f427 100755
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java
@@ -19,9 +19,7 @@
package org.apache.skywalking.apm.agent.core.conf;
import java.util.Arrays;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
import org.apache.skywalking.apm.agent.core.logging.core.LogLevel;
import org.apache.skywalking.apm.agent.core.logging.core.LogOutput;
@@ -37,17 +35,46 @@ public class Config {
public static class Agent {
/**
- * Namespace isolates headers in cross process propagation. The HEADER name will be `HeaderName:Namespace`.
+ * Namespace represents a subnet, such as kubernetes namespace, or 172.10.*.*.
+ *
+ * @since 8.10.0 namespace would be added as {@link #SERVICE_NAME} suffix.
+ *
+ * Removed namespace isolating headers in cross process propagation. The HEADER name was
+ * `HeaderName:Namespace`.
*/
+ @Length(20)
public static String NAMESPACE = "";
/**
- * Service name is showed in skywalking-ui. Suggestion: set a unique name for each service, service instance
- * nodes share the same code
+ * Service name is showed on the UI. Suggestion: set a unique name for each service, service instance nodes
+ * share the same code
+ *
+ * @since 8.10.0 ${service name} = [${group name}::]${logic name}|${NAMESPACE}|${CLUSTER}
+ *
+ * The group name, namespace and cluster are optional. Once they are all blank, service name would be the final
+ * name.
*/
@Length(50)
public static String SERVICE_NAME = "";
+ /**
+ * Cluster defines the physical cluster in a data center or same network segment. In one cluster, IP address
+ * should be unique identify.
+ *
+ * The cluster name would be
+ *
+ * 1. Add as {@link #SERVICE_NAME} suffix.
+ *
+ * 2. Add as exit span's peer, ${CLUSTER} / original peer
+ *
+ * 3. Cross Process Propagation Header's value addressUsedAtClient[index=8] (Target address of this request used
+ * on the client end).
+ *
+ * @since 8.10.0
+ */
+ @Length(20)
+ public static String CLUSTER = "";
+
/**
* Authentication active is based on backend setting, see application.yml for more details. For most scenarios,
* this needs backend extensions, only basic match auth provided in default implementation.
@@ -61,8 +88,8 @@ public static class Agent {
public static int SAMPLE_N_PER_3_SECS = -1;
/**
- * If the operation name of the first span is included in this set, this segment should be ignored.
- * Multiple values should be separated by `,`.
+ * If the operation name of the first span is included in this set, this segment should be ignored. Multiple
+ * values should be separated by `,`.
*/
public static String IGNORE_SUFFIX = ".jpg,.jpeg,.js,.css,.png,.bmp,.gif,.ico,.mp3,.mp4,.html,.svg";
@@ -103,16 +130,8 @@ public static class Agent {
public volatile static String INSTANCE_NAME = "";
/**
- * service instance properties e.g. agent.instance_properties[org]=apache
- * Notice it will be overridden by `agent.instance_properties_json `, if the key duplication.
- * For example: e.g. agent.instance_properties_json = {"org": "apache-skywalking"}
- */
- @Deprecated
- public static Map INSTANCE_PROPERTIES = new HashMap<>();
-
- /**
- * service instance properties in json format.
- * e.g. agent.instance_properties_json = {"org": "apache-skywalking"}
+ * service instance properties in json format. e.g. agent.instance_properties_json = {"org":
+ * "apache-skywalking"}
*/
public static String INSTANCE_PROPERTIES_JSON = "";
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Constants.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Constants.java
index 4e3bcf4c9e..3c0d1f35a9 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Constants.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Constants.java
@@ -24,4 +24,6 @@ public class Constants {
public static String LINE_SEPARATOR = System.getProperty("line.separator", "\n");
public static String EMPTY_STRING = "";
+
+ public static char SERVICE_NAME_PART_CONNECTOR = '|';
}
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/SnifferConfigInitializer.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/SnifferConfigInitializer.java
index 7eb1809a64..0aa984dc0e 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/SnifferConfigInitializer.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/SnifferConfigInitializer.java
@@ -38,6 +38,8 @@
import org.apache.skywalking.apm.util.PropertyPlaceholderHelper;
import org.apache.skywalking.apm.util.StringUtil;
+import static org.apache.skywalking.apm.agent.core.conf.Constants.SERVICE_NAME_PART_CONNECTOR;
+
/**
* The SnifferConfigInitializer initializes all configs in several way.
*/
@@ -98,6 +100,15 @@ public static void initializeCoreConfig(String agentOptions) {
if (StringUtil.isEmpty(Config.Agent.SERVICE_NAME)) {
throw new ExceptionInInitializerError("`agent.service_name` is missing.");
+ } else {
+ if (StringUtil.isNotEmpty(Config.Agent.NAMESPACE) || StringUtil.isNotEmpty(Config.Agent.CLUSTER)) {
+ Config.Agent.SERVICE_NAME = StringUtil.join(
+ SERVICE_NAME_PART_CONNECTOR,
+ Config.Agent.SERVICE_NAME,
+ Config.Agent.NAMESPACE,
+ Config.Agent.CLUSTER
+ );
+ }
}
if (StringUtil.isEmpty(Config.Collector.BACKEND_SERVICE)) {
throw new ExceptionInInitializerError("`collector.backend_service` is missing.");
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/CarrierItem.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/CarrierItem.java
index bc1c1d2e1d..7702972849 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/CarrierItem.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/CarrierItem.java
@@ -19,9 +19,6 @@
package org.apache.skywalking.apm.agent.core.context;
import java.util.Iterator;
-import org.apache.skywalking.apm.util.StringUtil;
-
-import static org.apache.skywalking.apm.agent.core.conf.Config.Agent.NAMESPACE;
public class CarrierItem implements Iterator {
private String headKey;
@@ -33,11 +30,7 @@ public CarrierItem(String headKey, String headValue) {
}
public CarrierItem(String headKey, String headValue, CarrierItem next) {
- if (StringUtil.isEmpty(NAMESPACE)) {
- this.headKey = headKey;
- } else {
- this.headKey = NAMESPACE + "-" + headKey;
- }
+ this.headKey = headKey;
this.headValue = headValue;
this.next = next;
}
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/TracingContext.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/TracingContext.java
index bb9f28f40f..ec9c4e1820 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/TracingContext.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/TracingContext.java
@@ -45,6 +45,8 @@
import org.apache.skywalking.apm.agent.core.profile.ProfileTaskExecutionService;
import org.apache.skywalking.apm.util.StringUtil;
+import static org.apache.skywalking.apm.agent.core.conf.Config.Agent.CLUSTER;
+
/**
* The TracingContext represents a core tracing logic controller. It build the final {@link
* TracingContext}, by the stack mechanism, which is similar with the codes work.
@@ -322,7 +324,7 @@ public AbstractSpan createLocalSpan(final String operationName) {
* @see ExitSpan
*/
@Override
- public AbstractSpan createExitSpan(final String operationName, final String remotePeer) {
+ public AbstractSpan createExitSpan(final String operationName, String remotePeer) {
if (isLimitMechanismWorking()) {
NoopExitSpan span = new NoopExitSpan(remotePeer);
return push(span);
@@ -334,6 +336,8 @@ public AbstractSpan createExitSpan(final String operationName, final String remo
if (parentSpan != null && parentSpan.isExit()) {
exitSpan = parentSpan;
} else {
+ // Since 8.10.0
+ remotePeer = StringUtil.isEmpty(CLUSTER) ? remotePeer : CLUSTER + "/" + remotePeer;
final int parentSpanId = parentSpan == null ? -1 : parentSpan.getSpanId();
exitSpan = new ExitSpan(spanIdGenerator++, parentSpanId, operationName, remotePeer, owner);
push(exitSpan);
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/util/InstanceJsonPropertiesUtil.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/util/InstanceJsonPropertiesUtil.java
index 7862a53c4f..498aa81fc8 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/util/InstanceJsonPropertiesUtil.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/util/InstanceJsonPropertiesUtil.java
@@ -34,18 +34,18 @@ public static List parseProperties() {
List properties = new ArrayList<>();
if (StringUtil.isNotEmpty(Config.Agent.INSTANCE_PROPERTIES_JSON)) {
- Config.Agent.INSTANCE_PROPERTIES.putAll(
- GSON.fromJson(
- Config.Agent.INSTANCE_PROPERTIES_JSON,
- new TypeToken