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

Current Active users/sessions as a number/count



I have used this nrql query

SELECT uniquecount(session) FROM PageView WHERE appName = ‘appName’ since 10 minutes ago

to get the sessions created in last 10 min but I am looking for the current Active users as a number, not as time series that I can get from pre defined metrics

Active Users as a Number


Here is the NRQL I used to get the no of sessions from last 10 minutes.

SELECT uniquecount(session) FROM PageView WHERE appName = ‘iRePORT (PROD)’ since 10 minutes ago
this gives me the new sessions created in last 10 minutes but, I am looking for the number of active users/sessions currently.

Just as a count not as a series that I can get in Metrics.



Hey @SaiRam! It appears you posted this questions twice. I went ahead and moved them into the same thread so we can get a targeted answer and information on this doesn’t spread out. :blush:

Hopefully someone will be along soon to help with your Insights question!


The query you posted doesn’t include a timeseries statement and should be just a number.

This part needs clarification.


I meant there are pre defined metrics with time series. I want just the count of active users at current.


Your query returns a number. You have to decide what makes a session “active” if you don’t simply assume activity in the last 10 minutes qualifies them as “active”.


how many people currently are on my site?


So, you need to decide how you decide from what you see in the data you have in new relic tells you those people are “on your site”. Get what I mean?


Isn’t there any query that gives the count?


Actually, I am just looking for the Current users count on the site using NRQL.
I need help with the query.


How do you define “current user”?

I have 30 tabs open on my browser. They have been open for 6 hours. Am I a current user on all 30?


if you are on the site for 6 hours, still you are a current user and based on the uniquecount(session) I believe new relic consider 30 tabs as 1?

If I am on site for 6 hours using 3 different browsers, the current users are 3?

As long as you are on the site, you are a current user.It doesn’t matter how many hours, as long as you on the site with one session, you consider as current


Ok, so you want to identify the users with uniquecount(session) from ? Browserinteraction? Ajaxrequest? Pageview? What time window? What tells you that a session started 6 hours ago ended 20 minutes ago?


yes but I need a NRQL query, that just give number of current users.
as I defined the current users that how many on site regardless of time.


Do you think you can get close to writing an NRQL query based on the points discussed so far?

Do you need to exclude sessions from synthetic monitors or similar?


I believe so. But isn’t there any pre defined metric for that?


No, there is no predefined metric for current users.


Where u able to plot any query for your requirement?


Hey @Tulsan.Kapil - I think @SaiRam’s original query was probably the closest we can get with out of the box attributes. Custom attributes can probably help you get that metric in a better way, however out of the box you can query on the Session count.

SELECT uniqueCount(session) FROM PageView WHERE appName = ‘appName’ since 10 minutes ago