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 to select certain hours every day in NR Insights?


#1

Hi
Is possible, for example to select a response time only from 5am to 6am every day in the query

SELECT percentile(duration * 1000, 95) AS ‘Response time’ FROM Transaction WHERE (name = ‘WebTransaction/login (POST)’) From 5am to 6am TIMESERIES SINCE 1 day ago COMPARE WITH 1 week ago EXTRAPOLATE


#2

Hi, @Di.Feng: Try WHERE hourOf(timestamp) = '05:00'.


#3

Hi, any use of hourof, monthof, etc results in a NaN error. As simple as “SELECT monthOf(timestamp) FROM SyntheticCheck” does not work. “SELECT timestamp FROM SyntheticCheck” works just fine. Using these date functions in a where clause same results. Any ideas?

Thanks


#4

Hi, @beheer: Generally, the hourOf(), monthOf(), etc. functions are used to facet a value by time or day, for example:

SELECT average(duration) 
FROM SyntheticCheck 
FACET hourOf(timestamp) 
SINCE 1 week ago

Can you provide some more information about what you are trying to accomplish?


#5

Hi,

What I am trying to do is filter results by time of day. I have results from all day, and want to filter out the results from busy hours. So someting like Select someting from Syntheticcheck where hourOf(timestamp) In (10,11,12).


#6

Unfortunately, I think my reply above is incorrect: I don’t think you can use the result of a function in a WHERE clause.


#7

Could I use it in a filter somehow?


#8

Ah, correction: You can use hourOf(timestamp) in a WHERE clause, but the hour is a string. Try this:

SELECT average(duration) 
FROM SyntheticCheck 
WHERE hourOf(timestamp) IN ('10:00', '11:00', '12:00') 
SINCE 1 day ago