Replace some of the log/printStackTraces with ignores
Fixes gh-153
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.cloud.netflix.feign;
|
||||
|
||||
import static org.springframework.cloud.netflix.feign.FeignUtils.getHttpHeaders;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
@@ -23,7 +25,6 @@ import java.lang.reflect.Type;
|
||||
|
||||
import javax.inject.Provider;
|
||||
|
||||
import lombok.extern.apachecommons.CommonsLog;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@@ -36,12 +37,9 @@ import feign.Response;
|
||||
import feign.codec.DecodeException;
|
||||
import feign.codec.Decoder;
|
||||
|
||||
import static org.springframework.cloud.netflix.feign.FeignUtils.getHttpHeaders;
|
||||
|
||||
/**
|
||||
* @author Spencer Gibb
|
||||
*/
|
||||
@CommonsLog
|
||||
public class SpringDecoder implements Decoder {
|
||||
|
||||
@Autowired
|
||||
@@ -93,7 +91,7 @@ public class SpringDecoder implements Decoder {
|
||||
this.response.body().close();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
log.error("Error closing response body", ex);
|
||||
// Ignore exception on close...
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,12 +34,10 @@ import com.netflix.zuul.ZuulFilter;
|
||||
import com.netflix.zuul.constants.ZuulConstants;
|
||||
import com.netflix.zuul.constants.ZuulHeaders;
|
||||
import com.netflix.zuul.context.RequestContext;
|
||||
import lombok.extern.apachecommons.CommonsLog;
|
||||
|
||||
/**
|
||||
* @author Spencer Gibb
|
||||
*/
|
||||
@CommonsLog
|
||||
public class SendResponseFilter extends ZuulFilter {
|
||||
|
||||
private static DynamicBooleanProperty INCLUDE_DEBUG_HEADER = DynamicPropertyFactory
|
||||
@@ -149,17 +147,12 @@ public class SendResponseFilter extends ZuulFilter {
|
||||
byte[] bytes = new byte[INITIAL_STREAM_BUFFER_SIZE.get()];
|
||||
int bytesRead = -1;
|
||||
while ((bytesRead = zin.read(bytes)) != -1) {
|
||||
// TODO
|
||||
// if (Debug.debugRequest() && !Debug.debugRequestHeadersOnly()) {
|
||||
// Debug.addRequestDebug("OUTBOUND: < " + new String(bytes, 0, bytesRead));
|
||||
// }
|
||||
try {
|
||||
out.write(bytes, 0, bytesRead);
|
||||
out.flush();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
// ignore
|
||||
log.debug("Error writing response", ex);
|
||||
}
|
||||
// doubles buffer size if previous read filled it
|
||||
if (bytesRead == bytes.length) {
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.Collection;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
import lombok.extern.apachecommons.CommonsLog;
|
||||
|
||||
import org.codehaus.jackson.JsonFactory;
|
||||
import org.codehaus.jackson.JsonGenerator;
|
||||
import org.springframework.beans.BeansException;
|
||||
@@ -77,21 +78,23 @@ public class HystrixStreamTask implements ApplicationContextAware {
|
||||
this.jsonMetrics.drainTo(metrics);
|
||||
|
||||
if (!metrics.isEmpty()) {
|
||||
log.trace("sending amqp metrics size: " + metrics.size());
|
||||
if (log.isTraceEnabled()) {
|
||||
log.trace("sending amqp metrics size: " + metrics.size());
|
||||
}
|
||||
for (String json : metrics) {
|
||||
// TODO: batch all metrics to one message
|
||||
try {
|
||||
this.channel.send(json);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
log.error("Error sending json to channel", ex);
|
||||
if (log.isTraceEnabled()) {
|
||||
log.trace("failed sending amqp metrics: " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @InboundChannelAdapter()
|
||||
// TODO: move fixedRate to configuration
|
||||
@Scheduled(fixedRateString = "${hystrix.stream.amqp.gatherRate:500}")
|
||||
public void gatherMetrics() {
|
||||
try {
|
||||
|
||||
@@ -27,6 +27,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import lombok.extern.apachecommons.CommonsLog;
|
||||
|
||||
import org.apache.http.Header;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.HttpStatus;
|
||||
@@ -49,7 +50,6 @@ import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Configuration
|
||||
@CommonsLog
|
||||
public class HystrixDashboardConfiguration {
|
||||
|
||||
private static final String DEFAULT_TEMPLATE_LOADER_PATH = "classpath:/templates/";
|
||||
@@ -209,7 +209,7 @@ public class HystrixDashboardConfiguration {
|
||||
is.close();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
log.debug("Error closing input stream", ex);
|
||||
// ignore errors on close
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user