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

How can I record my all real-time data from New Relic Custom Event

insights
mobileapp
real-time-database

#1

Hello,

My name is Thong, i’m a mobile developer, right now i have a question about using New Relic Ingsights.
I want to saving real-time data from my apps to NewRelic Insights, like FireBase database. I tried to use NewRelic.recordCustomEvent to record my custom data, but it’s not real-time, i have to wait 5-10 minutes the data must push to NewRelic Insights. And when I want to export to .csv file to save data to another computer, the data have been recorded within 5 latest minutes since i export the .csv file, i want to save all data from the NewRelic Insights dashboard.
Can you guys show me how to export all of data from my NewRelic Insights custom dashboard and make the data real-time?? Help me!


#2

Hi @thong,

I understand you would like to see your custom events reported to the dashboard in realtime. I believe the best solution would be to adjust the harvest cycle for the mobile agent . The default for the agent’s harvest cycle is 600 seconds, but that can be manually adjusted within your application to collect data more frequently.

In iOS, you can background the app to force a harvest of events, and additional payloads, like crash data, are sent upon terminating and restarting the app.

For Android, backgrounding the app will send event data, but crash data is sent when crashes occur, unlike iOS, the app does not require a relaunch to send that data.

Below, I’ve linked some documentation outlining how to adjust your harvest cycle’s setMaxEventBufferTime for both iOS and Android. Please let me know if you have any other questions.

iOS - https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile-ios/ios-sdk-api/set-max-event-buffer-time

Android - https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile-android/android-sdk-api/set-max-event-buffer-time

-Danyel


#3

Thank you so much @dmurray !

This is really helpful for me!

I have another questions, like you see if i want to export the .csv file to export to the record data file, i just save the data within 5 latest minutes data and no more. I want to save all data corresponding to my query, like when i query to show the data in 1 day, i want to see all the data of that day, not just only in 5 minutes.

And if i want to stop logging, i tried NewRelic.withLoggingEnable( false) and change the logging level by using NewRelic.withLogLevel( ERROR) but the Insights still log the data from RecordCustomEvent , i don’t know how to stop or prevent NewRelic from logging more event to the Insights event

And agains, thank you so much

Thong


#4

Hi @thong,

Thanks for your response! In order to assist better with your insights .csv export, it would be helpful to know what query you are using. Can you share a link to the dashboard you are trying to export data from? Can you provide the query you are using? It sounds like you are wanting to export data from at least a day or more. The time window for you data viewed in Insights can be adjusted in the NRQL query. Here is a document of example NRQL queries for mobile: https://docs.newrelic.com/docs/insights/nrql-new-relic-query-language/nrql-query-examples/insights-query-examples-new-relic-mobile

NewRelic.withLoggingEnable(false) is a feature flag for the mobile agent’s external logging. All events will be recorded in Insights completely independent of this flag, but you will only see errors in your app’s runtime log. Here is some additional information about setting the agents feature flags and logging levels: https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile-android/api-guides/android-agent-configuration-feature-flags

I hope this helps, and I will look forward to hearing back from you!

-Danyel


#5

Hi @dmurray,

Thanks for your support! It’s really helpful with me!!

Although I used “SINCE 1 week ago” for my query , it’s still have about 100 data when i export to .csv file. Please help me to resolve this problem.

About prevent logging in New Relic, thank you for your help. I can fix this by using NewRelic.withLoggingEnable(false) as your guide. Thank you very much!

best regards,
Thong


#6

Hi @thong

By default, all NRQL queries return 10 results (or 100 for * queries). Employing the LIMIT clause in your NRQL query will allow you to specify the exact number of results you want to see - from 1 to 1,000. There is a hard 1,000 results limit on all NRQL queries. Just add the LIMIT clause to your next NRQL query to test it out.

For example, this query shows the top 20 countries by session count and provides 95th percentile of response time for each country for Windows users only:

SELECT uniqueCount(session), percentile(duration, 95)
  FROM PageView WHERE userAgentOS = 'Windows'
  FACET countryCode LIMIT 20 SINCE YESTERDAY

I hope this helps!

-Danyel


#7

Hi @dmurray

I did it!
Thanks a lot for what you do for me !! It really helpfull with me!!

Thank you again,
Best regards,
Thong