diff --git a/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/plugin/uri/UriStatMetricRegistry.java b/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/plugin/uri/UriStatMetricRegistry.java
new file mode 100644
index 000000000000..495c06d2295c
--- /dev/null
+++ b/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/plugin/uri/UriStatMetricRegistry.java
@@ -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);
+}
diff --git a/plugins/spring/pom.xml b/plugins/spring/pom.xml
index 4bc399e80f1e..c9c6f590dba1 100644
--- a/plugins/spring/pom.xml
+++ b/plugins/spring/pom.xml
@@ -29,5 +29,16 @@
spring-context
provided
+
+
+ org.springframework
+ spring-webmvc
+ provided
+
+
+ javax.servlet
+ javax.servlet-api
+ provided
+
diff --git a/plugins/spring/src/main/java/com/navercorp/pinpoint/plugin/spring/beans/SpringBeansPlugin.java b/plugins/spring/src/main/java/com/navercorp/pinpoint/plugin/spring/beans/SpringBeansPlugin.java
index 1c21dad96b53..badfd7196122 100644
--- a/plugins/spring/src/main/java/com/navercorp/pinpoint/plugin/spring/beans/SpringBeansPlugin.java
+++ b/plugins/spring/src/main/java/com/navercorp/pinpoint/plugin/spring/beans/SpringBeansPlugin.java
@@ -63,6 +63,59 @@ public void setup(ProfilerPluginSetupContext context) {
if (config.hasTarget(SpringBeansTargetScope.POST_PROCESSOR)) {
addAbstractAutowireCapableBeanFactoryTransformer(context);
}
+
+ //TODO : (minwoo) set SpringBeansTargetScope??
+// addMappingRegistoryTransformer(context);
+// doDispatchTransformer(context);
+ addHandleMatchTransformer(context);
+ }
+
+ private void addHandleMatchTransformer(ProfilerPluginSetupContext context) {
+ transformTemplate.transform("org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping", new TransformCallback() {
+ @Override
+ public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, String className, Class> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {
+ InstrumentClass target = instrumentor.getInstrumentClass(loader, className, classfileBuffer);
+
+ final InstrumentMethod createBeanInstance = target.getDeclaredMethod("handleMatch", "org.springframework.web.servlet.mvc.method.RequestMappingInfo", "java.lang.String", "javax.servlet.http.HttpServletRequest");
+// createBeanInstance.addInterceptor("com.navercorp.pinpoint.plugin.spring.beans.interceptor.RegisterInterceptor", va(urlStatMetricRegistry));
+ createBeanInstance.addInterceptor("com.navercorp.pinpoint.plugin.spring.beans.interceptor.HandleMatchInterceptor");
+
+ return target.toBytecode();
+ }
+ });
+ }
+
+ private void doDispatchTransformer(ProfilerPluginSetupContext context) {
+ transformTemplate.transform("org.springframework.web.servlet.DispatcherServlet", new TransformCallback() {
+ @Override
+ public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, String className, Class> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {
+// UrlStatMetricRegistry urlStatMetricRegistry = new UrlStatMetricRegistry();
+ InstrumentClass target = instrumentor.getInstrumentClass(loader, className, classfileBuffer);
+
+ final InstrumentMethod createBeanInstance = target.getDeclaredMethod("doDispatch", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse");
+// createBeanInstance.addInterceptor("com.navercorp.pinpoint.plugin.spring.beans.interceptor.RegisterInterceptor", va(urlStatMetricRegistry));
+ createBeanInstance.addInterceptor("com.navercorp.pinpoint.plugin.spring.beans.interceptor.DoDispatchInterceptor");
+
+ return target.toBytecode();
+ }
+ });
+ }
+
+ private void addMappingRegistoryTransformer(final ProfilerPluginSetupContext context) {
+
+ transformTemplate.transform("org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$MappingRegistry", new TransformCallback() {
+ @Override
+ public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, String className, Class> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {
+// UrlStatMetricRegistry urlStatMetricRegistry = new UrlStatMetricRegistry();
+ InstrumentClass target = instrumentor.getInstrumentClass(loader, className, classfileBuffer);
+
+ final InstrumentMethod createBeanInstance = target.getDeclaredMethod("register", "java.lang.Object", "java.lang.Object", "java.lang.reflect.Method");
+// createBeanInstance.addInterceptor("com.navercorp.pinpoint.plugin.spring.beans.interceptor.RegisterInterceptor", va(urlStatMetricRegistry));
+ createBeanInstance.addInterceptor("com.navercorp.pinpoint.plugin.spring.beans.interceptor.RegisterInterceptor");
+
+ return target.toBytecode();
+ }
+ });
}
private void addAbstractAutowireCapableBeanFactoryTransformer(final ProfilerPluginSetupContext context) {
diff --git a/plugins/spring/src/main/java/com/navercorp/pinpoint/plugin/spring/beans/interceptor/DoDispatchInterceptor.java b/plugins/spring/src/main/java/com/navercorp/pinpoint/plugin/spring/beans/interceptor/DoDispatchInterceptor.java
new file mode 100644
index 000000000000..8ed78b24d743
--- /dev/null
+++ b/plugins/spring/src/main/java/com/navercorp/pinpoint/plugin/spring/beans/interceptor/DoDispatchInterceptor.java
@@ -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) {
+
+ }
+}
diff --git a/plugins/spring/src/main/java/com/navercorp/pinpoint/plugin/spring/beans/interceptor/HandleMatchInterceptor.java b/plugins/spring/src/main/java/com/navercorp/pinpoint/plugin/spring/beans/interceptor/HandleMatchInterceptor.java
new file mode 100644
index 000000000000..f96c80a26e42
--- /dev/null
+++ b/plugins/spring/src/main/java/com/navercorp/pinpoint/plugin/spring/beans/interceptor/HandleMatchInterceptor.java
@@ -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===================");
+ }
+}
diff --git a/plugins/spring/src/main/java/com/navercorp/pinpoint/plugin/spring/beans/interceptor/RegisterInterceptor.java b/plugins/spring/src/main/java/com/navercorp/pinpoint/plugin/spring/beans/interceptor/RegisterInterceptor.java
new file mode 100644
index 000000000000..a837b07bac3a
--- /dev/null
+++ b/plugins/spring/src/main/java/com/navercorp/pinpoint/plugin/spring/beans/interceptor/RegisterInterceptor.java
@@ -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) {
+
+ }
+}
diff --git a/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/module/ApplicationContextModule.java b/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/module/ApplicationContextModule.java
index 76bb99d2d8da..6266b54adcc2 100644
--- a/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/module/ApplicationContextModule.java
+++ b/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/module/ApplicationContextModule.java
@@ -27,6 +27,7 @@
import com.navercorp.pinpoint.bootstrap.context.TraceContext;
import com.navercorp.pinpoint.bootstrap.instrument.DynamicTransformTrigger;
import com.navercorp.pinpoint.bootstrap.plugin.jdbc.JdbcContext;
+import com.navercorp.pinpoint.bootstrap.plugin.uri.UriStatMetricRegistry;
import com.navercorp.pinpoint.bootstrap.sampler.Sampler;
import com.navercorp.pinpoint.common.service.ServiceTypeRegistryService;
import com.navercorp.pinpoint.common.trace.ServiceType;
@@ -119,6 +120,7 @@
import com.navercorp.pinpoint.profiler.context.provider.stat.response.ResponseTimeMetricProvider;
import com.navercorp.pinpoint.profiler.context.provider.stat.transaction.TransactionMetricCollectorProvider;
import com.navercorp.pinpoint.profiler.context.provider.stat.transaction.TransactionMetricProvider;
+import com.navercorp.pinpoint.profiler.context.provider.stat.uri.UriStatMetricRegistryProvider;
import com.navercorp.pinpoint.profiler.context.recorder.DefaultRecorderFactory;
import com.navercorp.pinpoint.profiler.context.recorder.RecorderFactory;
import com.navercorp.pinpoint.profiler.context.storage.StorageFactory;
@@ -129,10 +131,7 @@
import com.navercorp.pinpoint.profiler.metadata.DefaultStringMetaDataService;
import com.navercorp.pinpoint.profiler.metadata.SqlMetaDataService;
import com.navercorp.pinpoint.profiler.metadata.StringMetaDataService;
-import com.navercorp.pinpoint.profiler.monitor.AgentStatMonitor;
-import com.navercorp.pinpoint.profiler.monitor.DeadlockMonitor;
-import com.navercorp.pinpoint.profiler.monitor.DeadlockThreadRegistry;
-import com.navercorp.pinpoint.profiler.monitor.DefaultAgentStatMonitor;
+import com.navercorp.pinpoint.profiler.monitor.*;
import com.navercorp.pinpoint.profiler.monitor.collector.AgentStatCollector;
import com.navercorp.pinpoint.profiler.monitor.collector.AgentStatMetricCollector;
import com.navercorp.pinpoint.profiler.monitor.collector.activethread.ActiveTraceMetricCollector;
@@ -256,6 +255,7 @@ protected void configure() {
bind(DeadlockMonitor.class).toProvider(DeadlockMonitorProvider.class).in(Scopes.SINGLETON);
bind(AgentInfoSender.class).toProvider(AgentInfoSenderProvider.class).in(Scopes.SINGLETON);
bind(AgentStatMonitor.class).to(DefaultAgentStatMonitor.class).in(Scopes.SINGLETON);
+ bind(UriStatMonitor.class).to(DefaultUriStatMonitor.class).in(Scopes.SINGLETON);
}
private void bindTraceComponent() {
@@ -330,6 +330,8 @@ private void bindAgentStatComponent() {
bind(DeadlockMetric.class).toProvider(DeadlockMetricProvider.class).in(Scopes.SINGLETON);
bind(DeadlockMetricCollector.class).toProvider(DeadlockMetricCollectorProvider.class).in(Scopes.SINGLETON);
+ bind(UriStatMetricRegistry.class).toProvider(UriStatMetricRegistryProvider.class).in(Scopes.SINGLETON);
+
bind(new TypeLiteral>() {})
.annotatedWith(Names.named("AgentStatCollector"))
.to(AgentStatCollector.class).in(Scopes.SINGLETON);
diff --git a/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/module/DefaultApplicationContext.java b/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/module/DefaultApplicationContext.java
index 5fc22c309ddc..f1aab66f1745 100644
--- a/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/module/DefaultApplicationContext.java
+++ b/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/module/DefaultApplicationContext.java
@@ -37,6 +37,7 @@
import com.navercorp.pinpoint.profiler.interceptor.registry.InterceptorRegistryBinder;
import com.navercorp.pinpoint.profiler.monitor.AgentStatMonitor;
import com.navercorp.pinpoint.profiler.monitor.DeadlockMonitor;
+import com.navercorp.pinpoint.profiler.monitor.UriStatMonitor;
import com.navercorp.pinpoint.profiler.sender.DataSender;
import com.navercorp.pinpoint.profiler.sender.EnhancedDataSender;
import com.navercorp.pinpoint.rpc.client.PinpointClientFactory;
@@ -81,6 +82,7 @@ public class DefaultApplicationContext implements ApplicationContext {
private final DynamicTransformTrigger dynamicTransformTrigger;
private final Injector injector;
+ private final UriStatMonitor uriStatMonitor;
public DefaultApplicationContext(AgentOption agentOption, final InterceptorRegistryBinder interceptorRegistryBinder) {
this(agentOption, interceptorRegistryBinder, new ApplicationContextModuleFactory());
@@ -133,6 +135,7 @@ public DefaultApplicationContext(AgentOption agentOption, final InterceptorRegis
this.deadlockMonitor = injector.getInstance(DeadlockMonitor.class);
this.agentInfoSender = injector.getInstance(AgentInfoSender.class);
this.agentStatMonitor = injector.getInstance(AgentStatMonitor.class);
+ this.uriStatMonitor = injector.getInstance(UriStatMonitor.class);
}
public ClassFileTransformer wrap(ClassFileTransformerDispatcher classFileTransformerDispatcher) {
@@ -206,6 +209,8 @@ public void start() {
this.deadlockMonitor.start();
this.agentInfoSender.start();
this.agentStatMonitor.start();
+// 일단 url 별로 수집은 되고 있고 collector로 보낼수 있도록 batch 형태로 job이 동작되도록 구현부터 해야함.
+ this.uriStatMonitor.start();
}
@Override
diff --git a/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/provider/ObjectBinderFactoryProvider.java b/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/provider/ObjectBinderFactoryProvider.java
index 5d190b1d5889..17a21f238d3f 100644
--- a/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/provider/ObjectBinderFactoryProvider.java
+++ b/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/provider/ObjectBinderFactoryProvider.java
@@ -20,6 +20,7 @@
import com.google.inject.Provider;
import com.navercorp.pinpoint.bootstrap.config.ProfilerConfig;
import com.navercorp.pinpoint.bootstrap.context.TraceContext;
+import com.navercorp.pinpoint.bootstrap.plugin.uri.UriStatMetricRegistry;
import com.navercorp.pinpoint.profiler.context.monitor.DataSourceMonitorRegistryService;
import com.navercorp.pinpoint.profiler.metadata.ApiMetaDataService;
import com.navercorp.pinpoint.profiler.objectfactory.ObjectBinderFactory;
@@ -33,9 +34,10 @@ public class ObjectBinderFactoryProvider implements Provider traceContextProvider;
private final DataSourceMonitorRegistryService dataSourceMonitorRegistryService;
private final Provider apiMetaDataServiceProvider;
+ private final UriStatMetricRegistry uriStatMetricRegistry;
@Inject
- public ObjectBinderFactoryProvider(ProfilerConfig profilerConfig, Provider traceContextProvider, DataSourceMonitorRegistryService dataSourceMonitorRegistryService, Provider apiMetaDataServiceProvider) {
+ public ObjectBinderFactoryProvider(ProfilerConfig profilerConfig, Provider traceContextProvider, DataSourceMonitorRegistryService dataSourceMonitorRegistryService, Provider apiMetaDataServiceProvider, UriStatMetricRegistry uriStatMetricRegistry) {
if (profilerConfig == null) {
throw new NullPointerException("profilerConfig must not be null");
}
@@ -48,15 +50,19 @@ public ObjectBinderFactoryProvider(ProfilerConfig profilerConfig, Provider {
+
+ @Inject
+ public UriStatMetricRegistryProvider() {
+ }
+
+ @Override
+ public UriStatMetricRegistry get() {
+ return new DefaultUriStatMetricRegistry();
+ }
+}
diff --git a/profiler/src/main/java/com/navercorp/pinpoint/profiler/interceptor/factory/AnnotatedInterceptorFactory.java b/profiler/src/main/java/com/navercorp/pinpoint/profiler/interceptor/factory/AnnotatedInterceptorFactory.java
index b5212bd27b5b..f2f575e81a55 100644
--- a/profiler/src/main/java/com/navercorp/pinpoint/profiler/interceptor/factory/AnnotatedInterceptorFactory.java
+++ b/profiler/src/main/java/com/navercorp/pinpoint/profiler/interceptor/factory/AnnotatedInterceptorFactory.java
@@ -62,6 +62,7 @@
import com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScope;
import com.navercorp.pinpoint.bootstrap.plugin.ObjectFactory;
import com.navercorp.pinpoint.bootstrap.plugin.monitor.DataSourceMonitorRegistry;
+import com.navercorp.pinpoint.bootstrap.plugin.uri.UriStatMetricRegistry;
import com.navercorp.pinpoint.profiler.instrument.ScopeInfo;
import com.navercorp.pinpoint.profiler.metadata.ApiMetaDataService;
import com.navercorp.pinpoint.profiler.objectfactory.AutoBindingObjectFactory;
@@ -75,11 +76,12 @@ public class AnnotatedInterceptorFactory implements InterceptorFactory {
private final ProfilerConfig profilerConfig;
private final TraceContext traceContext;
private final DataSourceMonitorRegistry dataSourceMonitorRegistry;
+ private final UriStatMetricRegistry uriStatMetricRegistry;
private final ApiMetaDataService apiMetaDataService;
private final InstrumentContext pluginContext;
private final boolean exceptionHandle;
- public AnnotatedInterceptorFactory(ProfilerConfig profilerConfig, TraceContext traceContext, DataSourceMonitorRegistry dataSourceMonitorRegistry, ApiMetaDataService apiMetaDataService, InstrumentContext pluginContext, boolean exceptionHandle) {
+ public AnnotatedInterceptorFactory(ProfilerConfig profilerConfig, TraceContext traceContext, DataSourceMonitorRegistry dataSourceMonitorRegistry, ApiMetaDataService apiMetaDataService, InstrumentContext pluginContext, boolean exceptionHandle, UriStatMetricRegistry uriStatMetricRegistry) {
if (profilerConfig == null) {
throw new NullPointerException("profilerConfig must not be null");
}
@@ -95,9 +97,13 @@ public AnnotatedInterceptorFactory(ProfilerConfig profilerConfig, TraceContext t
if (pluginContext == null) {
throw new NullPointerException("pluginContext must not be null");
}
+ if (uriStatMetricRegistry == null) {
+ throw new NullPointerException("uriStatMetricRegistry must not be null");
+ }
this.profilerConfig = profilerConfig;
this.traceContext = traceContext;
this.dataSourceMonitorRegistry = dataSourceMonitorRegistry;
+ this.uriStatMetricRegistry = uriStatMetricRegistry;
this.apiMetaDataService = apiMetaDataService;
this.pluginContext = pluginContext;
this.exceptionHandle = exceptionHandle;
@@ -109,7 +115,7 @@ public Interceptor getInterceptor(ClassLoader classLoader, String interceptorCla
AutoBindingObjectFactory factory = new AutoBindingObjectFactory(profilerConfig, traceContext, pluginContext, classLoader);
ObjectFactory objectFactory = ObjectFactory.byConstructor(interceptorClassName, providedArguments);
final InterceptorScope interceptorScope = scopeInfo.getInterceptorScope();
- InterceptorArgumentProvider interceptorArgumentProvider = new InterceptorArgumentProvider(dataSourceMonitorRegistry, apiMetaDataService, scopeInfo.getInterceptorScope(), target, targetMethod);
+ InterceptorArgumentProvider interceptorArgumentProvider = new InterceptorArgumentProvider(dataSourceMonitorRegistry, apiMetaDataService, uriStatMetricRegistry, scopeInfo.getInterceptorScope(), target, targetMethod);
Interceptor interceptor = (Interceptor) factory.createInstance(objectFactory, interceptorArgumentProvider);
diff --git a/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/DefaultUriStatMonitor.java b/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/DefaultUriStatMonitor.java
new file mode 100644
index 000000000000..18b25f41a5cb
--- /dev/null
+++ b/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/DefaultUriStatMonitor.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2018 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.profiler.monitor;
+
+/**
+ * @author minwoo.jung
+ */
+public class DefaultUriStatMonitor implements UriStatMonitor {
+}
diff --git a/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/UriStatMonitor.java b/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/UriStatMonitor.java
new file mode 100644
index 000000000000..8ea3a3d57ce3
--- /dev/null
+++ b/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/UriStatMonitor.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2018 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.profiler.monitor;
+
+/**
+ * @author minwoo.jung
+ */
+public interface UriStatMonitor {
+}
diff --git a/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/metric/uri/DefaultUriStatMetricRegistry.java b/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/metric/uri/DefaultUriStatMetricRegistry.java
new file mode 100644
index 000000000000..2910d8136e4e
--- /dev/null
+++ b/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/metric/uri/DefaultUriStatMetricRegistry.java
@@ -0,0 +1,56 @@
+/*
+ * 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.profiler.monitor.metric.uri;
+
+import com.navercorp.pinpoint.bootstrap.plugin.uri.UriStatMetricRegistry;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * @author minwoo.jung
+ */
+public class DefaultUriStatMetricRegistry implements UriStatMetricRegistry {
+
+ private Map uriStatMetricMap = new ConcurrentHashMap();
+
+ @Override
+ public void incrementUriCount(String uri) {
+ UriStatMetric uriStatMetric = uriStatMetricMap.get(uri);
+
+ if (uriStatMetric == null) {
+ uriStatMetric = new UriStatMetric(uri);
+ uriStatMetricMap.put(uri, uriStatMetric);
+ }
+
+ uriStatMetric.incrementCount();
+ }
+
+ public class UriStatMetric {
+ private final String uri;
+ private volatile AtomicLong count;
+
+ public UriStatMetric(String uri) {
+ this.uri = uri;
+ count = new AtomicLong(0);
+ }
+
+ public void incrementCount() {
+ count.incrementAndGet();
+ }
+ }
+}
diff --git a/profiler/src/main/java/com/navercorp/pinpoint/profiler/objectfactory/InterceptorArgumentProvider.java b/profiler/src/main/java/com/navercorp/pinpoint/profiler/objectfactory/InterceptorArgumentProvider.java
index f89a7a8d2c95..d769efc4311f 100644
--- a/profiler/src/main/java/com/navercorp/pinpoint/profiler/objectfactory/InterceptorArgumentProvider.java
+++ b/profiler/src/main/java/com/navercorp/pinpoint/profiler/objectfactory/InterceptorArgumentProvider.java
@@ -21,6 +21,7 @@
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.NoCache;
import com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScope;
import com.navercorp.pinpoint.bootstrap.plugin.monitor.DataSourceMonitorRegistry;
+import com.navercorp.pinpoint.bootstrap.plugin.uri.UriStatMetricRegistry;
import com.navercorp.pinpoint.exception.PinpointException;
import com.navercorp.pinpoint.profiler.metadata.ApiMetaDataService;
import com.navercorp.pinpoint.profiler.util.TypeUtils;
@@ -37,20 +38,26 @@ public class InterceptorArgumentProvider implements ArgumentProvider {
private final InterceptorScope interceptorScope;
private final InstrumentClass targetClass;
private final InstrumentMethod targetMethod;
+ private final UriStatMetricRegistry uriStatMetricRegistry;
- public InterceptorArgumentProvider(DataSourceMonitorRegistry dataSourceMonitorRegistry, ApiMetaDataService apiMetaDataService, InstrumentClass targetClass) {
- this(dataSourceMonitorRegistry, apiMetaDataService, null, targetClass, null);
+ public InterceptorArgumentProvider(DataSourceMonitorRegistry dataSourceMonitorRegistry, ApiMetaDataService apiMetaDataService, InstrumentClass targetClass, UriStatMetricRegistry uriStatMetricRegistry) {
+ this(dataSourceMonitorRegistry, apiMetaDataService, uriStatMetricRegistry, null, targetClass, null);
}
- public InterceptorArgumentProvider(DataSourceMonitorRegistry dataSourceMonitorRegistry, ApiMetaDataService apiMetaDataService, InterceptorScope interceptorScope, InstrumentClass targetClass, InstrumentMethod targetMethod) {
+ public InterceptorArgumentProvider(DataSourceMonitorRegistry dataSourceMonitorRegistry, ApiMetaDataService apiMetaDataService, UriStatMetricRegistry uriStatMetricRegistry, InterceptorScope interceptorScope, InstrumentClass targetClass, InstrumentMethod targetMethod) {
if (dataSourceMonitorRegistry == null) {
throw new NullPointerException("dataSourceMonitorRegistry must not be null");
}
if (apiMetaDataService == null) {
throw new NullPointerException("apiMetaDataService must not be null");
}
+ if (uriStatMetricRegistry == null) {
+ throw new NullPointerException("uriStatMetricRegistry must not be null");
+ }
+
this.dataSourceMonitorRegistry = dataSourceMonitorRegistry;
this.apiMetaDataService = apiMetaDataService;
+ this.uriStatMetricRegistry = uriStatMetricRegistry;
this.interceptorScope = interceptorScope;
this.targetClass = targetClass;
this.targetMethod = targetMethod;
@@ -81,7 +88,10 @@ public Option get(int index, Class> type, Annotation[] annotations) {
}
} else if (type == DataSourceMonitorRegistry.class) {
return Option.withValue(dataSourceMonitorRegistry);
+ } else if (type == UriStatMetricRegistry.class) {
+ return Option.withValue(uriStatMetricRegistry);
}
+
return Option.empty();
}
diff --git a/profiler/src/main/java/com/navercorp/pinpoint/profiler/objectfactory/ObjectBinderFactory.java b/profiler/src/main/java/com/navercorp/pinpoint/profiler/objectfactory/ObjectBinderFactory.java
index a2194f30368b..7f91351ece96 100644
--- a/profiler/src/main/java/com/navercorp/pinpoint/profiler/objectfactory/ObjectBinderFactory.java
+++ b/profiler/src/main/java/com/navercorp/pinpoint/profiler/objectfactory/ObjectBinderFactory.java
@@ -22,6 +22,7 @@
import com.navercorp.pinpoint.bootstrap.instrument.InstrumentClass;
import com.navercorp.pinpoint.bootstrap.instrument.InstrumentContext;
import com.navercorp.pinpoint.bootstrap.plugin.monitor.DataSourceMonitorRegistry;
+import com.navercorp.pinpoint.bootstrap.plugin.uri.UriStatMetricRegistry;
import com.navercorp.pinpoint.profiler.context.monitor.DataSourceMonitorRegistryAdaptor;
import com.navercorp.pinpoint.profiler.context.monitor.DataSourceMonitorRegistryService;
import com.navercorp.pinpoint.profiler.interceptor.factory.AnnotatedInterceptorFactory;
@@ -35,8 +36,9 @@ public class ObjectBinderFactory {
private final Provider traceContextProvider;
private final DataSourceMonitorRegistry dataSourceMonitorRegistry;
private final Provider apiMetaDataServiceProvider;
+ private final UriStatMetricRegistry uriStatMetricRegistry;
- public ObjectBinderFactory(ProfilerConfig profilerConfig, Provider traceContextProvider, DataSourceMonitorRegistryService dataSourceMonitorRegistryService, Provider apiMetaDataServiceProvider) {
+ public ObjectBinderFactory(ProfilerConfig profilerConfig, Provider traceContextProvider, DataSourceMonitorRegistryService dataSourceMonitorRegistryService, Provider apiMetaDataServiceProvider, UriStatMetricRegistry uriStatMetricRegistry) {
if (profilerConfig == null) {
throw new NullPointerException("profilerConfig must not be null");
}
@@ -49,12 +51,15 @@ public ObjectBinderFactory(ProfilerConfig profilerConfig, Provider
if (apiMetaDataServiceProvider == null) {
throw new NullPointerException("apiMetaDataServiceProvider must not be null");
}
+ if (uriStatMetricRegistry == null) {
+ throw new NullPointerException("uriStatMetricRegistry must not be null");
+ }
this.profilerConfig = profilerConfig;
this.traceContextProvider = traceContextProvider;
-
this.dataSourceMonitorRegistry = new DataSourceMonitorRegistryAdaptor(dataSourceMonitorRegistryService);
this.apiMetaDataServiceProvider = apiMetaDataServiceProvider;
+ this.uriStatMetricRegistry = uriStatMetricRegistry;
}
public AutoBindingObjectFactory newAutoBindingObjectFactory(InstrumentContext pluginContext, ClassLoader classLoader, ArgumentProvider... argumentProviders) {
@@ -65,12 +70,12 @@ public AutoBindingObjectFactory newAutoBindingObjectFactory(InstrumentContext pl
public InterceptorArgumentProvider newInterceptorArgumentProvider(InstrumentClass instrumentClass) {
ApiMetaDataService apiMetaDataService = this.apiMetaDataServiceProvider.get();
- return new InterceptorArgumentProvider(dataSourceMonitorRegistry, apiMetaDataService, instrumentClass);
+ return new InterceptorArgumentProvider(dataSourceMonitorRegistry, apiMetaDataService, instrumentClass, uriStatMetricRegistry);
}
public AnnotatedInterceptorFactory newAnnotatedInterceptorFactory(InstrumentContext pluginContext, boolean exceptionHandle) {
final TraceContext traceContext = this.traceContextProvider.get();
ApiMetaDataService apiMetaDataService = this.apiMetaDataServiceProvider.get();
- return new AnnotatedInterceptorFactory(profilerConfig, traceContext, dataSourceMonitorRegistry, apiMetaDataService, pluginContext, exceptionHandle);
+ return new AnnotatedInterceptorFactory(profilerConfig, traceContext, dataSourceMonitorRegistry, apiMetaDataService, pluginContext, exceptionHandle, uriStatMetricRegistry);
}
}
diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/instrument/ASMClassTest.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/instrument/ASMClassTest.java
index 0679b35767a7..ddb5a5d020b6 100644
--- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/instrument/ASMClassTest.java
+++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/instrument/ASMClassTest.java
@@ -23,6 +23,7 @@
import com.navercorp.pinpoint.bootstrap.instrument.InstrumentContext;
import com.navercorp.pinpoint.bootstrap.instrument.InstrumentMethod;
import com.navercorp.pinpoint.bootstrap.instrument.MethodFilters;
+import com.navercorp.pinpoint.bootstrap.plugin.uri.UriStatMetricRegistry;
import com.navercorp.pinpoint.profiler.context.monitor.DataSourceMonitorRegistryService;
import com.navercorp.pinpoint.profiler.interceptor.registry.DefaultInterceptorRegistryBinder;
import com.navercorp.pinpoint.profiler.interceptor.registry.InterceptorRegistryBinder;
@@ -59,7 +60,8 @@ public class ASMClassTest {
private final DataSourceMonitorRegistryService dataSourceMonitorRegistryService = mock(DataSourceMonitorRegistryService.class);
private final Provider apiMetaDataService = Providers.of(mock(ApiMetaDataService.class));
private final InstrumentContext pluginContext = mock(InstrumentContext.class);
- private final ObjectBinderFactory objectBinderFactory = new ObjectBinderFactory(profilerConfig, traceContextProvider, dataSourceMonitorRegistryService, apiMetaDataService);
+ private final UriStatMetricRegistry uriStatMetricRegistry = mock(UriStatMetricRegistry.class);
+ private final ObjectBinderFactory objectBinderFactory = new ObjectBinderFactory(profilerConfig, traceContextProvider, dataSourceMonitorRegistryService, apiMetaDataService, uriStatMetricRegistry);
@Before
public void setUp() {
diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/plugin/AnnotatedInterceptorFactoryTest.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/plugin/AnnotatedInterceptorFactoryTest.java
index afcd96c06cac..902b2929cfa8 100644
--- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/plugin/AnnotatedInterceptorFactoryTest.java
+++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/plugin/AnnotatedInterceptorFactoryTest.java
@@ -25,6 +25,7 @@
import com.navercorp.pinpoint.bootstrap.config.ProfilerConfig;
import com.navercorp.pinpoint.bootstrap.instrument.InstrumentContext;
import com.navercorp.pinpoint.bootstrap.plugin.monitor.DataSourceMonitorRegistry;
+import com.navercorp.pinpoint.bootstrap.plugin.uri.UriStatMetricRegistry;
import com.navercorp.pinpoint.profiler.instrument.ScopeInfo;
import com.navercorp.pinpoint.profiler.metadata.ApiMetaDataService;
import org.junit.Before;
@@ -53,6 +54,7 @@ public class AnnotatedInterceptorFactoryTest {
private final InstrumentClass instrumentClass = mock(InstrumentClass.class);
private final InstrumentMethod instrumentMethod = mock(InstrumentMethod.class);
private final MethodDescriptor descriptor = mock(MethodDescriptor.class);
+ private final UriStatMetricRegistry uriStatMetricRegistry = mock(UriStatMetricRegistry.class);
@Before
public void setUp() {
@@ -72,7 +74,7 @@ public Class> answer(InvocationOnMock invocation) throws Throwable {
}
private AnnotatedInterceptorFactory newAnnotatedInterceptorFactory() {
- return new AnnotatedInterceptorFactory(profilerConfig, traceContext, dataSourceMonitorRegistry, apiMetaDataService, pluginContext, false);
+ return new AnnotatedInterceptorFactory(profilerConfig, traceContext, dataSourceMonitorRegistry, apiMetaDataService, pluginContext, false, uriStatMetricRegistry);
}
private ScopeInfo newEmptyScopeInfo() {
diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/plugin/xml/interceptor/TargetAnnotatedInterceptorInjector.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/plugin/xml/interceptor/TargetAnnotatedInterceptorInjector.java
index 0fda2c518dc6..aa73f533345e 100644
--- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/plugin/xml/interceptor/TargetAnnotatedInterceptorInjector.java
+++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/plugin/xml/interceptor/TargetAnnotatedInterceptorInjector.java
@@ -32,6 +32,7 @@
import com.navercorp.pinpoint.bootstrap.interceptor.scope.ExecutionPolicy;
import com.navercorp.pinpoint.bootstrap.plugin.ObjectFactory;
import com.navercorp.pinpoint.bootstrap.plugin.monitor.DataSourceMonitorRegistry;
+import com.navercorp.pinpoint.bootstrap.plugin.uri.UriStatMetricRegistry;
import com.navercorp.pinpoint.exception.PinpointException;
import com.navercorp.pinpoint.profiler.metadata.ApiMetaDataService;
import com.navercorp.pinpoint.profiler.objectfactory.AutoBindingObjectFactory;
@@ -60,9 +61,10 @@ public class TargetAnnotatedInterceptorInjector implements ClassRecipe {
private final ProfilerConfig profilerConfig;
private final DataSourceMonitorRegistry dataSourceMonitorRegistry;
private final ApiMetaDataService apiMetaDataService;
+ private final UriStatMetricRegistry uriStatMetricRegistry;
- public TargetAnnotatedInterceptorInjector(ProfilerConfig profilerConfig, TraceContext traceContext, DataSourceMonitorRegistry dataSourceMonitorRegistry, ApiMetaDataService apiMetaDataService, InstrumentContext pluginContext,
+ public TargetAnnotatedInterceptorInjector(ProfilerConfig profilerConfig, TraceContext traceContext, DataSourceMonitorRegistry dataSourceMonitorRegistry, UriStatMetricRegistry uriStatMetricRegistry, ApiMetaDataService apiMetaDataService, InstrumentContext pluginContext,
String interceptorClassName, Object[] providedArguments, String scopeName, ExecutionPolicy executionPoint) {
if (profilerConfig == null) {
throw new NullPointerException("profilerConfig must not be null");
@@ -79,6 +81,9 @@ public TargetAnnotatedInterceptorInjector(ProfilerConfig profilerConfig, TraceCo
if (pluginContext == null) {
throw new NullPointerException("pluginContext must not be null");
}
+ if (uriStatMetricRegistry == null) {
+ throw new NullPointerException("uriStatMetricRegistry must not be null");
+ }
this.profilerConfig = profilerConfig;
this.traceContext = traceContext;
this.dataSourceMonitorRegistry = dataSourceMonitorRegistry;
@@ -88,6 +93,7 @@ public TargetAnnotatedInterceptorInjector(ProfilerConfig profilerConfig, TraceCo
this.providedArguments = providedArguments;
this.scopeName = scopeName;
this.executionPoint = executionPoint;
+ this.uriStatMetricRegistry = uriStatMetricRegistry;
}
@Override
@@ -163,7 +169,7 @@ private MethodTransformer createFilteredMethodEditor(TargetFilter annotation, In
throw new PinpointException("type of @TargetFilter is null: " + interceptorClassName);
}
- final InterceptorArgumentProvider interceptorArgumentProvider = new InterceptorArgumentProvider(dataSourceMonitorRegistry, apiMetaDataService, targetClass);
+ final InterceptorArgumentProvider interceptorArgumentProvider = new InterceptorArgumentProvider(dataSourceMonitorRegistry, apiMetaDataService, targetClass, uriStatMetricRegistry);
AutoBindingObjectFactory filterFactory = new AutoBindingObjectFactory(profilerConfig, traceContext, pluginContext, classLoader, interceptorArgumentProvider);
MethodFilter filter = (MethodFilter)filterFactory.createInstance(ObjectFactory.byConstructor(type, (Object[]) annotation.constructorArguments()));
MethodRecipe recipe = annotation.singleton() ? new SharedAnnotatedInterceptorInjector(injector) : injector;
diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/plugin/xml/transformer/DefaultClassFileTransformerBuilder.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/plugin/xml/transformer/DefaultClassFileTransformerBuilder.java
index 6d8cc6fc42a9..aadb917817c9 100644
--- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/plugin/xml/transformer/DefaultClassFileTransformerBuilder.java
+++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/plugin/xml/transformer/DefaultClassFileTransformerBuilder.java
@@ -12,6 +12,7 @@
import com.navercorp.pinpoint.bootstrap.instrument.MethodFilter;
import com.navercorp.pinpoint.bootstrap.interceptor.scope.ExecutionPolicy;
import com.navercorp.pinpoint.bootstrap.plugin.monitor.DataSourceMonitorRegistry;
+import com.navercorp.pinpoint.bootstrap.plugin.uri.UriStatMetricRegistry;
import com.navercorp.pinpoint.profiler.metadata.ApiMetaDataService;
import com.navercorp.pinpoint.profiler.plugin.MatchableClassFileTransformer;
import com.navercorp.pinpoint.profiler.plugin.xml.FieldInjector;
@@ -33,12 +34,13 @@ public class DefaultClassFileTransformerBuilder implements ClassFileTransformerB
private final String targetClassName;
private final DataSourceMonitorRegistry dataSourceMonitorRegistry;
private final ApiMetaDataService apiMetaDataService;
+ private final UriStatMetricRegistry uriStatMetricRegistry;
- public DefaultClassFileTransformerBuilder(ProfilerConfig profilerConfig, TraceContext traceContext, DataSourceMonitorRegistry dataSourceMonitorRegistry, ApiMetaDataService apiMetaDataService, InstrumentContext pluginContext, String targetClassName) {
- this(profilerConfig, traceContext, dataSourceMonitorRegistry, apiMetaDataService, pluginContext, targetClassName, null);
+ public DefaultClassFileTransformerBuilder(ProfilerConfig profilerConfig, TraceContext traceContext, DataSourceMonitorRegistry dataSourceMonitorRegistry, UriStatMetricRegistry uriStatMetricRegistry, ApiMetaDataService apiMetaDataService, InstrumentContext pluginContext, String targetClassName) {
+ this(profilerConfig, traceContext, dataSourceMonitorRegistry, uriStatMetricRegistry, apiMetaDataService, pluginContext, targetClassName, null);
}
- private DefaultClassFileTransformerBuilder(ProfilerConfig profilerConfig, TraceContext traceContext, DataSourceMonitorRegistry dataSourceMonitorRegistry, ApiMetaDataService apiMetaDataService,
+ private DefaultClassFileTransformerBuilder(ProfilerConfig profilerConfig, TraceContext traceContext, DataSourceMonitorRegistry dataSourceMonitorRegistry, UriStatMetricRegistry uriStatMetricRegistry, ApiMetaDataService apiMetaDataService,
InstrumentContext pluginContext, String targetClassName, ClassCondition condition) {
if (profilerConfig == null) {
throw new NullPointerException("profilerConfig must not be null");
@@ -55,9 +57,14 @@ private DefaultClassFileTransformerBuilder(ProfilerConfig profilerConfig, TraceC
if (pluginContext == null) {
throw new NullPointerException("pluginContext must not be null");
}
+ if (uriStatMetricRegistry == null) {
+ throw new NullPointerException("uriStatMetricRegistry must not be null");
+ }
this.profilerConfig = profilerConfig;
this.traceContext = traceContext;
this.dataSourceMonitorRegistry = dataSourceMonitorRegistry;
+ this.uriStatMetricRegistry = uriStatMetricRegistry;
+
this.apiMetaDataService = apiMetaDataService;
this.pluginContext = pluginContext;
@@ -67,7 +74,7 @@ private DefaultClassFileTransformerBuilder(ProfilerConfig profilerConfig, TraceC
@Override
public void conditional(ClassCondition condition, ConditionalClassFileTransformerSetup describer) {
- DefaultClassFileTransformerBuilder conditional = new DefaultClassFileTransformerBuilder(profilerConfig, traceContext, dataSourceMonitorRegistry, apiMetaDataService, pluginContext, targetClassName, condition);
+ DefaultClassFileTransformerBuilder conditional = new DefaultClassFileTransformerBuilder(profilerConfig, traceContext, dataSourceMonitorRegistry, uriStatMetricRegistry, apiMetaDataService, pluginContext, targetClassName, condition);
describer.setup(conditional);
recipeBuilders.add(conditional);
}
@@ -179,7 +186,7 @@ public void setScope(String scopeName, ExecutionPolicy point) {
@Override
public ClassRecipe buildRecipe() {
- return new TargetAnnotatedInterceptorInjector(profilerConfig, traceContext, dataSourceMonitorRegistry, apiMetaDataService, pluginContext, interceptorClassName, constructorArguments, scopeName, executionPoint);
+ return new TargetAnnotatedInterceptorInjector(profilerConfig, traceContext, dataSourceMonitorRegistry, uriStatMetricRegistry, apiMetaDataService, pluginContext, interceptorClassName, constructorArguments, scopeName, executionPoint);
}
}