APM Java Agent : No instrumentation/response from public api


(BSP) #1

Hi There,
I was trying with public API of APM to get response for my custom class but I don't see any such information on Kibana or instrumentation details on APM java agent log.
Not sure what I am doing wrong. I had tried with @CaptureTransaction .
In this method I am intentionally throwing a null pointer exception to see it in Kibana.
@Override
public String getTestName() {
Transaction transaction = ElasticApm.startTransaction();
String a=null;
try(final Scope scope = transaction.activate())
{
transaction.setName("CustomUserBOPreferencesExtensionImpl#TestName");
transaction.setType(Transaction.TYPE_REQUEST);

        return a.toString();
    }
    catch (Exception e) {
        transaction.captureException(e);
        throw e;
    } finally {
        transaction.end();
    }

}

(Felix Barnsteiner) #2

Hi and thanks for trying out Elastic APM :slight_smile:

Have you added the agent as a -javaagent flag? This is required even when using the public API.

Cheers,
Felix


(system) closed #3

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.