On Sun, Feb 4, 2018 at 8:02 AM, Brad Gardner <bgardne...@gmail.com> wrote:
> Hello! > > I'm working on learning to use DTrace to profile NodeJS applications and > have hit a wall that I'm hoping to get some additional insight on. > > I have a NodeJS application that is sending an HTTP request to > https://example.com every 5 seconds. This is working and getting a proper > response. > > *I'm using the following DTrace script:* > > #pragma D option quiet > > node*:::http-client-request > { > printf("Connection to %s:%d on fd %d - Request %s: %s\n", > args[1]->remoteAddress, args[1]->remotePort, > args[1]->fd, > args[0]->method, args[0]->url); > } > > *Output:* > > [root@00-0c-29-ab-31-af /development]# dtrace -s ./test.d > Connection to undefined:0 on fd 0 - Request GET: / > Connection to undefined:0 on fd 0 - Request GET: / > Connection to undefined:0 on fd 0 - Request GET: / > > It appears to me that all of the args[1] properties are not assigned and > giving back default values (undefined or 0 depending on type). > > *The documentation for this probe lists the arguments:* > > 12437 node35247 node _ZN4node26DTRACE_HTTP_CLIENT_ > REQUESTERKN2v820FunctionCallbackInfoINS0_5ValueEEE http-client-request > > Probe Description Attributes > Identifier Names: Private > Data Semantics: Private > Dependency Class: Unknown > > Argument Attributes > Identifier Names: Evolving > Data Semantics: Evolving > Dependency Class: ISA > > Argument Types > args[0]: node_http_request_t * > args[1]: node_connection_t * > args[2]: string > args[3]: int > args[4]: string > args[5]: string > args[6]: int > > > The node_http_request_t struct properties appear to work, while the > node_connection_t properties do not. > > I'm not sure where to go next in debugging this, or determining what I've > misconfigured. > > This is running on a SmartOS VM, running NodeJS 8.4. > > Any insight, or a kick in the right direction would be greatly appreciated. > It's been a while since I dug into the internals, and I usually use "nhttpsnoop" when I use these probes. But what you're doing seems reasonable. Does it work reliably with an older version (such as Node 0.10)? -- Dave ------------------------------------------- dtrace-discuss Archives: https://www.listbox.com/member/archive/184261/=now RSS Feed: https://www.listbox.com/member/archive/rss/184261/25769126-e243886f Modify Your Subscription: https://www.listbox.com/member/?member_id=25769126&id_secret=25769126-8d47a7b2 Powered by Listbox: http://www.listbox.com