Skip to content

Commit

Permalink
Hide HttpHeaders.toMultiMap API (#24428)
Browse files Browse the repository at this point in the history
  • Loading branch information
alzimmermsft authored Sep 28, 2021
1 parent 5ceab7e commit cd8ad43
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ public Map<String, String> toMap() {
return abstractMap;
}

@Override
public Map<String, String[]> toMultiMap() {
Map<String, String[]> toMultiMap() {
if (abstractMultiMap == null) {
abstractMultiMap = new DeferredCacheImmutableMap<>(LOGGER, new HashMap<>(), nettyHeaders,
getAll -> getAll.toArray(new String[0]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public Map<String, String> toMap() {
*
* @return the headers in a copied and unmodifiable form.
*/
public Map<String, String[]> toMultiMap() {
Map<String, String[]> toMultiMap() {
final Map<String, String[]> result = new HashMap<>();
for (final HttpHeader header : headers.values()) {
result.put(header.getName(), header.getValues());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,16 @@ static Flux<ByteBuffer> validateLength(final HttpRequest request) {
* @return The updated context containing the span context.
*/
private Context startTracingSpan(Method method, Context context) {
boolean disableTracing = (boolean) context.getData(Tracer.DISABLE_TRACING_KEY).orElse(false);
if (!TracerProxy.isTracingEnabled() || disableTracing) {
// First check if tracing is enabled. This is an optimized operation, so it is done first.
if (!TracerProxy.isTracingEnabled()) {
return context;
}

// Then check if this method disabled tracing. This requires walking a linked list, so do it last.
if ((boolean) context.getData(Tracer.DISABLE_TRACING_KEY).orElse(false)) {
return context;
}

String spanName = interfaceParser.getServiceName() + "." + method.getName();
context = TracerProxy.setSpanName(spanName, context);
return TracerProxy.start(spanName, context);
Expand Down

0 comments on commit cd8ad43

Please sign in to comment.