use of com.newrelic.api.agent.ExternalParameters in project newrelic-java-agent by newrelic.
the class MuleUtils method reportToAgent.
/**
* Called inbound when using Http Transport. Verify this is consistent with usages of MuleHttpConnectorRequest in
* the mule-3.6 and mule-3.7 modules.
*/
public static void reportToAgent(final MuleEvent muleEvent) {
if (muleEvent == null) {
NewRelic.getAgent().getLogger().log(Level.FINE, "MuleUtils#reportToAgent muleEvent is null");
return;
}
MuleMessage message = muleEvent.getMessage();
if (message == null) {
NewRelic.getAgent().getLogger().log(Level.FINE, "MuleUtils#reportToAgent muleEvent.message is null");
return;
}
final MuleHttpTransportRequest muleRequest = new MuleHttpTransportRequest(message);
ExternalParameters params;
try {
URI uri = new URI(muleRequest.getRequestURI());
params = HttpParameters.library("MuleHTTP").uri(uri).procedure("writeResponse").inboundHeaders(muleRequest).build();
} catch (URISyntaxException uriSyntaxException) {
params = HttpParameters.library("MuleHTTP").uri(UNKNOWN_HOST_URI).procedure("writeResponse").inboundHeaders(muleRequest).build();
}
NewRelic.getAgent().getTracedMethod().reportAsExternal(params);
final Transaction txn = AgentBridge.getAgent().getTransaction(false);
txn.setWebRequest(muleRequest);
final String txnName = message.getInboundProperty("http.context.path") + " (" + muleRequest.getMethod() + ")";
txn.setTransactionName(TransactionNamePriority.FRAMEWORK_HIGH, false, "Mule/Transport", txnName);
}
use of com.newrelic.api.agent.ExternalParameters in project newrelic-java-agent by newrelic.
the class DefaultTracerTest method testInstanceButNoPortSupportabilityMetrics.
@Test
public void testInstanceButNoPortSupportabilityMetrics() {
DefaultTracer tracer = prepareTracer();
String product = "Product";
ExternalParameters parameters = DatastoreParameters.product(product).collection("Collection").operation("operation").instance("myHost", "instanceId").databaseName("databaseName").build();
tracer.reportAsExternal(parameters);
tracer.finish(0, null);
checkUnknownDatastoreSupportabilityMetrics("Product", 0, 0, 0);
}
use of com.newrelic.api.agent.ExternalParameters in project newrelic-java-agent by newrelic.
the class DatastoreInstanceCrossAgentTests method runTest.
@Test
public void runTest() {
// Setup system host
DatastoreMetrics.setHostname(test.getSystemHostname());
DefaultTracer tracer = createTracerInTransaction();
ExternalParameters parameters = null;
if (test.getPort() != null) {
parameters = DatastoreParameters.product(test.getProduct()).collection(test.getProduct()).operation("operation").instance(test.getDbHostname(), test.getPort()).build();
} else {
parameters = DatastoreParameters.product(test.getProduct()).collection("collection").operation("operation").instance(test.getDbHostname(), test.getDbPath() != null ? test.getDbPath() : test.getUnixSocket()).databaseName("databaseName").slowQuery("raw query", null).build();
}
tracer.reportAsExternal(parameters);
tracer.finish(Opcodes.ARETURN, null);
Set<String> rollupMetricNames = tracer.getRollupMetricNames();
assertTrue(MessageFormat.format("Could not find instance metric {0}", test.getExpectedInstanceMetric()), rollupMetricNames.contains(test.getExpectedInstanceMetric()));
}
Aggregations