Skip to content

Enhance OTEL_EBPF_BPF_DEBUG to allow printing to trace_pipe only #1295

@rafaelroquetto

Description

@rafaelroquetto

This is more like a request for comments/feedback: often times I find it useful to just print bpf debug information to trace_pipe rather than to the userspace stdout:

  1. it keeps the application output clean
  2. likewise, it keeps the eBPF logs separated from userspace junk
  3. there are no character limits

My proposal is to change the semantics of OTEL_EBPF_BPF_DEBUG so that:

  1. default == true == 1 (fallback): current behaviour of printing to both trace_pipe and submitting the log messages to the userspace ring buffer
  2. trace_pipe: only prints to trace pipe (skips the ring buffer)

In the trace_pipe case (and perhaps in every case, whatever is simpler), we should also aim to print the current function name or context, like we do for the userspace messages:

bpf_printk("%s: "fmt, __FUNCTION__, ##args);

caveat: limits the printk arguments back to 2 rather than 3 in certain kernels.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions