Feature Idea: Custom Event with custom date field


I am struggling to find examples to write a date time field to a custom event. I have read that you could use the current timestamp field to allow for querying however I am unable to get this to work as well. I would like to use the timestamp in calculation do a graph representing a request per tier.

Currently I am able to store a custom date but only as a string field which doesn’t help me in our custom dashboard.

Any assistance would be greatly appreciated.

I am using .NET framework with the agent version: 8D98D7C9-E71C-4D19-A011-B86BC46CBC02

New Relic Edit

  • I want this too
  • I have more info to share (reply below)
  • I have a solution for this

0 voters

We take feature ideas seriously and our product managers review every one when plotting their roadmaps. However, there is no guarantee this feature will be implemented. This post ensures the idea is put on the table and discussed though. So please vote and share your extra details with our team.

Hi @mohamed.bray - You need to send thedates as an unformatted Unix timestamp. You then use the Data Formatter in Insights to change the display.

Thanks this has helped me move forward. I am now receiving the data in insights. I failed to cast it as a Single as well once I updated my code to do that I was able to format the data as a timestamp


Thanks for that answer @stefan_garnham!

@mohamed.bray if you have any more questions, please let me know.

Surely if you cast to a Single it will lose second precision from about 6 months into 1970 it will cease to be accurate to withing 1s. Using dates around now 2020 say the resolution will be in the order of about 2 minutes. Surely this is a waste of time?
There has to be a better way to send a timestamp?

@simon.pettman -

The limitation is with the .NET agent API RecordCustomEvent call. It only allows strings and singles as event attributes.

A workaround would be to use the Insights custom event API directly which does allow integer values as event attributes. See https://docs.newrelic.com/docs/insights/insights-data-sources/custom-data/introduction-event-api.

1 Like

@simon.pettman -

We added a feature idea poll above for extending RecordCustomEvent to support integer values. This would useful for any number of scenarios including accurate timestamps.

1 Like

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