Skip to content

feat(telemetry): allow extra arguments with span end probes - #270

Open
jsitnicki wants to merge 2 commits into
cloudflare:mainfrom
jsitnicki:feat-span-probe-args
Open

jsitnicki wants to merge 2 commits into
cloudflare:mainfrom
jsitnicki:feat-span-probe-args

Conversation

@jsitnicki

Copy link
Copy Markdown
Contributor

Sometimes one span covers more than one kind of operation. Let users pass extra arguments to the span-end probe so tracers can split its latency by category.

Sometimes one span covers more than one kind of operation. Let users pass
extra arguments to the span-end probe so tracers can split its latency by
category.

To that end extend span_with_probe! with a probe_args option: a [u64; N]
array expression:(N = 0..=3) whose values are exposed to the tracer as the
probe's arguments after the span duration (arg0). The macro emits a
per-span probe function of matching arity and a stapsdt note with one
-8@<reg> descriptor per argument, so each call site chooses how many values
it passes.

The probe function pointer is type-erased (as *const ()) in the shared
SpanProbe, which carries the args in a fixed [u64; 4] array; Drop casts
it back to the right fn(u64, ..) arity. Spans without probe_args keep a
duration-only probe, and tracers reading only arg0 are unaffected.
Add a cache_task span that alternates cache hits and misses, passing a
hit flag as arg1 via probe_args. The bpftrace script buckets the single
probe's durations by outcome with /arg1 == 1/ and /arg1 == 0/ filters.
@oga35767-eng

Copy link
Copy Markdown

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants