18
18
import com .google .api .client .util .IOUtils ;
19
19
import com .google .api .client .util .LoggingStreamingContent ;
20
20
import com .google .api .client .util .ObjectParser ;
21
- import com .google .api .client .util .OpenCensusUtils ;
22
21
import com .google .api .client .util .Preconditions ;
23
22
import com .google .api .client .util .Sleeper ;
24
23
import com .google .api .client .util .StreamingContent ;
25
24
import com .google .api .client .util .StringUtils ;
26
25
27
- import io .opencensus .common .Scope ;
28
- import io .opencensus .trace .Span ;
29
- import io .opencensus .trace .Tracer ;
30
-
31
26
import java .io .IOException ;
32
27
import java .io .InputStream ;
33
28
import java .util .concurrent .Callable ;
@@ -215,12 +210,6 @@ static String executeAndGetValueOfSomeCustomHeader(HttpRequest request) {
215
210
/** Sleeper. */
216
211
private Sleeper sleeper = Sleeper .DEFAULT ;
217
212
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
-
224
213
/**
225
214
* @param transport HTTP transport
226
215
* @param requestMethod HTTP request method or {@code null} for none
@@ -865,9 +854,7 @@ public HttpResponse execute() throws IOException {
865
854
Preconditions .checkNotNull (requestMethod );
866
855
Preconditions .checkNotNull (url );
867
856
868
- Span span = tracer .spanBuilder (traceSpanNamePrefix + "execute" ).startSpan ();
869
857
do {
870
- span .addAnnotation ("retry #" + numRetries );
871
858
// Cleanup any unneeded response from a previous iteration
872
859
if (response != null ) {
873
860
response .ignore ();
@@ -911,8 +898,6 @@ public HttpResponse execute() throws IOException {
911
898
headers .setUserAgent (originalUserAgent + " " + USER_AGENT_SUFFIX );
912
899
}
913
900
}
914
- OpenCensusUtils .propagateTracingContext (headers );
915
-
916
901
// headers
917
902
HttpHeaders .serializeHeaders (headers , logbuf , curlbuf , logger , lowLevelHttpRequest );
918
903
if (!suppressUserAgentSuffix ) {
@@ -992,9 +977,6 @@ public HttpResponse execute() throws IOException {
992
977
993
978
// execute
994
979
lowLevelHttpRequest .setTimeout (connectTimeout , readTimeout );
995
- // switch tracing scope to current span
996
- @ SuppressWarnings ("MustBeClosedChecker" )
997
- Scope ws = tracer .withSpan (span );
998
980
try {
999
981
LowLevelHttpResponse lowLevelHttpResponse = lowLevelHttpRequest .execute ();
1000
982
// Flag used to indicate if an exception is thrown before the response is constructed.
@@ -1020,8 +1002,6 @@ public HttpResponse execute() throws IOException {
1020
1002
if (loggable ) {
1021
1003
logger .log (Level .WARNING , "exception thrown while executing request" , e );
1022
1004
}
1023
- } finally {
1024
- ws .close ();
1025
1005
}
1026
1006
1027
1007
// Flag used to indicate if an exception is thrown before the response has completed
@@ -1077,7 +1057,6 @@ public HttpResponse execute() throws IOException {
1077
1057
}
1078
1058
}
1079
1059
} while (retryRequest );
1080
- span .end (OpenCensusUtils .getEndSpanOptions (response == null ? null : response .getStatusCode ()));
1081
1060
1082
1061
if (response == null ) {
1083
1062
// Retries did not help resolve the execute exception, re-throw it.
0 commit comments