Search in sources :

Example 1 with NewRelicTransaction

use of ratpack.newrelic.NewRelicTransaction in project ratpack by ratpack.

the class NewRelicExecInterceptor method intercept.

@Override
@Trace(dispatcher = true)
public void intercept(Execution execution, ExecType execType, Block executionSegment) throws Exception {
    execution.maybeGet(Context.class).ifPresent(context -> {
        NewRelicTransaction transaction = execution.maybeGet(NewRelicTransaction.class).orElse(null);
        if (transaction == null) {
            transaction = new DefaultNewRelicTransaction(context);
            execution.add(NewRelicTransaction.class, transaction);
        }
        transaction.init();
    });
    executionSegment.execute();
}
Also used : Context(ratpack.handling.Context) NewRelicTransaction(ratpack.newrelic.NewRelicTransaction) Trace(com.newrelic.api.agent.Trace)

Aggregations

Trace (com.newrelic.api.agent.Trace)1 Context (ratpack.handling.Context)1 NewRelicTransaction (ratpack.newrelic.NewRelicTransaction)1