Commit a692ed5
authored
otel-thread-ctx: publish V8 + ObjectWrap layout constants for readers (#375)
* otel-thread-ctx: publish V8 + ObjectWrap layout constants for readers
Extends the OTEP-4719 process-context attributes emitted by
getProcessContextAttributes with three new entries an out-of-process
eBPF reader needs to walk from our TLS discovery struct to the actual
OTEP-4947 record:
- threadlocal.native_wrap_fields_offset — sizeof(node::ObjectWrap).
Given a pointer to a CtxWrap fetched via wrapped_object_offset, add
this to reach CtxWrap::record_.
- threadlocal.js_map_table_offset — offset within a V8 JSMap object of
the tagged pointer to its backing OrderedHashMap table
(JSCollection::kTableOffset in V8, 0x18).
- threadlocal.ordered_hash_map_header_size — size of the header
preceding the element_count / deleted_element_count / n_buckets
fields inside an OrderedHashMap (0x10).
Without these, a reader implementing the Node.js schema would have to
hardcode them itself and re-verify them per V8 version. Keeping the
constants in the addon puts one source of truth close to V8. The two
V8 internal offsets are not exposed in V8's public headers
(v8-internal.h); they live in Node's private V8 tree
(deps/v8/src/objects/{js-collection,ordered-hash-table}.h) — we cite
those paths in the code comments so a future V8 layout change has a
clear pointer to what to re-check.
New non-Linux fallback values match the Linux ones (24 / 0x18 / 0x10);
the reader contract is Linux-only per the OTEP anyway, so this just
keeps the exported surface consistent in shape across platforms.1 parent b08a56c commit a692ed5
3 files changed
Lines changed: 59 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
679 | 679 | | |
680 | 680 | | |
681 | 681 | | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
682 | 704 | | |
683 | 705 | | |
684 | 706 | | |
| |||
688 | 710 | | |
689 | 711 | | |
690 | 712 | | |
691 | | - | |
692 | | - | |
693 | | - | |
694 | | - | |
695 | | - | |
696 | | - | |
697 | | - | |
698 | | - | |
699 | | - | |
700 | | - | |
701 | | - | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
702 | 726 | | |
703 | 727 | | |
704 | 728 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
| |||
103 | 106 | | |
104 | 107 | | |
105 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
106 | 112 | | |
107 | 113 | | |
108 | 114 | | |
| |||
114 | 120 | | |
115 | 121 | | |
116 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
117 | 126 | | |
118 | 127 | | |
119 | 128 | | |
| |||
140 | 149 | | |
141 | 150 | | |
142 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
143 | 155 | | |
144 | 156 | | |
145 | 157 | | |
| |||
266 | 278 | | |
267 | 279 | | |
268 | 280 | | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
269 | 284 | | |
270 | 285 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
733 | 733 | | |
734 | 734 | | |
735 | 735 | | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
736 | 742 | | |
737 | 743 | | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
738 | 747 | | |
739 | 748 | | |
740 | 749 | | |
| |||
0 commit comments