Skip to content

Commit 76a3ad5

Browse files
authored
Update TraceProgram docstring (#1720)
Summary: Updates documentation for the `pxtrace.TraceProgram` object which enables deploying bpftrace programs to specific hosts via selectors. Relevant Issues: pixie-io/docs.px.dev#277 Type of change: /kind documentation Test Plan: Existing targets. Signed-off-by: Benjamin Kilimnik <bkilimnik@pixielabs.ai>
1 parent 4730a96 commit 76a3ad5

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/carnot/planner/probes/tracing_module.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ Status TraceModule::Init() {
168168
std::placeholders::_2, std::placeholders::_3),
169169
ast_visitor()));
170170
// add method to the pxtrace module, pxtrace.TraceProgram
171+
PX_RETURN_IF_ERROR(program_fn->SetDocString(kTraceProgramDocstring));
171172
AddMethod(kTraceProgramID, program_fn);
172173

173174
PX_ASSIGN_OR_RETURN(std::shared_ptr<FuncObject> shared_object_fn,

src/carnot/planner/probes/tracing_module.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ class TraceModule : public QLObject {
190190
name (str): The name of the tracepoint. Should be unique with the probe_fn.
191191
table_name (str): The table name to write the results. The table is created
192192
if it does not exist. The table schema must match if the table does exist.
193-
probe_fn (px.ProbeFn): The tracepoint function.
193+
probe_fn (Union[px.ProbeFn, str, pxtrace.TraceProgram, List[pxtrace.TraceProgram]]): The tracepoint function, BPFTrace program or pxtrace.TraceProgram to deploy.
194194
target (Union[px.UPID,px.SharedObject,pxtrace.PodProcess,pxtrace.LabelSelector]): The process or shared object
195195
to trace as specified by unique Vizier PID.
196196
ttl (px.Duration): The length of time that a tracepoint will stay alive, after
@@ -199,16 +199,15 @@ class TraceModule : public QLObject {
199199

200200
inline static constexpr char kTraceProgramID[] = "TraceProgram";
201201
inline static constexpr char kTraceProgramDocstring[] = R"doc(
202-
Creates a trace program.
202+
Creates a trace program. Selectors for supported hosts can be specified using key-value arguments.
203203
204204
:topic: pixie_state_management
205205
206206
Args:
207207
program (str): The BPFtrace program string.
208-
min_kernel (str, optional): The minimum kernel version that the tracepoint is supported on. Format is <version>.<major>.<minor>.
209-
max_kernel (str, optional): The maximum kernel version that the tracepoint is supported on. Format is <version>.<major>.<minor>.
208+
min_kernel (str, optional): The minimum kernel version that the tracepoint is supported on. Format is `<version>.<major>.<minor>`.
209+
max_kernel (str, optional): The maximum kernel version that the tracepoint is supported on. Format is `<version>.<major>.<minor>`.
210210
host_name (str, optional): Restrict the tracepoint to a specific host.
211-
(Additional selectors may be added in the future.)
212211
213212
Returns:
214213
TraceProgram: A pointer to the TraceProgram that can be passed as a probe_fn

0 commit comments

Comments
 (0)