/** * builds the unique filter_id key * @param application_name * @param filter_type * @param filter_name * @return key is application_name:filter_name:filter_type */ public static String buildFilterID(String application_name, FilterType filter_type, String filter_name) { return application_name + ":" + filter_name + ":" + filter_type.toString(); }
public ZuulFilter getFilterByNameAndType(String name, FilterType type) { if (name == null || type == null) return null; String nameAndType = type.toString() + ":" + name; return filtersByNameAndType.get(nameAndType); }
/** * builds the unique filter_id key * @param application_name * @param filter_type * @param filter_name * @return key is application_name:filter_name:filter_type */ public static String buildFilterID(String application_name, FilterType filter_type, String filter_name) { return application_name + ":" + filter_name + ":" + filter_type.toString(); }
public ZuulFilter getFilterByNameAndType(String name, FilterType type) { if (name == null || type == null) return null; String nameAndType = type.toString() + ":" + name; return filtersByNameAndType.get(nameAndType); }
protected BaseFilter() { baseName = this.getClass().getSimpleName() + "." + filterType().toString(); concurrentCount = SpectatorUtils.newGauge("zuul.filter.concurrency.current", baseName, new AtomicInteger(0)); concurrencyRejections = SpectatorUtils.newCounter("zuul.filter.concurrency.rejected", baseName); filterDisabled = new CachedDynamicBooleanProperty(disablePropertyName(), false); filterConcurrencyLimit = new CachedDynamicIntProperty(maxConcurrencyPropertyName(), 4000); }
protected void recordFilterError(final I inMesg, final ZuulFilter<I, O> filter, final Throwable t) { // Add a log statement for this exception. final String errorMsg = "Filter Exception: filter=" + filter.filterName() + ", request-info=" + inMesg.getInfoForLogging() + ", msg=" + String.valueOf(t.getMessage()); if (t instanceof ZuulException && !((ZuulException) t).shouldLogAsError()) { LOG.warn(errorMsg); } else { LOG.error(errorMsg, t); } // Store this filter error for possible future use. But we still continue with next filter in the chain. final SessionContext zuulCtx = inMesg.getContext(); zuulCtx.getFilterErrors().add(new FilterError(filter.filterName(), filter.filterType().toString(), t)); if (zuulCtx.debugRouting()) { Debug.addRoutingDebug(zuulCtx, "Running Filter failed " + filter.filterName() + " type:" + filter.filterType() + " order:" + filter.filterOrder() + " " + t.getMessage()); } }
protected BaseFilter() { baseName = this.getClass().getSimpleName() + "." + filterType().toString(); concurrentCount = SpectatorUtils.newGauge("zuul.filter.concurrency.current", baseName, new AtomicInteger(0)); concurrencyRejections = SpectatorUtils.newCounter("zuul.filter.concurrency.rejected", baseName); filterDisabled = new CachedDynamicBooleanProperty(disablePropertyName(), false); filterConcurrencyLimit = new CachedDynamicIntProperty(maxConcurrencyPropertyName(), 4000); }
protected void recordFilterError(final I inMesg, final ZuulFilter<I, O> filter, final Throwable t) { // Add a log statement for this exception. final String errorMsg = "Filter Exception: filter=" + filter.filterName() + ", request-info=" + inMesg.getInfoForLogging() + ", msg=" + String.valueOf(t.getMessage()); if (t instanceof ZuulException && !((ZuulException) t).shouldLogAsError()) { LOG.warn(errorMsg); } else { LOG.error(errorMsg, t); } // Store this filter error for possible future use. But we still continue with next filter in the chain. final SessionContext zuulCtx = inMesg.getContext(); zuulCtx.getFilterErrors().add(new FilterError(filter.filterName(), filter.filterType().toString(), t)); if (zuulCtx.debugRouting()) { Debug.addRoutingDebug(zuulCtx, "Running Filter failed " + filter.filterName() + " type:" + filter.filterType() + " order:" + filter.filterOrder() + " " + t.getMessage()); } }
protected void recordFilterCompletion(final ExecutionStatus status, final ZuulFilter<I, O> filter, long startTime, final ZuulMessage zuulMesg, final ZuulMessage startSnapshot) { final SessionContext zuulCtx = zuulMesg.getContext(); final long execTime = System.currentTimeMillis() - startTime; if (execTime >= FILTER_EXCESSIVE_EXEC_TIME.get()) { LOG.warn("Filter {} took {} ms to complete! status = {}", filter.filterName(), execTime, status.name()); } // Record the execution summary in context. switch (status) { case FAILED: zuulCtx.addFilterExecutionSummary(filter.filterName(), FAILED.name(), execTime); break; case SUCCESS: zuulCtx.addFilterExecutionSummary(filter.filterName(), SUCCESS.name(), execTime); if (startSnapshot != null) { //debugRouting == true Debug.addRoutingDebug(zuulCtx, "Filter {" + filter.filterName() + " TYPE:" + filter.filterType().toString() + " ORDER:" + filter.filterOrder() + "} Execution time = " + execTime + "ms"); Debug.compareContextState(filter.filterName(), zuulCtx, startSnapshot.getContext()); } break; default: break; } LOG.debug("Filter {} completed with status {}, UUID {}", filter.filterName(), status.name(), zuulMesg.getContext().getUUID()); // Notify configured listener. usageNotifier.notify(filter, status); }
Debug.addRoutingDebug(inMesg.getContext(), "Filter " + filter.filterType().toString() + " " + filter.filterOrder() + " " + filter.filterName());
protected void recordFilterCompletion(final ExecutionStatus status, final ZuulFilter<I, O> filter, long startTime, final ZuulMessage zuulMesg, final ZuulMessage startSnapshot) { final SessionContext zuulCtx = zuulMesg.getContext(); final long execTime = System.currentTimeMillis() - startTime; if (execTime >= FILTER_EXCESSIVE_EXEC_TIME.get()) { LOG.warn("Filter {} took {} ms to complete! status = {}", filter.filterName(), execTime, status.name()); } // Record the execution summary in context. switch (status) { case FAILED: zuulCtx.addFilterExecutionSummary(filter.filterName(), FAILED.name(), execTime); break; case SUCCESS: zuulCtx.addFilterExecutionSummary(filter.filterName(), SUCCESS.name(), execTime); if (startSnapshot != null) { //debugRouting == true Debug.addRoutingDebug(zuulCtx, "Filter {" + filter.filterName() + " TYPE:" + filter.filterType().toString() + " ORDER:" + filter.filterOrder() + "} Execution time = " + execTime + "ms"); Debug.compareContextState(filter.filterName(), zuulCtx, startSnapshot.getContext()); } break; default: break; } LOG.debug("Filter {} completed with status {}, UUID {}", filter.filterName(), status.name(), zuulMesg.getContext().getUUID()); // Notify configured listener. usageNotifier.notify(filter, status); }
Debug.addRoutingDebug(inMesg.getContext(), "Filter " + filter.filterType().toString() + " " + filter.filterOrder() + " " + filter.filterName());
/** * builds the unique filter_id key * @param application_name * @param filter_type * @param filter_name * @return key is application_name:filter_name:filter_type */ public static String buildFilterID(String application_name, FilterType filter_type, String filter_name) { return application_name + ":" + filter_name + ":" + filter_type.toString(); }
public ZuulFilter getFilterByNameAndType(String name, FilterType type) { if (name == null || type == null) return null; String nameAndType = type.toString() + ":" + name; return filtersByNameAndType.get(nameAndType); }
protected BaseFilter() { baseName = this.getClass().getSimpleName() + "." + filterType().toString(); concurrentCount = SpectatorUtils.newGauge("zuul.filter.concurrency.current", baseName, new AtomicInteger(0)); concurrencyRejections = SpectatorUtils.newCounter("zuul.filter.concurrency.rejected", baseName); filterDisabled = new CachedDynamicBooleanProperty(disablePropertyName(), false); filterConcurrencyLimit = new CachedDynamicIntProperty(maxConcurrencyPropertyName(), 4000); }
protected void recordFilterError(final I inMesg, final ZuulFilter<I, O> filter, final Throwable t) { // Add a log statement for this exception. final String errorMsg = "Filter Exception: filter=" + filter.filterName() + ", request-info=" + inMesg.getInfoForLogging() + ", msg=" + String.valueOf(t.getMessage()); if (t instanceof ZuulException && !((ZuulException) t).shouldLogAsError()) { LOG.warn(errorMsg); } else { LOG.error(errorMsg, t); } // Store this filter error for possible future use. But we still continue with next filter in the chain. final SessionContext zuulCtx = inMesg.getContext(); zuulCtx.getFilterErrors().add(new FilterError(filter.filterName(), filter.filterType().toString(), t)); if (zuulCtx.debugRouting()) { Debug.addRoutingDebug(zuulCtx, "Running Filter failed " + filter.filterName() + " type:" + filter.filterType() + " order:" + filter.filterOrder() + " " + t.getMessage()); } }
protected void recordFilterCompletion(final ExecutionStatus status, final ZuulFilter<I, O> filter, long startTime, final ZuulMessage zuulMesg, final ZuulMessage startSnapshot) { final SessionContext zuulCtx = zuulMesg.getContext(); final long execTime = System.currentTimeMillis() - startTime; // Record the execution summary in context. switch (status) { case FAILED: zuulCtx.addFilterExecutionSummary(filter.filterName(), FAILED.name(), execTime); break; case SUCCESS: zuulCtx.addFilterExecutionSummary(filter.filterName(), SUCCESS.name(), execTime); if (startSnapshot != null) { //debugRouting == true Debug.addRoutingDebug(zuulCtx, "Filter {" + filter.filterName() + " TYPE:" + filter.filterType().toString() + " ORDER:" + filter.filterOrder() + "} Execution time = " + execTime + "ms"); Debug.compareContextState(filter.filterName(), zuulCtx, startSnapshot.getContext()); } break; default: break; } LOG.debug("Filter {} completed with status {}, UUID {}", filter.filterName(), status.name(), zuulMesg.getContext().getUUID()); // Notify configured listener. usageNotifier.notify(filter, status); }
Debug.addRoutingDebug(inMesg.getContext(), "Filter " + filter.filterType().toString() + " " + filter.filterOrder() + " " + filter.filterName());