All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.undefinedlabs.scope.rules.propagation.carriers.HttpAkkaRequestExtractAdapter Maven / Gradle / Ivy

Go to download

Scope is a APM for tests to give engineering teams unprecedented visibility into their CI process to quickly identify, troubleshoot and fix failed builds. This artifact contains the classes to instrument the Akka HTTP.

There is a newer version: 0.15.1-beta.2
Show newest version
package com.undefinedlabs.scope.rules.propagation.carriers;

import akka.http.javadsl.model.HttpHeader;
import akka.http.scaladsl.model.HttpRequest;
import io.opentracing.propagation.TextMap;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class HttpAkkaRequestExtractAdapter implements TextMap {

  private Map headers;

  public HttpAkkaRequestExtractAdapter(final HttpRequest request) {
    this.headers = new HashMap<>();
    for (final HttpHeader header : request.getHeaders()) {
      this.headers.put(header.name(), header.value());
    }
  }

  @Override
  public Iterator> iterator() {
    return this.headers.entrySet().iterator();
  }

  @Override
  public void put(String s, String s1) {
    throw new UnsupportedOperationException(
        "This class should be used only with Tracer.extract()!");
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy