Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ccharlton/fabe9267e53861d253d03c28038f5f16 to your computer and use it in GitHub Desktop.
Save ccharlton/fabe9267e53861d253d03c28038f5f16 to your computer and use it in GitHub Desktop.
New Relic (NRQL) query with labeled HTTP Status Codes
SELECT count(http.statusCode)
FROM Transaction
WHERE appName = {{appName}}
FACET CASES(
WHERE http.statusCode = 100 AS '100 Continue',
WHERE http.statusCode = 101 AS '101 Switching Protocols',
WHERE http.statusCode = 102 AS '102 Processing',
WHERE http.statusCode = 103 AS '103 Early Hints',
WHERE http.statusCode >= 104 AND http.statusCode <= 199 AS '104-199 Unassigned',
WHERE http.statusCode = 200 AS '200 OK',
WHERE http.statusCode = 201 AS '201 Created',
WHERE http.statusCode = 202 AS '202 Accepted',
WHERE http.statusCode = 203 AS '203 Non-Authoritative Information',
WHERE http.statusCode = 204 AS '204 No Content',
WHERE http.statusCode = 205 AS '205 Reset Content',
WHERE http.statusCode = 206 AS '206 Partial Content',
WHERE http.statusCode = 207 AS '207 Multi-Status',
WHERE http.statusCode = 208 AS '208 Already Reported',
WHERE http.statusCode >= 209 AND http.statusCode <= 225 AS '209-225 Unassigned',
WHERE http.statusCode = 226 AS '226 IM Used',
WHERE http.statusCode >= 227 AND http.statusCode <= 299 AS '227-299 Unassigned',
WHERE http.statusCode = 300 AS '300 Multiple Choices',
WHERE http.statusCode = 301 AS '301 Moved Permanently',
WHERE http.statusCode = 302 AS '302 Found',
WHERE http.statusCode = 303 AS '303 See Other',
WHERE http.statusCode = 304 AS '304 Not Modified',
WHERE http.statusCode = 305 AS '305 Use Proxy',
WHERE http.statusCode = 306 AS '306 (Unused)',
WHERE http.statusCode = 307 AS '307 Temporary Redirect',
WHERE http.statusCode = 308 AS '308 Permanent Redirect',
WHERE http.statusCode >= 309 AND http.statusCode <= 399 AS '309-399 Unassigned',
WHERE http.statusCode = 400 AS '400 Bad Request',
WHERE http.statusCode = 401 AS '401 Unauthorized',
WHERE http.statusCode = 402 AS '402 Payment Required',
WHERE http.statusCode = 403 AS '403 Forbidden',
WHERE http.statusCode = 404 AS '404 Not Found',
WHERE http.statusCode = 405 AS '405 Method Not Allowed',
WHERE http.statusCode = 406 AS '406 Not Acceptable',
WHERE http.statusCode = 407 AS '407 Proxy Authentication Required',
WHERE http.statusCode = 408 AS '408 Request Timeout',
WHERE http.statusCode = 409 AS '409 Conflict',
WHERE http.statusCode = 410 AS '410 Gone',
WHERE http.statusCode = 411 AS '411 Length Required',
WHERE http.statusCode = 412 AS '412 Precondition Failed',
WHERE http.statusCode = 413 AS '413 Content Too Large',
WHERE http.statusCode = 414 AS '414 URI Too Long',
WHERE http.statusCode = 415 AS '415 Unsupported Media Type',
WHERE http.statusCode = 416 AS '416 Range Not Satisfiable',
WHERE http.statusCode = 417 AS '417 Expectation Failed',
WHERE http.statusCode = 418 AS '418 (Unused)',
WHERE http.statusCode >= 419 AND http.statusCode <= 420 AS '419-420 Unassigned',
WHERE http.statusCode = 421 AS '421 Misdirected Request',
WHERE http.statusCode = 422 AS '422 Unprocessable Content',
WHERE http.statusCode = 423 AS '423 Locked',
WHERE http.statusCode = 424 AS '424 Failed Dependency',
WHERE http.statusCode = 425 AS '425 Too Early',
WHERE http.statusCode = 426 AS '426 Upgrade Required',
WHERE http.statusCode = 427 AS '427 Unassigned',
WHERE http.statusCode = 428 AS '428 Precondition Required',
WHERE http.statusCode = 429 AS '429 Too Many Requests',
WHERE http.statusCode = 430 AS '430 Unassigned',
WHERE http.statusCode = 431 AS '431 Request Header Fields Too Large',
WHERE http.statusCode >= 432 AND http.statusCode <= 450 AS '432-450 Unassigned',
WHERE http.statusCode = 451 AS '451 Unavailable For Legal Reasons',
WHERE http.statusCode >= 452 AND http.statusCode <= 499 AS '452-499 Unassigned',
WHERE http.statusCode = 500 AS '500 Internal Server Error',
WHERE http.statusCode = 501 AS '501 Not Implemented',
WHERE http.statusCode = 502 AS '502 Bad Gateway',
WHERE http.statusCode = 503 AS '503 Service Unavailable',
WHERE http.statusCode = 504 AS '504 Gateway Timeout',
WHERE http.statusCode = 505 AS '505 HTTP Version Not Supported',
WHERE http.statusCode = 506 AS '506 Variant Also Negotiates',
WHERE http.statusCode = 507 AS '507 Insufficient Storage',
WHERE http.statusCode = 508 AS '508 Loop Detected',
WHERE http.statusCode = 509 AS '509 Unassigned',
WHERE http.statusCode = 510 AS '510 Not Extended (OBSOLETED)',
WHERE http.statusCode = 511 AS '511 Network Authentication Required',
WHERE http.statusCode >= 512 AND http.statusCode <= 599 AS '512-599 Unassigned'
)
SINCE 1 month ago
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment