brave.opentracing.TextMapPropagation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of brave-opentracing Show documentation
Show all versions of brave-opentracing Show documentation
Zipkin OpenTracing Brave bridge
/*
* Copyright 2016-2020 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package brave.opentracing;
import brave.Span.Kind;
import brave.propagation.Propagation;
import brave.propagation.Propagation.Getter;
import brave.propagation.Propagation.RemoteSetter;
import brave.propagation.Propagation.Setter;
import brave.propagation.TraceContext.Extractor;
import brave.propagation.TraceContextOrSamplingFlags;
import io.opentracing.propagation.TextMapExtract;
import io.opentracing.propagation.TextMapInject;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
final class TextMapPropagation {
static final Setter SETTER = new Setter() {
@Override public void put(TextMapInject request, String key, String value) {
request.put(key, value);
}
@Override public String toString() {
return "TextMapInject::put";
}
};
enum REMOTE_SETTER implements RemoteSetter {
CLIENT() {
@Override public Kind spanKind() {
return Kind.CLIENT;
}
},
PRODUCER() {
@Override public Kind spanKind() {
return Kind.PRODUCER;
}
},
CONSUMER() {
@Override public Kind spanKind() {
return Kind.CONSUMER;
}
};
@Override public void put(TextMapInject request, String key, String value) {
SETTER.put(request, key, value);
}
@Override public String toString() {
return SETTER.toString();
}
}
static final Getter