Source:
public BufferedReader getReader(MetricServiceAppConfiguration config, String id, String startTime, String endTime, ReturnSet returnset, Boolean series, String downsample, Map<String, List<String>> globalTags, List<MetricSpecification> queries) throws IOException { StringBuilder buf = new StringBuilder(config.getMetricServiceConfig() .getOpenTsdbUrl()); buf.append("/q?"); if (!Utils.NOW.equals(startTime)) { buf.append("start=").append(URLEncoder.encode(startTime, "UTF-8")); } if (!Utils.NOW.equals(endTime)) { buf.append("&end=").append(URLEncoder.encode(endTime, "UTF-8")); } for (MetricSpecification query : queries) { buf.append("&m=").append( URLEncoder.encode(query.toString(downsample, globalTags, this.config.getMetricServiceConfig() .getSendRateOptions()), "UTF-8")); } buf.append("&ascii"); if (log.isDebugEnabled()) { log.debug("OpenTSDB GET: {}", buf.toString()); } HttpURLConnection connection = (HttpURLConnection) new URL( buf.toString()).openConnection(); connection.setConnectTimeout(config.getMetricServiceConfig() .getConnectionTimeoutMs()); connection.setReadTimeout(config.getMetricServiceConfig() .getConnectionTimeoutMs()); if (Math.floor(connection.getResponseCode() / 100) != 2) { throw generateException(connection); } if (!"text/plain".equals(connection.getContentType())) { throw new WebApplicationException(Utils.getErrorResponse(id, 500, "Unknown severe request error", "unknown")); } return new BufferedReader(new InputStreamReader( connection.getInputStream())); }

Target:
public BufferedReader getReader(MetricServiceAppConfiguration config, String id, String startTime, String endTime, ReturnSet returnset, Boolean series, String downsample, Map<String, List<String>> globalTags, List<MetricSpecification> queries) throws IOException { StringBuilder buf = new StringBuilder(config.getMetricServiceConfig() .getOpenTsdbUrl()); buf.append("/q?"); if (!Utils.NOW.equals(startTime)) { buf.append("start=").append(URLEncoder.encode(startTime, "UTF-8")); } if (!Utils.NOW.equals(endTime)) { buf.append("&end=").append(URLEncoder.encode(endTime, "UTF-8")); } for (MetricSpecification query : queries) { buf.append("&m=").append( URLEncoder.encode(query.toString(downsample, globalTags, this.config.getMetricServiceConfig() .getSendRateOptions()), "UTF-8")); } buf.append("&ascii"); if (log.isDebugEnabled()) { log.debug("OpenTSDB GET: {}", buf.toString()); } HttpURLConnection connection = (HttpURLConnection) new URL( buf.toString()).openConnection(); connection.setConnectTimeout(config.getMetricServiceConfig() .getConnectionTimeoutMs()); connection.setReadTimeout(config.getMetricServiceConfig() .getConnectionTimeoutMs()); if (Math.floor(connection.getResponseCode() / 100) != 2) { throw generateException(connection); } if (!"text/plain".equals(connection.getContentType())) { if (log.isErrorEnabled()) { try (InputStream is = connection.getInputStream()) { byte[] content = ByteStreams.toByteArray(is); log.error( "Invalid response content type of: '{}', full returned content '{}'", connection.getContentType(), new String(content)); } catch (Exception e) { log.error( "Invalid response content type of: '{}', exception attempting to read content '{}:{}'", connection.getContentType(), e.getClass().getName(), e.getMessage()); } } throw new WebApplicationException(Utils.getErrorResponse(id, 500, "Unknown severe request error", "unknown")); } return new BufferedReader(new InputStreamReader( connection.getInputStream())); }