diff --git a/instrumentation-security/netty-reactor-0.7.0/src/main/java/reactor/ipc/netty/http/server/HttpRouteHandler_Instrumentation.java b/instrumentation-security/netty-reactor-0.7.0/src/main/java/reactor/ipc/netty/http/server/HttpRouteHandler_Instrumentation.java index 17e74c5bd..12fd474cc 100644 --- a/instrumentation-security/netty-reactor-0.7.0/src/main/java/reactor/ipc/netty/http/server/HttpRouteHandler_Instrumentation.java +++ b/instrumentation-security/netty-reactor-0.7.0/src/main/java/reactor/ipc/netty/http/server/HttpRouteHandler_Instrumentation.java @@ -1,5 +1,9 @@ package reactor.ipc.netty.http.server; +import com.newrelic.api.agent.security.NewRelicSecurity; +import com.newrelic.api.agent.security.instrumentation.helpers.URLMappingsHelper; +import com.newrelic.api.agent.security.schema.Framework; +import com.newrelic.api.agent.security.schema.HttpRequest; import com.newrelic.api.agent.weaver.Weave; import com.newrelic.api.agent.weaver.Weaver; import org.reactivestreams.Publisher; @@ -9,8 +13,17 @@ @Weave(originalName = "reactor.ipc.netty.http.server.DefaultHttpServerRoutes$HttpRouteHandler") final class HttpRouteHandler_Instrumentation { final Predicate condition = Weaver.callOriginal(); + public Publisher apply(HttpServerRequest request, HttpServerResponse response) { - // TODO: Calculate route for endpoints + if (NewRelicSecurity.isHookProcessingActive()){ + HttpRequest securityRequest = NewRelicSecurity.getAgent().getSecurityMetaData().getRequest(); + if (condition instanceof HttpPredicate){ + securityRequest.setRoute(((HttpPredicate) condition).uri); + } else { + securityRequest.setRoute(URLMappingsHelper.WILDCARD); + } + NewRelicSecurity.getAgent().getSecurityMetaData().getMetaData().setFramework(Framework.NETTY_REACTOR); + } return Weaver.callOriginal(); } } diff --git a/instrumentation-security/netty-reactor-0.8.0/src/main/java/reactor/netty/http/server/HttpRouteHandler_Instrumentation.java b/instrumentation-security/netty-reactor-0.8.0/src/main/java/reactor/netty/http/server/HttpRouteHandler_Instrumentation.java index 8d5e2abf3..19146db87 100644 --- a/instrumentation-security/netty-reactor-0.8.0/src/main/java/reactor/netty/http/server/HttpRouteHandler_Instrumentation.java +++ b/instrumentation-security/netty-reactor-0.8.0/src/main/java/reactor/netty/http/server/HttpRouteHandler_Instrumentation.java @@ -1,5 +1,9 @@ package reactor.netty.http.server; +import com.newrelic.api.agent.security.NewRelicSecurity; +import com.newrelic.api.agent.security.instrumentation.helpers.URLMappingsHelper; +import com.newrelic.api.agent.security.schema.Framework; +import com.newrelic.api.agent.security.schema.HttpRequest; import com.newrelic.api.agent.weaver.Weave; import com.newrelic.api.agent.weaver.Weaver; import org.reactivestreams.Publisher; @@ -9,8 +13,17 @@ @Weave(originalName = "reactor.netty.http.server.DefaultHttpServerRoutes$HttpRouteHandler") final class HttpRouteHandler_Instrumentation { final Predicate condition = Weaver.callOriginal(); + public Publisher apply(HttpServerRequest request, HttpServerResponse response) { - // TODO: Calculate route for endpoints + if (NewRelicSecurity.isHookProcessingActive()){ + HttpRequest securityRequest = NewRelicSecurity.getAgent().getSecurityMetaData().getRequest(); + if (condition instanceof HttpPredicate){ + securityRequest.setRoute(((HttpPredicate) condition).uri); + } else { + securityRequest.setRoute(URLMappingsHelper.WILDCARD); + } + NewRelicSecurity.getAgent().getSecurityMetaData().getMetaData().setFramework(Framework.NETTY_REACTOR); + } return Weaver.callOriginal(); } }