Skip to content

Commit eaf3d86

Browse files
Fix line wrapping and formatting in OkHttp test
Source: PR Agent Co-authored-by: dougqh <dougqh@gmail.com>
1 parent 8f5eb8a commit eaf3d86

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

dd-java-agent/instrumentation/okhttp/okhttp-3.0/src/vthread21Test/java/OkHttpVirtualThreadDispatcherTest.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
* activated "parent" span it does {@code client.newCall(request).enqueue(callback)} and waits on a
3939
* latch for the callback. The agent's OkHttp instrumentation injects {@code TracingInterceptor},
4040
* which creates the {@code okhttp.request} client span using whatever scope is active on the
41-
* dispatcher worker. The assertions verify the client span lands under the parent &mdash; i.e.,
42-
* the dispatcher's worker thread saw the propagated scope.
41+
* dispatcher worker. The assertions verify the client span lands under the parent &mdash; i.e., the
42+
* dispatcher's worker thread saw the propagated scope.
4343
*
4444
* <p>If propagation fails for the virtual-thread shape (the failure profiling-backend is reporting)
4545
* the {@code okhttp.request} span will either become a root span in its own trace or be parented
@@ -131,8 +131,7 @@ void cachedThreadPoolDispatcher_parentsOkHttpSpanUnderParent() throws Exception
131131
void virtualThreadPerTaskDispatcher_parentsOkHttpSpanUnderParent() throws Exception {
132132
// Exact shape from profiling-backend PR#8520.
133133
ExecutorService dispatcherExecutor =
134-
Executors.newThreadPerTaskExecutor(
135-
Thread.ofVirtual().name("okhttp-test-", 0).factory());
134+
Executors.newThreadPerTaskExecutor(Thread.ofVirtual().name("okhttp-test-", 0).factory());
136135
OkHttpClient client = buildClient(dispatcherExecutor);
137136
try {
138137
runUnderParent(client, new CountDownLatch(1));
@@ -161,8 +160,7 @@ void concurrentVirtualThreadPerTaskDispatcher_keepsEachTraceSeparate() throws Ex
161160
int totalRequests = parentCount * requestsPerParent;
162161

163162
ExecutorService dispatcherExecutor =
164-
Executors.newThreadPerTaskExecutor(
165-
Thread.ofVirtual().name("okhttp-burst-", 0).factory());
163+
Executors.newThreadPerTaskExecutor(Thread.ofVirtual().name("okhttp-burst-", 0).factory());
166164
OkHttpClient client = buildClient(dispatcherExecutor);
167165
// Force queue contention: capacity is much smaller than the total in-flight requests, so
168166
// many calls will be promoted from finished() rather than direct from enqueue().
@@ -187,8 +185,7 @@ void concurrentVirtualThreadPerTaskDispatcher_keepsEachTraceSeparate() throws Ex
187185
}
188186
});
189187
}
190-
assertTrue(
191-
allParentsDone.await(60, TimeUnit.SECONDS), "parent threads timed out");
188+
assertTrue(allParentsDone.await(60, TimeUnit.SECONDS), "parent threads timed out");
192189
} finally {
193190
parentRunner.shutdown();
194191
dispatcherExecutor.shutdown();
@@ -240,8 +237,7 @@ void concurrentVirtualThreadPerTaskDispatcher_keepsEachTraceSeparate() throws Ex
240237
"trace rooted at parent " + parentSpanId + " has wrong child count");
241238
}
242239

243-
assertEquals(
244-
totalRequests, totalOkhttpSpans, "total okhttp.request spans across all traces");
240+
assertEquals(totalRequests, totalOkhttpSpans, "total okhttp.request spans across all traces");
245241
assertTrue(
246242
contamination.isEmpty(),
247243
"found cross-parented okhttp.request spans:\n - " + String.join("\n - ", contamination));

0 commit comments

Comments
 (0)