Add namespace for headers. (#954)
This commit is contained in:
parent
ae39e7b5a1
commit
c56046d29a
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue