Skip to content

Commit 9dd0d1c

Browse files
committed
Revert "Add OpenCensus tracing instrument."
This reverts commit 2f67205.
1 parent 36280df commit 9dd0d1c

File tree

4 files changed

+0
-387
lines changed

4 files changed

+0
-387
lines changed

google-http-client/pom.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,5 @@
169169
<artifactId>commons-codec</artifactId>
170170
<scope>provided</scope>
171171
</dependency>
172-
<dependency>
173-
<groupId>io.opencensus</groupId>
174-
<artifactId>opencensus-api</artifactId>
175-
<version>0.11.1</version>
176-
</dependency>
177-
<dependency>
178-
<groupId>io.opencensus</groupId>
179-
<artifactId>opencensus-contrib-http-util</artifactId>
180-
<version>0.11.1</version>
181-
</dependency>
182172
</dependencies>
183173
</project>

google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,11 @@
1818
import com.google.api.client.util.IOUtils;
1919
import com.google.api.client.util.LoggingStreamingContent;
2020
import com.google.api.client.util.ObjectParser;
21-
import com.google.api.client.util.OpenCensusUtils;
2221
import com.google.api.client.util.Preconditions;
2322
import com.google.api.client.util.Sleeper;
2423
import com.google.api.client.util.StreamingContent;
2524
import com.google.api.client.util.StringUtils;
2625

27-
import io.opencensus.common.Scope;
28-
import io.opencensus.trace.Span;
29-
import io.opencensus.trace.Tracer;
30-
3126
import java.io.IOException;
3227
import java.io.InputStream;
3328
import java.util.concurrent.Callable;
@@ -215,12 +210,6 @@ static String executeAndGetValueOfSomeCustomHeader(HttpRequest request) {
215210
/** Sleeper. */
216211
private Sleeper sleeper = Sleeper.DEFAULT;
217212

218-
/** OpenCensus tracing component. */
219-
private Tracer tracer = OpenCensusUtils.getTracer();
220-
221-
/** Prefix for tracing span name. */
222-
private static final String traceSpanNamePrefix = "Sent." + HttpRequest.class.getName() + ".";
223-
224213
/**
225214
* @param transport HTTP transport
226215
* @param requestMethod HTTP request method or {@code null} for none
@@ -865,9 +854,7 @@ public HttpResponse execute() throws IOException {
865854
Preconditions.checkNotNull(requestMethod);
866855
Preconditions.checkNotNull(url);
867856

868-
Span span = tracer.spanBuilder(traceSpanNamePrefix + "execute").startSpan();
869857
do {
870-
span.addAnnotation("retry #" + numRetries);
871858
// Cleanup any unneeded response from a previous iteration
872859
if (response != null) {
873860
response.ignore();
@@ -911,8 +898,6 @@ public HttpResponse execute() throws IOException {
911898
headers.setUserAgent(originalUserAgent + " " + USER_AGENT_SUFFIX);
912899
}
913900
}
914-
OpenCensusUtils.propagateTracingContext(headers);
915-
916901
// headers
917902
HttpHeaders.serializeHeaders(headers, logbuf, curlbuf, logger, lowLevelHttpRequest);
918903
if (!suppressUserAgentSuffix) {
@@ -992,9 +977,6 @@ public HttpResponse execute() throws IOException {
992977

993978
// execute
994979
lowLevelHttpRequest.setTimeout(connectTimeout, readTimeout);
995-
// switch tracing scope to current span
996-
@SuppressWarnings("MustBeClosedChecker")
997-
Scope ws = tracer.withSpan(span);
998980
try {
999981
LowLevelHttpResponse lowLevelHttpResponse = lowLevelHttpRequest.execute();
1000982
// Flag used to indicate if an exception is thrown before the response is constructed.
@@ -1020,8 +1002,6 @@ public HttpResponse execute() throws IOException {
10201002
if (loggable) {
10211003
logger.log(Level.WARNING, "exception thrown while executing request", e);
10221004
}
1023-
} finally {
1024-
ws.close();
10251005
}
10261006

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

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

google-http-client/src/main/java/com/google/api/client/util/OpenCensusUtils.java

Lines changed: 0 additions & 157 deletions
This file was deleted.

0 commit comments

Comments
 (0)