Actions
Feature #4477
closedDTrace should speak JSON
Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
DTrace
Start date:
2014-01-14
Due date:
% Done:
80%
Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:
Description
From the Joyent bug report:
Now that we're emitting debug log messages from bunyan, et al, as JSON strings it would be helpful to be able to format and predicate on the contents of these objects.
In order for this to work from within DTrace, a probe context-safe bespoke JSON parser must be written and hooked up to a DTrace subroutine; viz. {{json()}}. The {{json()}} subroutine will work like this:
bunyan*:::log-* { this->str = copyinstr(arg0); this->component = json(this->str, "component"); } bunyan*:::log-* /this->component == "wuzzle"/ { this->wuzzle = json(this->str, "wuzzles[0]"); this->method = json(this->str, "req.method"); printf("Method: %s! First wuzzle was: %s\\n", this->method, this->wuzzle); }
In addition, in order to be able to aggregate on integer values extracted from JSON strings, we will need a {{strtoll()}}.
Updated by Rich Lowe over 8 years ago
This may sound a little silly, but avoiding confusion regarding the D version number makes such low-risk things worthy entirely aside from any other benefit.
Updated by Electric Monk over 8 years ago
git commit f497f9fe231e0e400f339c84a7d80c4aae2ac4d5
Author: Joshua M. Clulow <jmc@joyent.com> 4477 DTrace should speak JSON Reviewed by: Bryan Cantrill <bmc@joyent.com> Approved by: Gordon Ross <gwr@nexenta.com>
Updated by Rich Lowe over 8 years ago
- Status changed from In Progress to Resolved
Actions