Operational Dashboards raw metrics queries
This page lists ready-made Datadog and New Relic queries for the PubNub Operational Dashboards raw metrics export. The Operational Dashboards raw metrics export is available on the Enterprise support plan. Every query reads the pubnub.http_status metric and filters on its tags.
Prerequisites
- Raw metrics export. PubNub must stream raw metrics to your Datadog or New Relic account. To request the export, see Raw metrics export.
- Customer tag. In the Datadog queries on this page, replace
CUSTOMERwith thecustomertag value PubNub assigned to your subscribe key, for examplecustomer:acme-prod. - Tag reference. For every tag and value these queries filter on, see Raw metric format.
The New Relic queries on this page have no customer filter. They return pubnub.http_status data for every subscribe key that streams to your New Relic account.
Request volume
Total requests by region
Counts all requests to PubNub APIs, grouped by the PubNub region that recorded them.
sum:pubnub.http_status{customer:CUSTOMER} by {region}.as_count()
SELECT sum(`pubnub.http_status.value`) FROM Metric FACET region
Total requests by API
Counts all requests, grouped by the api tag, such as publish or subscribe.
sum:pubnub.http_status{customer:CUSTOMER} by {api}.as_count()
SELECT sum(`pubnub.http_status.value`) FROM Metric FACET api
Requests per second by region
Shows the request rate per second, grouped by PubNub region. This query is available for Datadog only.
sum:pubnub.http_status{customer:CUSTOMER} by {region}.as_rate()
Top five APIs by peak requests per second
Returns the five APIs with the highest peak request rate. This query is available for Datadog only.
top(sum:pubnub.http_status{customer:CUSTOMER} by {api}.as_rate(), 5, 'max', 'desc')
Client closed connections (499)
Counts requests with status 499, grouped by API. Status 499 means the client closed the connection before PubNub returned a response. Track it to spot the effects of changes to client timeouts or network conditions.
sum:pubnub.http_status{customer:CUSTOMER,status:499} by {api}.as_count()
SELECT sum(`pubnub.http_status.value`) FROM Metric where status = 499 FACET api TIMESERIES
Client errors (4xx)
Client error count
The Datadog query counts 4xx responses, excluding status 499. The New Relic query counts 4xx responses, excluding statuses 403 and 499.
sum:pubnub.http_status{customer:CUSTOMER,status_class:4xx,!status:499}.as_count()
SELECT sum(`pubnub.http_status.value`) FROM Metric where status_class = '4xx' and status NOT IN ('403', '499')
Client error percentage
Divides 4xx responses, excluding status 499, by all responses that are not 5xx, and multiplies by 100. This query is available for Datadog only.
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 by API and status, excluding 403 and 499
Counts 4xx responses other than 403 and 499, grouped by API and status code. These errors usually come from invalid API calls, so high counts point to a coding error in your client.
sum:pubnub.http_status{customer:CUSTOMER,status_class:4xx,!status:499,!status:403} by {api,status}.as_count()
SELECT sum(`pubnub.http_status.value`) FROM Metric where status_class = '4xx' and status NOT IN ('403', '499') FACET api, status TIMESERIES
Unauthorized requests (403)
Counts 403 responses, grouped by API. If you use Access Manager, a rise in 403 counts can mean a token provisioning error or calls from unauthorized users.
sum:pubnub.http_status{customer:CUSTOMER,status:403} by {api}.as_count()
SELECT sum(`pubnub.http_status.value`) FROM Metric where status = '403' FACET api TIMESERIES
Messaging API health
Each query in this section counts successful (2xx) responses for one messaging API. A drop in successful calls with no drop in traffic points to errors on that API.
Successful publishes
Counts successful publish calls in the raw metrics export.
sum:pubnub.http_status{customer:CUSTOMER,api:publish,status_class:2xx}.as_count()
SELECT sum(`pubnub.http_status.value`) FROM Metric where api = 'publish' and status_class = '2xx' TIMESERIES
Successful subscribes
Counts successful subscribe calls in the raw metrics export.
sum:pubnub.http_status{customer:CUSTOMER,api:subscribe,status_class:2xx}.as_count()
SELECT sum(`pubnub.http_status.value`) FROM Metric where api = 'subscribe' and status_class = '2xx' TIMESERIES
Successful Message Persistence history calls
Counts successful calls to the history API of Message Persistence.
sum:pubnub.http_status{customer:CUSTOMER,api:history,status_class:2xx}.as_count()
SELECT sum(`pubnub.http_status.value`) FROM Metric where api = 'history' and status_class = '2xx' TIMESERIES
Successful signals
Counts successful signal publishes in the raw metrics export.
sum:pubnub.http_status{customer:CUSTOMER,api:signal,status_class:2xx}.as_count()
SELECT sum(`pubnub.http_status.value`) FROM Metric where api = 'signal' and status_class = '2xx' TIMESERIES
Successful Message Actions calls
Counts successful calls to the Message Actions API.
sum:pubnub.http_status{customer:CUSTOMER,api:message-actions,status_class:2xx}.as_count()
SELECT sum(`pubnub.http_status.value`) FROM Metric where api = 'message-actions' and status_class = '2xx' TIMESERIES
Successful file publishes
Counts successful file publish calls to Files.
sum:pubnub.http_status{customer:CUSTOMER,api:files.publish-file,status_class:2xx}.as_count()
SELECT sum(`pubnub.http_status.value`) FROM Metric where api = 'files.publish-file' and status_class = '2xx' TIMESERIES
Presence, Access Manager, and channel groups
Successful Presence calls
Counts successful calls to the Presence API.
sum:pubnub.http_status{customer:CUSTOMER,api:presence,status_class:2xx}.as_count()
SELECT sum(`pubnub.http_status.value`) FROM Metric where api = 'presence' and status_class = '2xx' TIMESERIES
Successful Access Manager token grants
Counts successful Access Manager v3 token grants, which carry the api tag value pam-grant.
sum:pubnub.http_status{customer:CUSTOMER,api:pam-grant,status_class:2xx}.as_count()
SELECT sum(`pubnub.http_status.value`) FROM Metric where api = 'pam-grant' and status_class = '2xx' TIMESERIES
Successful channel group registrations
Counts successful channel group registration calls, which carry the api tag value channel-registration. The Datadog query also groups the result by status code.
sum:pubnub.http_status{customer:CUSTOMER,api:channel-registration,status_class:2xx} by {status}.as_count()
SELECT sum(`pubnub.http_status.value`) FROM Metric where api = 'channel-registration' and status_class = '2xx' TIMESERIES
Server errors (5xx)
Server errors by API and status
Counts 5xx responses, grouped by API and status code. Several 5xx errors in a short period can mean a platform issue. Check the PubNub status page and contact PubNub support if the errors continue.
sum:pubnub.http_status{customer:CUSTOMER,status_class:5xx} by {api,status}.as_count()
SELECT sum(`pubnub.http_status.value`) FROM Metric where status_class = '5xx' FACET api, status TIMESERIES
If a query returns no data
If a Datadog query returns no data, check that the customer tag value matches the one PubNub assigned to your subscribe key. For either tool, check that the time window covers a period when your app sent traffic. The Functions and Push notifications sections of the dashboard aren't part of the raw metrics export, so there are no queries for them.
Related tasks
- Operational Dashboards. Request a dashboard link or the raw metrics export for your subscribe key.
- Raw metric format. Look up every tag and value on the
pubnub.http_statusmetric.