Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Can custom event for Insight API not working due to 'java.endorsed.dir' property?

insights
api

#1

I really wonder ‘java.endorsed.dir’ can cause issue with insight api custom event.
however, transaction with @Trace annotation works fine.

I have couple of warning messages when new relic agent is enabled.

WARN: The ‘java.endorsed.dirs’ system property is set for this jvm. This may cause unexpected behavior.
com.newrelic.agent.deps.org.reflections.Reflections
WARN: given scan urls are empty. set urls in the configuration

  • Java-agent version is 4.7.0
  • Java 8
  • jbossws-cxf-client-4.2.3.Final

With above conditions, my custom event for insight API never worked.
However, when I tested with minimal dependencies (only newrelic-api and newrelic-agent), everything worked fine.
is transaction uses different way to communicate new relic APM api?
Following link is snapshot when custom event was finally worked


#2

Hi @rocky.lee,

Can you tell us which of these API methods you have in-place to send these custom events? Are you using - Record a custom event via the agent or Send custom events with the Event API .
Also, kindly provide us a code snippet of how you’re sending those custom events.

Regards,
B. I.


#3

So I believe I used agent to send event to new relic.

eventAttributes = new HashMap<>();
eventAttributes.put("ACCOUNT", 100);
eventAttributes.put("TEXT", "TEST2");
NewRelic.getAgent().getInsights().recordCustomEvent("MyCustomEvent2", eventAttributes);

Which i think should end up in creating event by hitting event rest API?


#4

Need more details? @bidahor


#5

@bidahor, It looks like due to timing issue. I just run above code in main class which has very short running time.
Once I waited enough time, custom event is available in new relic.

try{
        Thread.sleep(650000);
    }
    catch (InterruptedException ie) {
        System.out.println("=====");
    }

Is there a way to send out all remaining events in the memory at the time of termination?
We are tyring to use new relic custom event to monitor batch process rather than long running web service.


#6

Hi, @rocky.lee: Rather than sending the custom event via the agent (which waits up to one minute before uploading its collected data), you might try calling the Event API directly. That will post the event directly to Insights, rather than waiting for the Java agent’s collector cycle.