diff --git a/e2e/examples/http.rs b/e2e/examples/http.rs index 0412ea1..81cba0b 100644 --- a/e2e/examples/http.rs +++ b/e2e/examples/http.rs @@ -55,7 +55,7 @@ async fn post_job(State(storage): State, Json(input): Json Json(job_result) } -#[instrument(skip_all, fields(work_id = %id))] +#[instrument(skip_all, fields(id = %id))] async fn get_job( State(storage): State, axum::extract::Path(id): axum::extract::Path, diff --git a/explore/data.ipynb b/explore/data.ipynb index d5b75d1..90fae4e 100644 --- a/explore/data.ipynb +++ b/explore/data.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:478490fc92ccede8cd988d216d342ba38ddaf5ff2d36a5f154edbf1e7c7837c3 -size 123113 +oid sha256:8dccb4cca3fe901125475162676b35634b2c8f927477d03b290171be2aa17c4b +size 123079 diff --git a/past/src/bpf/past.bpf.c b/past/src/bpf/past.bpf.c index 068b9c7..ac225f6 100644 --- a/past/src/bpf/past.bpf.c +++ b/past/src/bpf/past.bpf.c @@ -380,7 +380,7 @@ int handle__sched_process_exec(u64 *ctx) } SEC("usdt") -int BPF_USDT(past_tracing_enter, u64 span_id, u64 parent_span_id, u64 work_id, u64 amount, void *name) +int BPF_USDT(past_tracing_enter, u64 span_id, u64 parent_span_id, u64 id, u64 amount, void *name) { u64 __pid_tgid = bpf_get_current_pid_tgid(); gid_t tgid = __pid_tgid >> 32; @@ -401,7 +401,7 @@ int BPF_USDT(past_tracing_enter, u64 span_id, u64 parent_span_id, u64 work_id, u event->pid = pid; event->span_id = span_id; event->parent_id = parent_span_id; - event->work_id = work_id; + event->id = id; event->amount = amount; bpf_probe_read_user_str(&event->name, sizeof(event->name), name); bpf_ringbuf_submit(event, BPF_RB_NO_WAKEUP); diff --git a/past/src/bpf/past.h b/past/src/bpf/past.h index 8fd2eb5..acfc7ce 100644 --- a/past/src/bpf/past.h +++ b/past/src/bpf/past.h @@ -68,7 +68,7 @@ struct tracing_enter_event { __u32 pid; __u64 span_id; __u64 parent_id; - __u64 work_id; + __u64 id; __u64 amount; __u8 name[TASK_COMM_LEN]; }; diff --git a/past/src/collector.rs b/past/src/collector.rs index 3104449..2bbb6b5 100644 --- a/past/src/collector.rs +++ b/past/src/collector.rs @@ -68,7 +68,7 @@ impl<'a> From<&'a [u8]> for Received<'a> { #[derive(Debug)] struct SpanEnter { parent_id: u64, - work_id: u64, + id: u64, amount: u64, name: Bytes, first_enter_ts: u64, @@ -160,7 +160,7 @@ impl Collector { btree_map::Entry::Vacant(vacant) => { vacant.insert(SpanEnter { parent_id: event.parent_id, - work_id: event.work_id, + id: event.id, amount: event.amount, name: Bytes::copy_from_slice(null_terminated(&event.name)), first_enter_ts: event.ts, @@ -198,7 +198,7 @@ impl Collector { command: command.clone(), span_id: event.span_id as i64, parent_id: span.parent_id as i64, - work_id: span.work_id as i64, + id: span.id as i64, amount: span.amount as i64, name: span.name.clone(), ustack: event.ustack, @@ -232,7 +232,7 @@ impl Collector { command: command.clone(), span_id: event.span_id as i64, parent_id: span.parent_id as i64, - work_id: span.work_id as i64, + id: span.id as i64, amount: span.amount as i64, name: span.name.clone(), }); diff --git a/past/src/parquet.rs b/past/src/parquet.rs index 12cb254..822493c 100644 --- a/past/src/parquet.rs +++ b/past/src/parquet.rs @@ -61,7 +61,7 @@ fn events_schema() -> types::Type { required int32 pid (INTEGER(32, false)); required int64 span_id (INTEGER(64, false)); required int64 parent_id (INTEGER(64, false)); - required int64 work_id (INTEGER(64, false)); + required int64 id (INTEGER(64, false)); required int64 amount (INTEGER(64, false)); required binary command (UTF8); required binary trace_name (UTF8); @@ -110,7 +110,7 @@ pub(crate) enum Event { pid: i32, span_id: i64, parent_id: i64, - work_id: i64, + id: i64, amount: i64, name: Bytes, command: Bytes, @@ -124,7 +124,7 @@ pub(crate) enum Event { pid: i32, span_id: i64, parent_id: i64, - work_id: i64, + id: i64, amount: i64, name: Bytes, command: Bytes, @@ -145,7 +145,7 @@ pub(crate) struct Group { pid: Vec, span_id: Vec, parent_id: Vec, - work_id: Vec, + id: Vec, amount: Vec, command: Vec, trace_name: Vec, @@ -171,7 +171,7 @@ impl Group { pid: Vec::with_capacity(capacity), span_id: Vec::with_capacity(capacity), parent_id: Vec::with_capacity(capacity), - work_id: Vec::with_capacity(capacity), + id: Vec::with_capacity(capacity), amount: Vec::with_capacity(capacity), command: Vec::with_capacity(capacity), trace_name: Vec::with_capacity(capacity), @@ -217,7 +217,7 @@ impl Group { self.pid.swap(i, i - 1); self.span_id.swap(i, i - 1); self.parent_id.swap(i, i - 1); - self.work_id.swap(i, i - 1); + self.id.swap(i, i - 1); self.amount.swap(i, i - 1); self.command.swap(i, i - 1); self.trace_name.swap(i, i - 1); @@ -286,7 +286,7 @@ impl Group { self.pid.push(0); self.span_id.push(0); self.parent_id.push(0); - self.work_id.push(0); + self.id.push(0); self.amount.push(amount as i64); self.command.push(command.into()); self.trace_name.push(Bytes::new().into()); @@ -302,7 +302,7 @@ impl Group { pid, span_id, parent_id, - work_id, + id, amount, name, command, @@ -315,7 +315,7 @@ impl Group { self.pid.push(pid); self.span_id.push(span_id); self.parent_id.push(parent_id); - self.work_id.push(work_id); + self.id.push(id); self.amount.push(amount); self.command.push(command.into()); self.trace_name.push(name.into()); @@ -331,7 +331,7 @@ impl Group { pid, span_id, parent_id, - work_id, + id, amount, name, command, @@ -343,7 +343,7 @@ impl Group { self.pid.push(pid); self.span_id.push(span_id); self.parent_id.push(parent_id); - self.work_id.push(work_id); + self.id.push(id); self.amount.push(amount); self.command.push(command.into()); self.trace_name.push(name.into()); @@ -364,7 +364,7 @@ impl Group { self.pid.clear(); self.span_id.clear(); self.parent_id.clear(); - self.work_id.clear(); + self.id.clear(); self.amount.clear(); self.command.clear(); self.trace_name.clear(); @@ -381,7 +381,7 @@ impl Group { fn add_empty_trace(&mut self) { self.span_id.push(0); self.parent_id.push(0); - self.work_id.push(0); + self.id.push(0); self.amount.push(0); self.trace_name.push(Bytes::new().into()); } @@ -501,12 +501,12 @@ impl GroupWriter { .context("parent_id")?; parent_id.close()?; - let mut work_id = rows.next_column()?.expect("work_id column"); - work_id + let mut id = rows.next_column()?.expect("id column"); + id .typed::() - .write_batch(&group.work_id, None, None) - .context("work_id")?; - work_id.close()?; + .write_batch(&group.id, None, None) + .context("id")?; + id.close()?; let mut amount = rows.next_column()?.expect("amount column"); amount diff --git a/tracing-past/src/lib.rs b/tracing-past/src/lib.rs index 0b375df..0dc5b05 100644 --- a/tracing-past/src/lib.rs +++ b/tracing-past/src/lib.rs @@ -12,21 +12,21 @@ pub fn init() { struct SpanInfo { span_id: u64, parent_span_id: u64, - work_id: u64, + id: u64, amount: u64, name: [u8; 16], exit_stack: bool, } -const WORK_ID: &str = "work_id"; +const ID: &str = "id"; const THROUGHPUT_METRIC: &str = "amount"; const EXIT_STACK: &str = "exit_stack"; impl Visit for SpanInfo { fn record_u64(&mut self, field: &tracing_core::Field, value: u64) { match field.name() { - WORK_ID => self.work_id = value, + ID => self.id = value, THROUGHPUT_METRIC => self.amount = value, _ => {} } @@ -38,14 +38,7 @@ impl Visit for SpanInfo { } } - fn record_debug(&mut self, field: &tracing_core::Field, _: &dyn std::fmt::Debug) { - match field.name() { - WORK_ID => debug_assert!(false, "field `work_id` is not u64"), - THROUGHPUT_METRIC => { - debug_assert!(false, "field `amount` is not u64") - } - _ => {} - } + fn record_debug(&mut self, _: &tracing_core::Field, _: &dyn std::fmt::Debug) { } } @@ -68,7 +61,7 @@ where name: buf, parent_span_id: attrs.parent().or(ctx.current_span().id()).map_or(0, |id| id.into_u64()), span_id: id.into_u64(), - work_id: 0, + id: 0, amount: 0, exit_stack: false, }; @@ -86,7 +79,7 @@ where enter, span_info.span_id as *const u64, span_info.parent_span_id as *const u64, - span_info.work_id as *const u64, + span_info.id as *const u64, span_info.amount as *const u64, span_info.name.as_ptr() );