You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/12/11 10:23:56 UTC

[GitHub] [skywalking] jsankalp commented on issue #5653: http async client does not create span

jsankalp commented on issue #5653:
URL: https://github.com/apache/skywalking/issues/5653#issuecomment-743110368


   I would like to try fixing this issue.
   
   This is what I have tried till now and have failed to replicate this issue. Can someone point out anything wrong that I am doing.
   I guess through the bug description the issue happens when we try to use a pooled HTTP connection and the request spans do not get created for subsequent requests.
   
   Here is the code that I wrote to replicate the issue and got the following spans, which in my humble opinion seem fine.
   
   ```
   @GetMapping("/hellopoogle3")
   public String hello(@RequestParam(value = "name", defaultValue = "World") String name) throws Exception {
   	ConnectingIOReactor ioReactor = new DefaultConnectingIOReactor();
   	PoolingNHttpClientConnectionManager cm = new PoolingNHttpClientConnectionManager(ioReactor);
   	cm.setMaxTotal(100);
   	try (CloseableHttpAsyncClient httpclient = HttpAsyncClients.custom()
   			.setConnectionManager(cm)
   			.build()) {
   		httpclient.start();
   
   		String[] urisToGet = {
   				"http://hc.apache.org/test",
   				"http://hc.apache.org/httpcomponents-core-ga/",
   				"http://www.google.com/blah"
   		};
   
   		final CountDownLatch latch = new CountDownLatch(urisToGet.length);
   		for (final String uri : urisToGet) {
   			final HttpGet httpget = new HttpGet(uri);
   			httpclient.execute(httpget, new FutureCallback<HttpResponse>() {
   
   				@Override
   				public void completed(final HttpResponse response) {
   					latch.countDown();
   					System.out.println(httpget.getRequestLine() + "->" + response.getStatusLine());
   				}
   
   				@Override
   				public void failed(final Exception ex) {
   					latch.countDown();
   					System.out.println(httpget.getRequestLine() + "->" + ex);
   				}
   
   				@Override
   				public void cancelled() {
   					latch.countDown();
   					System.out.println(httpget.getRequestLine() + " cancelled");
   				}
   
   			});
   		}
   		latch.await();
   		return "Walking";
   
   	}
   }
   ```
   
   
   ![trace-list](https://user-images.githubusercontent.com/988674/101891266-d13e8c00-3bc7-11eb-9913-11e0a0e72441.png)
   
   Any help/pointers is appreciated. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org