Skip to content

Commit

Permalink
Revert "Add OpenCensus tracing instrument."
Browse files Browse the repository at this point in the history
This reverts commit 2f67205.
  • Loading branch information
jeanbza committed Jun 25, 2018
1 parent 36280df commit 9dd0d1c
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 387 deletions.
10 changes: 0 additions & 10 deletions google-http-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,5 @@
<artifactId>commons-codec</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.opencensus</groupId>
<artifactId>opencensus-api</artifactId>
<version>0.11.1</version>
</dependency>
<dependency>
<groupId>io.opencensus</groupId>
<artifactId>opencensus-contrib-http-util</artifactId>
<version>0.11.1</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,11 @@
import com.google.api.client.util.IOUtils;
import com.google.api.client.util.LoggingStreamingContent;
import com.google.api.client.util.ObjectParser;
import com.google.api.client.util.OpenCensusUtils;
import com.google.api.client.util.Preconditions;
import com.google.api.client.util.Sleeper;
import com.google.api.client.util.StreamingContent;
import com.google.api.client.util.StringUtils;

import io.opencensus.common.Scope;
import io.opencensus.trace.Span;
import io.opencensus.trace.Tracer;

import java.io.IOException;
import java.io.InputStream;
import java.util.concurrent.Callable;
Expand Down Expand Up @@ -215,12 +210,6 @@ static String executeAndGetValueOfSomeCustomHeader(HttpRequest request) {
/** Sleeper. */
private Sleeper sleeper = Sleeper.DEFAULT;

/** OpenCensus tracing component. */
private Tracer tracer = OpenCensusUtils.getTracer();

/** Prefix for tracing span name. */
private static final String traceSpanNamePrefix = "Sent." + HttpRequest.class.getName() + ".";

/**
* @param transport HTTP transport
* @param requestMethod HTTP request method or {@code null} for none
Expand Down Expand Up @@ -865,9 +854,7 @@ public HttpResponse execute() throws IOException {
Preconditions.checkNotNull(requestMethod);
Preconditions.checkNotNull(url);

Span span = tracer.spanBuilder(traceSpanNamePrefix + "execute").startSpan();
do {
span.addAnnotation("retry #" + numRetries);
// Cleanup any unneeded response from a previous iteration
if (response != null) {
response.ignore();
Expand Down Expand Up @@ -911,8 +898,6 @@ public HttpResponse execute() throws IOException {
headers.setUserAgent(originalUserAgent + " " + USER_AGENT_SUFFIX);
}
}
OpenCensusUtils.propagateTracingContext(headers);

// headers
HttpHeaders.serializeHeaders(headers, logbuf, curlbuf, logger, lowLevelHttpRequest);
if (!suppressUserAgentSuffix) {
Expand Down Expand Up @@ -992,9 +977,6 @@ public HttpResponse execute() throws IOException {

// execute
lowLevelHttpRequest.setTimeout(connectTimeout, readTimeout);
// switch tracing scope to current span
@SuppressWarnings("MustBeClosedChecker")
Scope ws = tracer.withSpan(span);
try {
LowLevelHttpResponse lowLevelHttpResponse = lowLevelHttpRequest.execute();
// Flag used to indicate if an exception is thrown before the response is constructed.
Expand All @@ -1020,8 +1002,6 @@ public HttpResponse execute() throws IOException {
if (loggable) {
logger.log(Level.WARNING, "exception thrown while executing request", e);
}
} finally {
ws.close();
}

// Flag used to indicate if an exception is thrown before the response has completed
Expand Down Expand Up @@ -1077,7 +1057,6 @@ public HttpResponse execute() throws IOException {
}
}
} while (retryRequest);
span.end(OpenCensusUtils.getEndSpanOptions(response == null ? null : response.getStatusCode()));

if (response == null) {
// Retries did not help resolve the execute exception, re-throw it.
Expand Down

This file was deleted.

Loading

0 comments on commit 9dd0d1c

Please sign in to comment.