forked from pinpoint-apm/pinpoint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a56d69
commit b1fd045
Showing
20 changed files
with
460 additions
and
24 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
...core/src/main/java/com/navercorp/pinpoint/bootstrap/plugin/uri/UriStatMetricRegistry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright 2017 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.plugin.uri; | ||
|
||
/** | ||
* @author minwoo.jung | ||
*/ | ||
public interface UriStatMetricRegistry { | ||
void incrementUriCount(String uri); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...in/java/com/navercorp/pinpoint/plugin/spring/beans/interceptor/DoDispatchInterceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright 2017 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.plugin.spring.beans.interceptor; | ||
|
||
import com.navercorp.pinpoint.bootstrap.interceptor.AroundInterceptor; | ||
import com.navercorp.pinpoint.bootstrap.plugin.uri.UriStatMetricRegistry; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
|
||
/** | ||
* @author minwoo.jung | ||
*/ | ||
public class DoDispatchInterceptor implements AroundInterceptor { | ||
|
||
private final UriStatMetricRegistry uriStatMetricRegistry; | ||
|
||
public DoDispatchInterceptor(UriStatMetricRegistry uriStatMetricRegistry) { | ||
this.uriStatMetricRegistry = uriStatMetricRegistry; | ||
} | ||
|
||
@Override | ||
public void before(Object target, Object[] args) { | ||
System.out.println("=start="); | ||
for (int i = 0 ; i < args.length; i++) { | ||
System.out.println(args[i]); | ||
} | ||
System.out.println("=end="); | ||
if (args != null && args.length > 1) { | ||
if (args[0] instanceof HttpServletRequest) { | ||
HttpServletRequest request = (HttpServletRequest)args[0]; | ||
// request.getAttribute() | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void after(Object target, Object[] args, Object result, Throwable throwable) { | ||
|
||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
...n/java/com/navercorp/pinpoint/plugin/spring/beans/interceptor/HandleMatchInterceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright 2017 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.plugin.spring.beans.interceptor; | ||
|
||
import com.navercorp.pinpoint.bootstrap.interceptor.AroundInterceptor; | ||
import com.navercorp.pinpoint.bootstrap.plugin.uri.UriStatMetricRegistry; | ||
import org.springframework.web.servlet.HandlerMapping; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
|
||
/** | ||
* @author minwoo.jung | ||
*/ | ||
public class HandleMatchInterceptor implements AroundInterceptor { | ||
private final UriStatMetricRegistry uriStatMetricRegistry; | ||
|
||
public HandleMatchInterceptor(UriStatMetricRegistry uriStatMetricRegistry) { | ||
this.uriStatMetricRegistry = uriStatMetricRegistry; | ||
} | ||
|
||
@Override | ||
public void before(Object target, Object[] args) { | ||
} | ||
|
||
@Override | ||
public void after(Object target, Object[] args, Object result, Throwable throwable) { | ||
System.out.println("==================start=================="); | ||
for (int i = 0 ; i < args.length; i++) { | ||
System.out.println("arg : " + args[i]); | ||
} | ||
|
||
if (args != null && args.length == 3) { | ||
if (args[2] instanceof HttpServletRequest) { | ||
HttpServletRequest request = (HttpServletRequest)args[2]; | ||
Object uri = request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE); | ||
|
||
if (uri instanceof String) { | ||
uriStatMetricRegistry.incrementUriCount((String) uri); | ||
System.out.println("url : " + uri); | ||
} | ||
} | ||
} | ||
|
||
System.out.println("===================end==================="); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
...main/java/com/navercorp/pinpoint/plugin/spring/beans/interceptor/RegisterInterceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright 2017 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.plugin.spring.beans.interceptor; | ||
|
||
import com.navercorp.pinpoint.bootstrap.interceptor.AroundInterceptor; | ||
import com.sun.org.apache.bcel.internal.generic.INSTANCEOF; | ||
import org.springframework.web.servlet.mvc.method.RequestMappingInfo; | ||
|
||
/** | ||
* @author minwoo.jung | ||
*/ | ||
public class RegisterInterceptor implements AroundInterceptor { | ||
|
||
// private UriStatMetricRegistry urlStatMetricRegistry; | ||
|
||
// public RegisterInterceptor(UrlStatMetricRegistry urlStatMetricRegistry) { | ||
// public RegisterInterceptor() { | ||
// this.urlStatMetricRegistry = new UriStatMetricRegistry(); | ||
// } | ||
|
||
@Override | ||
public void before(Object target, Object[] args) { | ||
System.out.println("=============method call================="); | ||
for (int i =0 ; i < 3 ; i++) { | ||
System.out.println(args[i]); | ||
} | ||
if (args[1] instanceof RequestMappingInfo) { | ||
// urlStatMetricRegistry.addRequestMappingInfo((RequestMappingInfo)args[1]); | ||
} | ||
System.out.println("========================================"); | ||
} | ||
|
||
@Override | ||
public void after(Object target, Object[] args, Object result, Throwable throwable) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.