Source:
<code>private JsonParserIterator<SegmentWithOvershadowedStatus> getMetadataSegments( DruidLeaderClient coordinatorClient, ObjectMapper jsonMapper, Set<String> watchedDataSources ) { String query = "/druid/coordinator/v1/metadata/segments?includeOvershadowedStatus"; if (watchedDataSources != null && !watchedDataSources.isEmpty()) { log.debug( "filtering datasources in published segments based on broker's watchedDataSources[%s]", watchedDataSources); final StringBuilder sb = new StringBuilder(); for (String ds : watchedDataSources) { sb.append("datasources=").append(ds).append("&"); } sb.setLength(sb.length() - 1); query = "/druid/coordinator/v1/metadata/segments?includeOvershadowedStatus&" + sb; } Request request; InputStreamFullResponseHolder responseHolder; try { request = coordinatorClient.makeRequest( HttpMethod.GET, StringUtils.format(query) ); responseHolder = coordinatorClient.go( request, new InputStreamFullResponseHandler() ); if (responseHolder.getStatus().getCode() != HttpServletResponse.SC_OK) { throw new RE( "Failed to talk to coordinator leader at [%s]. Error code[%d], description[%s].", <START> query, <END> responseHolder.getStatus().getCode(), responseHolder.getStatus().getReasonPhrase() ); } } catch (IOException | InterruptedException e) { throw new RuntimeException(e); } final JavaType typeRef = jsonMapper.getTypeFactory().constructType(new TypeReference<SegmentWithOvershadowedStatus>() { }); return new JsonParserIterator<>( typeRef, Futures.immediateFuture(responseHolder.getContent()), request.getUrl().toString(), null, request.getUrl().getHost(), jsonMapper, null ); }</code><technical_language>instead of query, request.getUrl().toString() info leader location</technical_language>

Target:
private JsonParserIterator<SegmentWithOvershadowedStatus> getMetadataSegments( DruidLeaderClient coordinatorClient, ObjectMapper jsonMapper, Set<String> watchedDataSources ) { String query = "/druid/coordinator/v1/metadata/segments?includeOvershadowedStatus"; if (watchedDataSources != null && !watchedDataSources.isEmpty()) { log.debug( "filtering datasources in published segments based on broker's watchedDataSources[%s]", watchedDataSources); final StringBuilder sb = new StringBuilder(); for (String ds : watchedDataSources) { sb.append("datasources=").append(ds).append("&"); } sb.setLength(sb.length() - 1); query = "/druid/coordinator/v1/metadata/segments?includeOvershadowedStatus&" + sb; } Request request; InputStreamFullResponseHolder responseHolder; try { request = coordinatorClient.makeRequest( HttpMethod.GET, StringUtils.format(query) ); responseHolder = coordinatorClient.go( request, new InputStreamFullResponseHandler() ); if (responseHolder.getStatus().getCode() != HttpServletResponse.SC_OK) { throw new RE( "Failed to talk to coordinator leader at [%s]. Error code[%d], description[%s].", query, responseHolder.getStatus().getCode(), responseHolder.getStatus().getReasonPhrase() ); } } catch (IOException | InterruptedException e) { throw new RuntimeException(e); } final JavaType typeRef = jsonMapper.getTypeFactory().constructType(new TypeReference<SegmentWithOvershadowedStatus>() { }); return new JsonParserIterator<>( typeRef, Futures.immediateFuture(responseHolder.getContent()), request.getUrl().toString(), null, request.getUrl().getHost(), jsonMapper ); }