@Test public void wingtipsRequestTracingFilter_returns_DoNothingServletFilter_if_WingtipsSpringBootProperties_indicates_disabled() { WingtipsSpringBootProperties props = generateProps(true, null, null, null, null); WingtipsSpringBootConfiguration conf = new WingtipsSpringBootConfiguration(props); FilterRegistrationBean filterRegistrationBean = conf.wingtipsRequestTracingFilter(); assertThat(filterRegistrationBean.getFilter()) .isNotNull() .isInstanceOf(DoNothingServletFilter.class); }
@Bean @ConditionalOnWebApplication public FilterRegistrationBean wingtipsRequestTracingFilter() { if (wingtipsProperties.isWingtipsDisabled()) { return new FilterRegistrationBean(new DoNothingServletFilter()); } if (requestTracingFilter == null) { requestTracingFilter = new RequestTracingFilter(); } FilterRegistrationBean frb = new FilterRegistrationBean(requestTracingFilter); if (wingtipsProperties.getUserIdHeaderKeys() != null) { frb.addInitParameter( RequestTracingFilter.USER_ID_HEADER_KEYS_LIST_INIT_PARAM_NAME, wingtipsProperties.getUserIdHeaderKeys() ); } if (wingtipsProperties.getServerSideSpanTaggingStrategy() != null) { frb.addInitParameter( RequestTracingFilter.TAG_AND_SPAN_NAMING_STRATEGY_INIT_PARAM_NAME, wingtipsProperties.getServerSideSpanTaggingStrategy() ); } if (wingtipsProperties.getServerSideSpanTaggingAdapter() != null) { frb.addInitParameter( RequestTracingFilter.TAG_AND_SPAN_NAMING_ADAPTER_INIT_PARAM_NAME, wingtipsProperties.getServerSideSpanTaggingAdapter() ); } frb.setOrder(Ordered.HIGHEST_PRECEDENCE); return frb; }
WingtipsSpringBootConfiguration { @Bean @ConditionalOnWebApplication public FilterRegistrationBean wingtipsRequestTracingFilter() { if (wingtipsProperties.isWingtipsDisabled()) { return new FilterRegistrationBean(new DoNothingServletFilter()); } if (requestTracingFilter == null) { requestTracingFilter = new RequestTracingFilter(); } FilterRegistrationBean frb = new FilterRegistrationBean(requestTracingFilter); if (wingtipsProperties.getUserIdHeaderKeys() != null) { frb.addInitParameter( RequestTracingFilter.USER_ID_HEADER_KEYS_LIST_INIT_PARAM_NAME, wingtipsProperties.getUserIdHeaderKeys() ); } if (wingtipsProperties.getServerSideSpanTaggingStrategy() != null) { frb.addInitParameter( RequestTracingFilter.TAG_AND_SPAN_NAMING_STRATEGY_INIT_PARAM_NAME, wingtipsProperties.getServerSideSpanTaggingStrategy() ); } if (wingtipsProperties.getServerSideSpanTaggingAdapter() != null) { frb.addInitParameter( RequestTracingFilter.TAG_AND_SPAN_NAMING_ADAPTER_INIT_PARAM_NAME, wingtipsProperties.getServerSideSpanTaggingAdapter() ); } frb.setOrder(Ordered.HIGHEST_PRECEDENCE); return frb; } }
WingtipsSpringBootConfiguration { @Bean @ConditionalOnWebApplication public FilterRegistrationBean wingtipsRequestTracingFilter() { if (wingtipsProperties.isWingtipsDisabled()) { return new FilterRegistrationBean(new DoNothingServletFilter()); } if (requestTracingFilter == null) { requestTracingFilter = new RequestTracingFilter(); } FilterRegistrationBean frb = new FilterRegistrationBean(requestTracingFilter); if (wingtipsProperties.getUserIdHeaderKeys() != null) { frb.addInitParameter( RequestTracingFilter.USER_ID_HEADER_KEYS_LIST_INIT_PARAM_NAME, wingtipsProperties.getUserIdHeaderKeys() ); } if (wingtipsProperties.getServerSideSpanTaggingStrategy() != null) { frb.addInitParameter( RequestTracingFilter.TAG_AND_SPAN_NAMING_STRATEGY_INIT_PARAM_NAME, wingtipsProperties.getServerSideSpanTaggingStrategy() ); } if (wingtipsProperties.getServerSideSpanTaggingAdapter() != null) { frb.addInitParameter( RequestTracingFilter.TAG_AND_SPAN_NAMING_ADAPTER_INIT_PARAM_NAME, wingtipsProperties.getServerSideSpanTaggingAdapter() ); } frb.setOrder(Ordered.HIGHEST_PRECEDENCE); return frb; } @Autowired  WingtipsSpringBootConfiguration(WingtipsSpringBootProperties wingtipsProperties); }
WingtipsSpringBootConfiguration { @Bean @ConditionalOnWebApplication public FilterRegistrationBean wingtipsRequestTracingFilter() { if (wingtipsProperties.isWingtipsDisabled()) { return new FilterRegistrationBean(new DoNothingServletFilter()); } if (requestTracingFilter == null) { requestTracingFilter = new RequestTracingFilter(); } FilterRegistrationBean frb = new FilterRegistrationBean(requestTracingFilter); if (wingtipsProperties.getUserIdHeaderKeys() != null) { frb.addInitParameter( RequestTracingFilter.USER_ID_HEADER_KEYS_LIST_INIT_PARAM_NAME, wingtipsProperties.getUserIdHeaderKeys() ); } if (wingtipsProperties.getServerSideSpanTaggingStrategy() != null) { frb.addInitParameter( RequestTracingFilter.TAG_AND_SPAN_NAMING_STRATEGY_INIT_PARAM_NAME, wingtipsProperties.getServerSideSpanTaggingStrategy() ); } if (wingtipsProperties.getServerSideSpanTaggingAdapter() != null) { frb.addInitParameter( RequestTracingFilter.TAG_AND_SPAN_NAMING_ADAPTER_INIT_PARAM_NAME, wingtipsProperties.getServerSideSpanTaggingAdapter() ); } frb.setOrder(Ordered.HIGHEST_PRECEDENCE); return frb; } @Autowired  WingtipsSpringBootConfiguration(WingtipsSpringBootProperties wingtipsProperties); @Bean @ConditionalOnWebApplication FilterRegistrationBean wingtipsRequestTracingFilter(); }
WingtipsSpringBootConfiguration { @Bean @ConditionalOnWebApplication public FilterRegistrationBean wingtipsRequestTracingFilter() { if (wingtipsProperties.isWingtipsDisabled()) { return new FilterRegistrationBean(new DoNothingServletFilter()); } if (requestTracingFilter == null) { requestTracingFilter = new RequestTracingFilter(); } FilterRegistrationBean frb = new FilterRegistrationBean(requestTracingFilter); if (wingtipsProperties.getUserIdHeaderKeys() != null) { frb.addInitParameter( RequestTracingFilter.USER_ID_HEADER_KEYS_LIST_INIT_PARAM_NAME, wingtipsProperties.getUserIdHeaderKeys() ); } if (wingtipsProperties.getServerSideSpanTaggingStrategy() != null) { frb.addInitParameter( RequestTracingFilter.TAG_AND_SPAN_NAMING_STRATEGY_INIT_PARAM_NAME, wingtipsProperties.getServerSideSpanTaggingStrategy() ); } if (wingtipsProperties.getServerSideSpanTaggingAdapter() != null) { frb.addInitParameter( RequestTracingFilter.TAG_AND_SPAN_NAMING_ADAPTER_INIT_PARAM_NAME, wingtipsProperties.getServerSideSpanTaggingAdapter() ); } frb.setOrder(Ordered.HIGHEST_PRECEDENCE); return frb; } @Autowired  WingtipsSpringBootConfiguration(WingtipsSpringBootProperties wingtipsProperties); @Bean @ConditionalOnWebApplication FilterRegistrationBean wingtipsRequestTracingFilter();  }