mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-11 22:06:53 +10:00
Merge pull request #1798 from Xylus/feature/remove-urlfilter
Remove ExcludeUrlFilter and simply use ExcludePathFilter
This commit is contained in:
+1
-1
@@ -606,7 +606,7 @@ public class DefaultProfilerConfig implements ProfilerConfig {
|
||||
this.tomcatTraceRequestParam = readBoolean("profiler.tomcat.tracerequestparam", true);
|
||||
final String tomcatExcludeURL = readString("profiler.tomcat.excludeurl", "");
|
||||
if (!tomcatExcludeURL.isEmpty()) {
|
||||
this.tomcatExcludeUrlFilter = new ExcludeUrlFilter(tomcatExcludeURL);
|
||||
this.tomcatExcludeUrlFilter = new ExcludePathFilter(tomcatExcludeURL);
|
||||
}
|
||||
this.tomcatRealIpHeader = readString("profiler.tomcat.realipheader", null);
|
||||
this.tomcatRealIpEmptyValue = readString("profiler.tomcat.realipemptyvalue", null);
|
||||
|
||||
+1
@@ -26,6 +26,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author emeroad
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public class ExcludePathFilter implements Filter<String> {
|
||||
|
||||
-38
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 NAVER Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.bootstrap.config;
|
||||
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
public class ExcludeUrlFilter extends ExcludePathFilter {
|
||||
|
||||
|
||||
|
||||
public ExcludeUrlFilter(String excludePathFormatString) {
|
||||
super(excludePathFormatString);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("ExcludeUrlFilter{");
|
||||
sb.append("excludeUrlMatchers=").append(excludePathMatchers);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
+63
@@ -97,4 +97,67 @@ public class ExcludePathFilterTest {
|
||||
private void assertNotFiltered(Filter<String> filter, String testValue) {
|
||||
Assert.assertThat(filter.filter(testValue), is(NOT_FILTERED));
|
||||
}
|
||||
|
||||
// Tests for urls
|
||||
@Test
|
||||
public void testFilter() throws Exception {
|
||||
Filter<String> filter = new ExcludePathFilter("/monitor/l7check.html, test/l4check.html");
|
||||
|
||||
assertFilter(filter);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFilter_InvalidExcludeURL() throws Exception {
|
||||
Filter<String> filter = new ExcludePathFilter("/monitor/l7check.html, test/l4check.html, ,,");
|
||||
|
||||
assertFilter(filter);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFilter_emptyExcludeURL() throws Exception {
|
||||
Filter<String> filter = new ExcludePathFilter("");
|
||||
|
||||
Assert.assertFalse(filter.filter("/monitor/l7check.html"));
|
||||
Assert.assertFalse(filter.filter("test/l4check.html"));
|
||||
|
||||
Assert.assertFalse(filter.filter("test/"));
|
||||
Assert.assertFalse(filter.filter("test/l4check.htm"));
|
||||
}
|
||||
|
||||
private void assertFilter(Filter<String> filter) {
|
||||
Assert.assertTrue(filter.filter("/monitor/l7check.html"));
|
||||
Assert.assertTrue(filter.filter("test/l4check.html"));
|
||||
|
||||
Assert.assertFalse(filter.filter("test/"));
|
||||
Assert.assertFalse(filter.filter("test/l4check.htm"));
|
||||
|
||||
Assert.assertFalse(filter.filter(null));
|
||||
Assert.assertFalse(filter.filter(""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void antStylePath() throws Exception {
|
||||
Filter<String> filter = new ExcludePathFilter("/monitor/l7check.*,/*/l7check.*");
|
||||
|
||||
Assert.assertTrue(filter.filter("/monitor/l7check.jsp"));
|
||||
Assert.assertTrue(filter.filter("/monitor/l7check.html"));
|
||||
|
||||
Assert.assertFalse(filter.filter("/monitor/test.jsp"));
|
||||
|
||||
Assert.assertTrue(filter.filter("/*/l7check.html"));
|
||||
|
||||
Assert.assertFalse(filter.filter(null));
|
||||
Assert.assertFalse(filter.filter(""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void antstyle_equals_match() throws Exception {
|
||||
Filter<String> filter = new ExcludePathFilter("/monitor/stringEquals,/monitor/antstyle.*");
|
||||
|
||||
Assert.assertTrue(filter.filter("/monitor/stringEquals"));
|
||||
Assert.assertTrue(filter.filter("/monitor/antstyle.html"));
|
||||
|
||||
Assert.assertFalse(filter.filter("/monitor/stringEquals.test"));
|
||||
Assert.assertFalse(filter.filter("/monitor/antstyleXXX.html"));
|
||||
}
|
||||
}
|
||||
|
||||
-93
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 NAVER Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.bootstrap.config;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.navercorp.pinpoint.bootstrap.config.ExcludeUrlFilter;
|
||||
import com.navercorp.pinpoint.bootstrap.config.Filter;
|
||||
|
||||
public class ExcludeUrlFilterTest {
|
||||
|
||||
@Test
|
||||
public void testFilter() throws Exception {
|
||||
Filter<String> filter = new ExcludeUrlFilter("/monitor/l7check.html, test/l4check.html");
|
||||
|
||||
assertFilter(filter);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testFilter_InvalidExcludeURL() throws Exception {
|
||||
Filter<String> filter = new ExcludeUrlFilter("/monitor/l7check.html, test/l4check.html, ,,");
|
||||
|
||||
assertFilter(filter);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFilter_emptyExcludeURL() throws Exception {
|
||||
Filter<String> filter = new ExcludeUrlFilter("");
|
||||
|
||||
Assert.assertFalse(filter.filter("/monitor/l7check.html"));
|
||||
Assert.assertFalse(filter.filter("test/l4check.html"));
|
||||
|
||||
Assert.assertFalse(filter.filter("test/"));
|
||||
Assert.assertFalse(filter.filter("test/l4check.htm"));
|
||||
}
|
||||
|
||||
|
||||
private void assertFilter(Filter<String> filter) {
|
||||
Assert.assertTrue(filter.filter("/monitor/l7check.html"));
|
||||
Assert.assertTrue(filter.filter("test/l4check.html"));
|
||||
|
||||
Assert.assertFalse(filter.filter("test/"));
|
||||
Assert.assertFalse(filter.filter("test/l4check.htm"));
|
||||
|
||||
Assert.assertFalse(filter.filter(null));
|
||||
Assert.assertFalse(filter.filter(""));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void antStylePath() throws Exception {
|
||||
Filter<String> filter = new ExcludeUrlFilter("/monitor/l7check.*,/*/l7check.*");
|
||||
|
||||
Assert.assertTrue(filter.filter("/monitor/l7check.jsp"));
|
||||
Assert.assertTrue(filter.filter("/monitor/l7check.html"));
|
||||
|
||||
Assert.assertFalse(filter.filter("/monitor/test.jsp"));
|
||||
|
||||
Assert.assertTrue(filter.filter("/*/l7check.html"));
|
||||
|
||||
Assert.assertFalse(filter.filter(null));
|
||||
Assert.assertFalse(filter.filter(""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void antstyle_equals_match() throws Exception {
|
||||
Filter<String> filter = new ExcludeUrlFilter("/monitor/stringEquals,/monitor/antstyle.*");
|
||||
|
||||
Assert.assertTrue(filter.filter("/monitor/stringEquals"));
|
||||
Assert.assertTrue(filter.filter("/monitor/antstyle.html"));
|
||||
|
||||
Assert.assertFalse(filter.filter("/monitor/stringEquals.test"));
|
||||
Assert.assertFalse(filter.filter("/monitor/antstyleXXX.html"));
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
package com.navercorp.pinpoint.plugin.jetty;
|
||||
|
||||
import com.navercorp.pinpoint.bootstrap.config.ExcludeUrlFilter;
|
||||
import com.navercorp.pinpoint.bootstrap.config.ExcludePathFilter;
|
||||
import com.navercorp.pinpoint.bootstrap.config.Filter;
|
||||
import com.navercorp.pinpoint.bootstrap.config.ProfilerConfig;
|
||||
import com.navercorp.pinpoint.bootstrap.config.SkipFilter;
|
||||
@@ -27,7 +27,7 @@ public class JettyConfiguration {
|
||||
final String jettyExcludeURL = config.readString("profiler.jetty.excludeurl", "");
|
||||
|
||||
if (!jettyExcludeURL.isEmpty()) {
|
||||
this.jettyExcludeUrlFilter = new ExcludeUrlFilter(jettyExcludeURL);
|
||||
this.jettyExcludeUrlFilter = new ExcludePathFilter(jettyExcludeURL);
|
||||
} else{
|
||||
this.jettyExcludeUrlFilter = new SkipFilter<String>();
|
||||
}
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
package com.navercorp.pinpoint.plugin.tomcat;
|
||||
|
||||
import com.navercorp.pinpoint.bootstrap.config.ExcludeUrlFilter;
|
||||
import com.navercorp.pinpoint.bootstrap.config.ExcludePathFilter;
|
||||
import com.navercorp.pinpoint.bootstrap.config.Filter;
|
||||
import com.navercorp.pinpoint.bootstrap.config.ProfilerConfig;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class TomcatConfiguration {
|
||||
final String tomcatExcludeURL = config.readString("profiler.tomcat.excludeurl", "");
|
||||
|
||||
if (!tomcatExcludeURL.isEmpty()) {
|
||||
this.tomcatExcludeUrlFilter = new ExcludeUrlFilter(tomcatExcludeURL);
|
||||
this.tomcatExcludeUrlFilter = new ExcludePathFilter(tomcatExcludeURL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user