未验证 提交 c56046d2 编写于 作者: wu-sheng's avatar wu-sheng 提交者: GitHub

Add namespace for headers. (#954)

上级 ae39e7b5
......@@ -31,6 +31,11 @@ import org.apache.skywalking.apm.agent.core.logging.core.WriterFactory;
public class Config {
public static class Agent {
/**
* Namespace isolates headers in cross process propagation. The HEADER name will be `HeaderName:Namespace`.
*/
public static String NAMESPACE = "";
/**
* Application code is showed in sky-walking-ui. Suggestion: set an unique name for each application, one
* application's nodes share the same code.
......
......@@ -16,10 +16,12 @@
*
*/
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;
/**
* @author wusheng
......@@ -30,13 +32,15 @@ public class CarrierItem implements Iterator<CarrierItem> {
private CarrierItem next;
public CarrierItem(String headKey, String headValue) {
this.headKey = headKey;
this.headValue = headValue;
next = null;
this(headKey, headValue, null);
}
public CarrierItem(String headKey, String headValue, CarrierItem next) {
this.headKey = headKey;
if (StringUtil.isEmpty(NAMESPACE)) {
this.headKey = headKey;
} else {
this.headKey = NAMESPACE + ":" + headValue;
}
this.headValue = headValue;
this.next = next;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册