com.github.kristofa.brave.ClientResponseInterceptor Maven / Gradle / Ivy
package com.github.kristofa.brave;
import static com.github.kristofa.brave.internal.Util.checkNotNull;
/**
* Contains logic for dealing with response from client request.
* This means it will:
*
* - Submit potential annotations
* - Submit client received annotation
*
* You will have to implement ClientResponseAdapter.
*
* @see ClientResponseAdapter
* @deprecated Replaced by {@code HttpClientHander} from brave-instrumentation-http
*/
@Deprecated
public class ClientResponseInterceptor {
private final ClientTracer clientTracer;
public ClientResponseInterceptor(ClientTracer clientTracer) {
this.clientTracer = checkNotNull(clientTracer, "Null clientTracer");
}
/**
* Handle a client response.
*
* @param adapter Adapter that hides implementation details.
*/
public void handle(ClientResponseAdapter adapter) {
try {
for (KeyValueAnnotation annotation : adapter.responseAnnotations()) {
clientTracer.submitBinaryAnnotation(annotation.getKey(), annotation.getValue());
}
}
finally
{
clientTracer.setClientReceived();
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy