-
Notifications
You must be signed in to change notification settings - Fork 117
Tracing
This page describes the method to obtain traces once https://github.com/h2o/quicly/pull/166 gets merged.
The H2O project implements dtrace (or eBPF) probes, to let the users obtain traces in a cross-protocol-stack manner.
Each subproject defines it's own probe definition in file named <subproject>-probes.d
.
In case of quicly, a helper program is provided for generating dtrace / ebpf script from the probe definition file.
Run misc/probe2trace.pl < quicly-probes.d > trace.d
to generate and save the trace script as trace.d
.
To collect the trace log on macOS, invoke the command that you want to run via dtrace.
The example below runs the cli command, with trace.d
script being attached.
The trace log is stored in trace.out
.
% sudo dtrace -s trace.d -o trace.out -c './cli <options...>'
As the log would contain both the output of the dtrace command and the output from the script, apply egrep '^{'
, to extract the output from the script (i.e., JSON logging).
Alternatively, you can specify the process ID of the cli command by using the -p
option.
On linux, we recommend to designate the process to be traced by using the process id. It is a bit difficult to specify the process using the path, as the path needs to be specified in the command line and also in the probe script.
First, run the cli command as usual.
Then, invoke the bpftrace command.
% sudo bpftrace -p PID_OF_CLI_COMMAND trace.d