generated from newrelic-experimental/java-instrumentation-template
-
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.
Merge pull request #1 from newrelic-experimental/initial
Initial
- Loading branch information
Showing
40 changed files
with
1,520 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,3 +1,9 @@ | ||
.java-version | ||
.git | ||
.github | ||
build | ||
bin | ||
.classpath | ||
.project | ||
.settings | ||
lib |
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,33 @@ | ||
|
||
// Build.gradle generated for instrumentation module fabric-runtime | ||
|
||
apply plugin: 'java' | ||
|
||
dependencies { | ||
implementation 'javax.servlet:servlet-api:2.5' | ||
compileOnly group: 'javax', name: 'javaee-api', version: '6.0' | ||
|
||
// New Relic Java Agent dependencies | ||
implementation 'com.newrelic.agent.java:newrelic-agent:6.4.0' | ||
implementation 'com.newrelic.agent.java:newrelic-api:6.4.0' | ||
implementation fileTree(include: ['*.jar'], dir: '../libs') | ||
implementation fileTree(include: ['*.jar'], dir: 'lib') | ||
implementation fileTree(include: ['*.jar'], dir: '../test-lib') | ||
} | ||
|
||
jar { | ||
manifest { | ||
attributes 'Implementation-Title': 'com.newrelic.instrumentation.labs.fabric-runtime' | ||
attributes 'Implementation-Vendor': 'New Relic Labs' | ||
attributes 'Implementation-Vendor-Id': 'com.newrelic.labs' | ||
attributes 'Implementation-Version': 1.0 | ||
} | ||
} | ||
|
||
verifyInstrumentation { | ||
// Verifier plugin documentation: | ||
// https://github.com/newrelic/newrelic-gradle-verify-instrumentation | ||
// Example: | ||
// passes 'javax.servlet:servlet-api:[2.2,2.5]' | ||
// exclude 'javax.servlet:servlet-api:2.4.public_draft' | ||
} |
23 changes: 23 additions & 0 deletions
23
...untime/src/main/java/com/newrelic/instrumentation/labs/fabric/runtime/FabricPathInfo.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 @@ | ||
package com.newrelic.instrumentation.labs.fabric.runtime; | ||
|
||
public class FabricPathInfo { | ||
|
||
private String dn; | ||
private String serviceName; | ||
|
||
public FabricPathInfo(String dn, String serviceName) { | ||
super(); | ||
this.dn = dn; | ||
this.serviceName = serviceName; | ||
} | ||
|
||
public String getDn() { | ||
return dn; | ||
} | ||
|
||
public String getServiceName() { | ||
return serviceName; | ||
} | ||
|
||
|
||
} |
32 changes: 32 additions & 0 deletions
32
...me/src/main/java/com/newrelic/instrumentation/labs/fabric/runtime/FabricRuntimeUtils.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,32 @@ | ||
package com.newrelic.instrumentation.labs.fabric.runtime; | ||
|
||
import oracle.integration.platform.blocks.PathInfo; | ||
import oracle.integration.platform.blocks.soap.WebServiceEntryBindingComponent; | ||
|
||
public class FabricRuntimeUtils { | ||
|
||
|
||
public static FabricPathInfo getServiceName(String pathInfo, WebServiceEntryBindingComponent wsEntryBC) { | ||
if(pathInfo == null || pathInfo.isEmpty()) return null; | ||
|
||
String temp = pathInfo.startsWith("/") ? pathInfo.substring(1) : pathInfo; | ||
String[] path = temp.split("/"); | ||
if(path.length == 0) return null; | ||
|
||
if(path.length == 1) { | ||
PathInfo info = wsEntryBC.getCustomPath(pathInfo); | ||
if(info != null) { | ||
return new FabricPathInfo(info.getCompositeName(), info.getService()); | ||
} | ||
} else { | ||
String dn = path[0] + '/' + path[1]; | ||
String serviceName = path.length == 3 ? path[2] : null; | ||
return new FabricPathInfo(dn, serviceName); | ||
} | ||
|
||
|
||
|
||
return null; | ||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
fabric-runtime/src/main/java/oracle/integration/platform/blocks/mesh/MeshImpl.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,37 @@ | ||
package oracle.integration.platform.blocks.mesh; | ||
|
||
|
||
import com.newrelic.api.agent.NewRelic; | ||
import com.newrelic.api.agent.Trace; | ||
import com.newrelic.api.agent.weaver.Weave; | ||
import com.newrelic.api.agent.weaver.Weaver; | ||
|
||
import oracle.fabric.common.InvocationContext; | ||
import oracle.fabric.common.NormalizedMessage; | ||
import oracle.fabric.common.Operation; | ||
|
||
@Weave | ||
public class MeshImpl { | ||
|
||
@Trace | ||
public NormalizedMessage request(NormalizedMessage message, Operation operation, InvocationContext context) { | ||
if(operation != null) { | ||
String opName = operation.getName(); | ||
if(opName != null) { | ||
NewRelic.getAgent().getTracedMethod().setMetricName("Custom","Fabric","Mesh","request",opName); | ||
} | ||
} | ||
return Weaver.callOriginal(); | ||
} | ||
|
||
@Trace | ||
public void post(NormalizedMessage message, Operation operation, InvocationContext context) { | ||
if(operation != null) { | ||
String opName = operation.getName(); | ||
if(opName != null) { | ||
NewRelic.getAgent().getTracedMethod().setMetricName("Custom","Fabric","Mesh","post",opName); | ||
} | ||
} | ||
Weaver.callOriginal(); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
fabric-runtime/src/main/java/oracle/integration/platform/blocks/mesh/MessageHandler.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,40 @@ | ||
package oracle.integration.platform.blocks.mesh; | ||
|
||
import com.newrelic.api.agent.NewRelic; | ||
import com.newrelic.api.agent.Trace; | ||
import com.newrelic.api.agent.weaver.MatchType; | ||
import com.newrelic.api.agent.weaver.Weave; | ||
import com.newrelic.api.agent.weaver.Weaver; | ||
|
||
import oracle.fabric.common.InvocationContext; | ||
import oracle.fabric.common.NormalizedMessage; | ||
import oracle.fabric.common.Operation; | ||
|
||
@Weave(type = MatchType.Interface) | ||
public abstract class MessageHandler { | ||
|
||
@Trace | ||
public NormalizedMessage doCallbackRequest(NormalizedMessage var1, Operation var2, InvocationContext var3) { | ||
NewRelic.getAgent().getTracedMethod().setMetricName("Custom","Fabric","MessageHandler",getClass().getSimpleName(),"doCallbackRequest"); | ||
return Weaver.callOriginal(); | ||
} | ||
|
||
@Trace | ||
public NormalizedMessage doRequest(NormalizedMessage var1, Operation var2, InvocationContext var3) { | ||
NewRelic.getAgent().getTracedMethod().setMetricName("Custom","Fabric","MessageHandler",getClass().getSimpleName(),"doRequest"); | ||
return Weaver.callOriginal(); | ||
} | ||
|
||
@Trace | ||
public void doCallbackPost(NormalizedMessage var1, Operation var2, InvocationContext var3) { | ||
NewRelic.getAgent().getTracedMethod().setMetricName("Custom","Fabric","MessageHandler",getClass().getSimpleName(),"doCallbackPost"); | ||
Weaver.callOriginal(); | ||
} | ||
|
||
@Trace | ||
public void doPost(NormalizedMessage var1, Operation var2, InvocationContext var3) { | ||
NewRelic.getAgent().getTracedMethod().setMetricName("Custom","Fabric","MessageHandler",getClass().getSimpleName(),"doPost"); | ||
Weaver.callOriginal(); | ||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
fabric-runtime/src/main/java/oracle/integration/platform/blocks/mesh/MessageRouter.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,35 @@ | ||
package oracle.integration.platform.blocks.mesh; | ||
|
||
import com.newrelic.api.agent.NewRelic; | ||
import com.newrelic.api.agent.Trace; | ||
import com.newrelic.api.agent.weaver.Weave; | ||
import com.newrelic.api.agent.weaver.Weaver; | ||
|
||
import oracle.fabric.common.InvocationContext; | ||
import oracle.fabric.common.NormalizedMessage; | ||
import oracle.fabric.common.Operation; | ||
|
||
@Weave | ||
public abstract class MessageRouter { | ||
|
||
@Trace | ||
public NormalizedMessage request(NormalizedMessage message, Operation operation, InvocationContext context) { | ||
if(operation != null) { | ||
String opName = operation.getName(); | ||
if(opName != null) { | ||
NewRelic.getAgent().getTracedMethod().setMetricName("Custom","Fabric","MessageRouter","request",opName); | ||
} | ||
} | ||
return Weaver.callOriginal(); | ||
} | ||
|
||
public void post(NormalizedMessage message, Operation operation, InvocationContext context) { | ||
if(operation != null) { | ||
String opName = operation.getName(); | ||
if(opName != null) { | ||
NewRelic.getAgent().getTracedMethod().setMetricName("Custom","Fabric","MessageRouter","post",opName); | ||
} | ||
} | ||
Weaver.callOriginal(); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...-runtime/src/main/java/oracle/integration/platform/blocks/soap/FabricProviderServlet.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,36 @@ | ||
package oracle.integration.platform.blocks.soap; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
import com.newrelic.api.agent.NewRelic; | ||
import com.newrelic.api.agent.Trace; | ||
import com.newrelic.api.agent.TransactionNamePriority; | ||
import com.newrelic.api.agent.weaver.Weave; | ||
import com.newrelic.api.agent.weaver.Weaver; | ||
import com.newrelic.instrumentation.labs.fabric.runtime.FabricPathInfo; | ||
import com.newrelic.instrumentation.labs.fabric.runtime.FabricRuntimeUtils; | ||
|
||
@Weave | ||
public abstract class FabricProviderServlet { | ||
|
||
protected WebServiceEntryBindingComponent wsEntryBC = Weaver.callOriginal(); | ||
|
||
@Trace | ||
protected void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { | ||
Weaver.callOriginal(); | ||
} | ||
|
||
@Trace | ||
protected void doPost(HttpServletRequest request, HttpServletResponse response) { | ||
String pInfo = request.getPathInfo(); | ||
if(pInfo != null) { | ||
FabricPathInfo fInfo = FabricRuntimeUtils.getServiceName(pInfo, wsEntryBC); | ||
if(fInfo != null) { | ||
String tName = fInfo.getServiceName() != null ? fInfo.getDn() + "/" + fInfo.getServiceName() : fInfo.getDn() + "/Unknown"; | ||
NewRelic.getAgent().getTransaction().setTransactionName(TransactionNamePriority.FRAMEWORK_HIGH, false, "Fabric", tName); | ||
} | ||
} | ||
Weaver.callOriginal(); | ||
} | ||
} |
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,34 @@ | ||
|
||
// Build.gradle generated for instrumentation module oracle-as-scheduler | ||
|
||
apply plugin: 'java' | ||
|
||
dependencies { | ||
// Declare a dependency on each JAR you want to instrument | ||
// Example: | ||
// implementation 'javax.servlet:servlet-api:2.5' | ||
|
||
// New Relic Java Agent dependencies | ||
implementation 'com.newrelic.agent.java:newrelic-agent:6.4.0' | ||
implementation 'com.newrelic.agent.java:newrelic-api:6.4.0' | ||
implementation fileTree(include: ['*.jar'], dir: '../libs') | ||
implementation fileTree(include: ['*.jar'], dir: 'lib') | ||
implementation fileTree(include: ['*.jar'], dir: '../test-lib') | ||
} | ||
|
||
jar { | ||
manifest { | ||
attributes 'Implementation-Title': 'com.newrelic.instrumentation.labs.oracle-as-scheduler' | ||
attributes 'Implementation-Vendor': 'New Relic Labs' | ||
attributes 'Implementation-Vendor-Id': 'com.newrelic.labs' | ||
attributes 'Implementation-Version': 1.0 | ||
} | ||
} | ||
|
||
verifyInstrumentation { | ||
// Verifier plugin documentation: | ||
// https://github.com/newrelic/newrelic-gradle-verify-instrumentation | ||
// Example: | ||
// passes 'javax.servlet:servlet-api:[2.2,2.5]' | ||
// exclude 'javax.servlet:servlet-api:2.4.public_draft' | ||
} |
15 changes: 15 additions & 0 deletions
15
...as-scheduler/src/main/java/com/newrelic/instrumentation/labs/job/ws/SchedulerWSUtils.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,15 @@ | ||
package com.newrelic.instrumentation.labs.job.ws; | ||
|
||
import java.util.Map; | ||
|
||
public class SchedulerWSUtils { | ||
|
||
|
||
public static void addAttribute(Map<String, Object> attributes, String key, Object value) { | ||
if(attributes != null && key != null && !key.isEmpty() && value != null) { | ||
attributes.put(key, value); | ||
} | ||
} | ||
|
||
|
||
} |
17 changes: 17 additions & 0 deletions
17
oracle-as-scheduler/src/main/java/oracle/as/scheduler/job/webservice/AsyncWSJob.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,17 @@ | ||
package oracle.as.scheduler.job.webservice; | ||
|
||
import com.newrelic.api.agent.Trace; | ||
import com.newrelic.api.agent.weaver.Weave; | ||
import com.newrelic.api.agent.weaver.Weaver; | ||
|
||
import oracle.as.scheduler.RequestExecutionContext; | ||
import oracle.as.scheduler.RequestParameters; | ||
|
||
@Weave | ||
public abstract class AsyncWSJob { | ||
|
||
@Trace | ||
public void execute(RequestExecutionContext context, RequestParameters params) { | ||
Weaver.callOriginal(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
oracle-as-scheduler/src/main/java/oracle/as/scheduler/job/webservice/OnewayWSJob.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,17 @@ | ||
package oracle.as.scheduler.job.webservice; | ||
|
||
import com.newrelic.api.agent.Trace; | ||
import com.newrelic.api.agent.weaver.Weave; | ||
import com.newrelic.api.agent.weaver.Weaver; | ||
|
||
import oracle.as.scheduler.RequestExecutionContext; | ||
import oracle.as.scheduler.RequestParameters; | ||
|
||
@Weave | ||
public abstract class OnewayWSJob extends WebServiceJob { | ||
|
||
@Trace | ||
public void execute(RequestExecutionContext context, RequestParameters params) { | ||
Weaver.callOriginal(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
oracle-as-scheduler/src/main/java/oracle/as/scheduler/job/webservice/SyncWSJob.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,17 @@ | ||
package oracle.as.scheduler.job.webservice; | ||
|
||
import com.newrelic.api.agent.Trace; | ||
import com.newrelic.api.agent.weaver.Weave; | ||
import com.newrelic.api.agent.weaver.Weaver; | ||
|
||
import oracle.as.scheduler.RequestExecutionContext; | ||
import oracle.as.scheduler.RequestParameters; | ||
|
||
@Weave | ||
public class SyncWSJob { | ||
|
||
@Trace | ||
public void execute(RequestExecutionContext context, RequestParameters params) { | ||
Weaver.callOriginal(); | ||
} | ||
} |
Oops, something went wrong.