Search in sources :

Example 21 with MetricNameFormat

use of com.newrelic.agent.tracers.metricname.MetricNameFormat in project newrelic-java-agent by newrelic.

the class NormalizedTransactionTrace method testNormalizedTransactionTraceTest.

@SuppressWarnings({ "unchecked", "serial" })
@Test
public void testNormalizedTransactionTraceTest() {
    final JSONArray rulesData = new JSONArray();
    rulesData.addAll(Arrays.asList(new JSONObject() {

        {
            put("match_expression", "/amq.([0-9]*)$");
            put("replacement", "/amq.*");
            put("eval_order", 1);
        }
    }));
    setUrlRules(rulesData);
    Transaction txn = Transaction.getTransaction();
    ClassMethodSignature sig = new ClassMethodSignature("", "", "");
    MetricNameFormat format = new SimpleMetricNameFormat("");
    Tracer tracer = new OtherRootTracer(txn, sig, this, format);
    txn.getTransactionActivity().tracerStarted(tracer);
    MockDispatcher dispatcher = new MockDispatcher();
    txn.setDispatcher(dispatcher);
    txn.setTransactionName(TransactionNamePriority.FRAMEWORK_HIGH, false, "TEST", "/amq.1234567831415");
    tracer.finish(Opcodes.ARETURN, null);
    Assert.assertEquals("/amq.*", txn.getPriorityTransactionName().getPartialName());
}
Also used : JSONObject(org.json.simple.JSONObject) Transaction(com.newrelic.agent.Transaction) ClassMethodSignature(com.newrelic.agent.tracers.ClassMethodSignature) Tracer(com.newrelic.agent.tracers.Tracer) OtherRootTracer(com.newrelic.agent.tracers.OtherRootTracer) JSONArray(org.json.simple.JSONArray) MockDispatcher(com.newrelic.agent.MockDispatcher) SimpleMetricNameFormat(com.newrelic.agent.tracers.metricname.SimpleMetricNameFormat) MetricNameFormat(com.newrelic.agent.tracers.metricname.MetricNameFormat) SimpleMetricNameFormat(com.newrelic.agent.tracers.metricname.SimpleMetricNameFormat) OtherRootTracer(com.newrelic.agent.tracers.OtherRootTracer) Test(org.junit.Test)

Aggregations

MetricNameFormat (com.newrelic.agent.tracers.metricname.MetricNameFormat)21 ClassMethodSignature (com.newrelic.agent.tracers.ClassMethodSignature)13 OtherRootTracer (com.newrelic.agent.tracers.OtherRootTracer)12 Tracer (com.newrelic.agent.tracers.Tracer)11 DefaultTracer (com.newrelic.agent.tracers.DefaultTracer)10 Transaction (com.newrelic.agent.Transaction)8 DefaultSqlTracer (com.newrelic.agent.tracers.DefaultSqlTracer)8 OtherRootSqlTracer (com.newrelic.agent.tracers.OtherRootSqlTracer)8 UltraLightTracer (com.newrelic.agent.tracers.UltraLightTracer)8 SimpleMetricNameFormat (com.newrelic.agent.tracers.metricname.SimpleMetricNameFormat)7 Test (org.junit.Test)7 ExitTracer (com.newrelic.agent.bridge.ExitTracer)6 AgentBridge (com.newrelic.agent.bridge.AgentBridge)4 NoOpTransaction (com.newrelic.agent.bridge.NoOpTransaction)4 TransactionActivity (com.newrelic.agent.TransactionActivity)3 ClassMethodMetricNameFormat (com.newrelic.agent.tracers.metricname.ClassMethodMetricNameFormat)3 DefaultMetricNameFormat (com.newrelic.agent.tracers.metricname.DefaultMetricNameFormat)3 SkipTracer (com.newrelic.agent.tracers.SkipTracer)2 BasicRequestRootTracer (com.newrelic.agent.tracers.servlet.BasicRequestRootTracer)2 JSONObject (org.json.simple.JSONObject)2