Queries for metrics visualizations

Once you've received your app's raw metrics export and familiarized yourself with the raw metrics descriptions, you can start building queries to visualize the metrics in your DataDog or New Relic monitoring tool.

Treat this page as a guide you can use to start setting up visualizations in DataDog and New Relic.

DataDog

Request Data

Total Requests by Region

sum:pubnub.http_status{customer:CUSTOMER} by {region}.as_count()

Total Requests by API

sum:pubnub.http_status{customer:CUSTOMER} by {api}.as_count()

Present Requests/Sec

sum:pubnub.http_status{customer:CUSTOMER} by {region}.as_rate()

Max Requests/Sec per API

top(sum:pubnub.http_status{customer:CUSTOMER} by {api}.as_rate(), 5, 'max', 'desc')

Client Closed Connections (499)

sum:pubnub.http_status{customer:CUSTOMER,status:499} by {api}.as_count()

Client Error Data

Count

sum:pubnub.http_status{customer:CUSTOMER,status_class:4xx,!status:499}.as_count()

Percentage

sum:pubnub.http_status{customer:CUSTOMER,status_class:4xx,!status:499}.as_count()/sum:pubnub.http_status{customer:CUSTOMER,!status_class:5xx}.as_count()*100

Client Errors (4xx) Non 403/499

sum:pubnub.http_status{customer:CUSTOMER,status_class:4xx,!status:499,!status:403} by {api,status}.as_count()

Client Unauthorized Errors (403)

sum:pubnub.http_status{customer:CUSTOMER,status:403} by {api}.as_count()

Messaging: Publish | Subscribe | History | Signals | Message Reactions | File Sharing

Healthy Publishes

sum:pubnub.http_status{customer:CUSTOMER,api:publish,status_class:2xx}.as_count()

Healthy Subscribes

sum:pubnub.http_status{customer:CUSTOMER,api:subscribe,status_class:2xx}.as_count()

Healthy History

sum:pubnub.http_status{customer:CUSTOMER,api:history,status_class:2xx}.as_count()

Healthy Signal Publishes

sum:pubnub.http_status{customer:CUSTOMER,api:signal,status_class:2xx}.as_count()

Healthy Message Reactions

sum:pubnub.http_status{customer:CUSTOMER,api:message-actions,status_class:2xx}.as_count()

Healthy File Sharing Publish

sum:pubnub.http_status{customer:CUSTOMER,api:files.publish-file,status_class:2xx}.as_count()

Presence | Access Manager | Channel Registrations

Healthy Presence Total

sum:pubnub.http_status{customer:CUSTOMER,api:presence,status_class:2xx}.as_count()

Healthy Access Manager Grants

sum:pubnub.http_status{customer:CUSTOMER,api:auth-grant,status_class:2xx}.as_count()

Healthy Channel Registrations

sum:pubnub.http_status{customer:CUSTOMER,api:channel-registration,status_class:2xx} by {status}.as_count()

Server Errors

Server Errors (5xx)

sum:pubnub.http_status{customer:CUSTOMER,status_class:5xx} by {api,status}.as_count()

New Relic

Request Data

Total Requests by Region

SELECT sum(`pubnub.http_status.value`) FROM Metric FACET region

Total Requests by API

SELECT sum(`pubnub.http_status.value`) FROM Metric FACET api

Client Closed Connections (499)

SELECT sum(`pubnub.http_status.value`) FROM Metric where status = 499 FACET api TIMESERIES

Client Error Data

Count

SELECT sum(`pubnub.http_status.value`) FROM Metric where status_class = '4xx' and status NOT IN ('403', '499')

Percentage

SELECT filter(count(*), WHERE status_class = '4xx' and status NOT IN ('403', '499')) / count(*) FROM Metric TIMESERIES

Client Errors (4xx) Non 403/499

SELECT sum(`pubnub.http_status.value`) FROM Metric where status_class = '4xx' and status NOT IN ('403', '499') FACET api, status TIMESERIES

Client Unauthorized Errors (403)

SELECT sum(`pubnub.http_status.value`) FROM Metric where status = '403' FACET api TIMESERIES

Messaging: Publish | Subscribe | History | Signals | Message Reactions | File Sharing

Healthy Publishes

SELECT sum(`pubnub.http_status.value`) FROM Metric where api = 'publish' and status_class = '2xx' TIMESERIES

Healthy Subscribes

SELECT sum(`pubnub.http_status.value`) FROM Metric where api = 'subscribe' and status_class = '2xx' TIMESERIES

Healthy History

SELECT sum(`pubnub.http_status.value`) FROM Metric where api = 'history' and status_class = '2xx' TIMESERIES

Healthy Signal Publishes

SELECT sum(`pubnub.http_status.value`) FROM Metric where api = 'signal' and status_class = '2xx' TIMESERIES

Healthy Message Reactions

SELECT sum(`pubnub.http_status.value`) FROM Metric where api = 'message-actions' and status_class = '2xx' TIMESERIES

Healthy File Sharing Publish

SELECT sum(`pubnub.http_status.value`) FROM Metric where api = 'files.publish-file' and status_class = '2xx' TIMESERIES

Presence | Access Manager | Channel Registrations

Healthy Presence Total

SELECT sum(`pubnub.http_status.value`) FROM Metric where api = 'presence' and status_class = '2xx' TIMESERIES

Healthy Access Manager Grants

SELECT sum(`pubnub.http_status.value`) FROM Metric where api = 'auth-grant' and status_class = '2xx' TIMESERIES

Healthy Channel Registrations

SELECT sum(`pubnub.http_status.value`) FROM Metric where api = 'channel-registration' and status_class = '2xx' TIMESERIES

Server Errors

Server Errors (5xx)

SELECT sum(`pubnub.http_status.value`) FROM Metric where status_class = '5xx' FACET api, status TIMESERIES
Last updated on