generated from newrelic-experimental/java-instrumentation-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
corrected problems that were causing two extensions to load when only…
… one should
- Loading branch information
Showing
27 changed files
with
217 additions
and
314 deletions.
There are no files selected for viewing
29 changes: 0 additions & 29 deletions
29
camel-core-3.18/src/main/java/com/nr/instrumentation/apache/camel/NRSynchronization.java
This file was deleted.
Oops, something went wrong.
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
23 changes: 0 additions & 23 deletions
23
camel-core-3.18/src/main/java/org/apache/camel/BatchConsumer.java
This file was deleted.
Oops, something went wrong.
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
50 changes: 50 additions & 0 deletions
50
camel-core-3.18/src/main/java/org/apache/camel/component/file/GenericFileConsumer.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 @@ | ||
package org.apache.camel.component.file; | ||
|
||
import java.util.HashMap; | ||
import java.util.Queue; | ||
|
||
import org.apache.camel.Processor; | ||
import org.apache.camel.support.ScheduledBatchPollingConsumer; | ||
|
||
import com.newrelic.api.agent.NewRelic; | ||
import com.newrelic.api.agent.Trace; | ||
import com.newrelic.api.agent.TransactionNamePriority; | ||
import com.newrelic.api.agent.weaver.MatchType; | ||
import com.newrelic.api.agent.weaver.Weave; | ||
import com.newrelic.api.agent.weaver.Weaver; | ||
import com.nr.instrumentation.apache.camel.Util; | ||
|
||
@Weave(type = MatchType.BaseClass) | ||
public abstract class GenericFileConsumer<T> extends ScheduledBatchPollingConsumer { | ||
|
||
protected GenericFileEndpoint<T> endpoint = Weaver.callOriginal(); | ||
|
||
|
||
public GenericFileConsumer(GenericFileEndpoint<T> endpoint, Processor processor, GenericFileOperations<T> operations, GenericFileProcessStrategy<T> processStrategy) { | ||
super( endpoint, processor); | ||
} | ||
|
||
@Trace(dispatcher = true) | ||
public int processBatch(Queue<Object> exchanges) { | ||
HashMap<String, Object> attributes = new HashMap<>(); | ||
int numToProcess = exchanges.size(); | ||
if(numToProcess == 0) { | ||
NewRelic.getAgent().getTransaction().ignore(); | ||
} else { | ||
NewRelic.getAgent().getTracedMethod().setMetricName(new String[] {"Custom","Camel",getClass().getName(),"processBatch"}); | ||
Util.recordValue(attributes, "RouteId", getRouteId()); | ||
Util.recordValue(attributes, "InputQueueSize", numToProcess); | ||
String routeId = getRouteId(); | ||
|
||
NewRelic.getAgent().getTransaction().setTransactionName(TransactionNamePriority.FRAMEWORK_LOW, true,"CamelFileConsumer", new String[] {"CamelFileConsumer", routeId != null ? getRouteId() : endpoint.toString()}); | ||
} | ||
|
||
|
||
int result=Weaver.callOriginal(); | ||
Util.recordValue(attributes, "NumbertOfBatchProcessed", result); | ||
NewRelic.getAgent().getTracedMethod().addCustomAttributes(attributes); | ||
|
||
return result; | ||
} | ||
} | ||
|
29 changes: 0 additions & 29 deletions
29
camel-core-3.9/src/main/java/com/nr/instrumentation/apache/camel/NRSynchronization.java
This file was deleted.
Oops, something went wrong.
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
23 changes: 0 additions & 23 deletions
23
camel-core-3.9/src/main/java/org/apache/camel/BatchConsumer.java
This file was deleted.
Oops, something went wrong.
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
50 changes: 50 additions & 0 deletions
50
camel-core-3.9/src/main/java/org/apache/camel/component/file/GenericFileConsumer.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 @@ | ||
package org.apache.camel.component.file; | ||
|
||
import java.util.HashMap; | ||
import java.util.Queue; | ||
|
||
import org.apache.camel.Processor; | ||
import org.apache.camel.support.ScheduledBatchPollingConsumer; | ||
|
||
import com.newrelic.api.agent.NewRelic; | ||
import com.newrelic.api.agent.Trace; | ||
import com.newrelic.api.agent.TransactionNamePriority; | ||
import com.newrelic.api.agent.weaver.MatchType; | ||
import com.newrelic.api.agent.weaver.Weave; | ||
import com.newrelic.api.agent.weaver.Weaver; | ||
import com.nr.instrumentation.apache.camel.Util; | ||
|
||
@Weave(type = MatchType.BaseClass) | ||
public abstract class GenericFileConsumer<T> extends ScheduledBatchPollingConsumer { | ||
|
||
protected GenericFileEndpoint<T> endpoint = Weaver.callOriginal(); | ||
|
||
|
||
public GenericFileConsumer(GenericFileEndpoint<T> endpoint, Processor processor, GenericFileOperations<T> operations, GenericFileProcessStrategy<T> processStrategy) { | ||
super( endpoint, processor); | ||
} | ||
|
||
@Trace(dispatcher = true) | ||
public int processBatch(Queue<Object> exchanges) { | ||
HashMap<String, Object> attributes = new HashMap<>(); | ||
int numToProcess = exchanges.size(); | ||
if(numToProcess == 0) { | ||
NewRelic.getAgent().getTransaction().ignore(); | ||
} else { | ||
NewRelic.getAgent().getTracedMethod().setMetricName(new String[] {"Custom","Camel",getClass().getName(),"processBatch"}); | ||
Util.recordValue(attributes, "RouteId", getRouteId()); | ||
Util.recordValue(attributes, "InputQueueSize", numToProcess); | ||
String routeId = getRouteId(); | ||
|
||
NewRelic.getAgent().getTransaction().setTransactionName(TransactionNamePriority.FRAMEWORK_LOW, true,"CamelFileConsumer", new String[] {"CamelFileConsumer", routeId != null ? getRouteId() : endpoint.toString()}); | ||
} | ||
|
||
|
||
int result=Weaver.callOriginal(); | ||
Util.recordValue(attributes, "NumbertOfBatchProcessed", result); | ||
NewRelic.getAgent().getTracedMethod().addCustomAttributes(attributes); | ||
|
||
return result; | ||
} | ||
} | ||
|
29 changes: 0 additions & 29 deletions
29
camel-core-4.0.0/src/main/java/com/nr/instrumentation/apache/camel/NRSynchronization.java
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -54,4 +54,4 @@ public void run() { | |
} | ||
} | ||
|
||
} | ||
} |
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.