Typed runtime_events probes for OCaml
0

Configure Feed

Select the types of activity you want to include in your feed.

probe: js stubs for the no-ring runtime

Fulfil the probe.mli no-ring contract under js_of_ocaml: the ring
reports inactive, the ring write fails hard (unreachable while the
ring is inactive), and the minor-words counter reads zero, so span
allocation deltas are zero rather than a trap. Emission flows through
set_sink, which needs no C support.

Makes the committed test/js spec test pass; a browser consumer linking
probe no longer dies with a missing-primitive TypeError at its first
span enter.

+29 -1
+3 -1
lib/dune
··· 4 4 (libraries runtime_events fmt) 5 5 (foreign_stubs 6 6 (language c) 7 - (names probe_stubs))) 7 + (names probe_stubs)) 8 + (js_of_ocaml 9 + (javascript_files probe_stubs.js))) 8 10 9 11 (mdx 10 12 (files probe.mli)
+26
lib/probe_stubs.js
··· 1 + /*--------------------------------------------------------------------------- 2 + Copyright (c) 2026 Thomas Gazagnaire. All rights reserved. 3 + SPDX-License-Identifier: MIT 4 + ---------------------------------------------------------------------------*/ 5 + 6 + /* js_of_ocaml counterparts of probe_stubs.c. There is no runtime_events ring 7 + under js, so the ring is never active, ring writes are unreachable, and the 8 + minor-heap allocation counter reads as zero. Emission flows through 9 + Probe.set_sink instead (see probe.mli). */ 10 + 11 + //Provides: probe_runtime_events_are_active 12 + function probe_runtime_events_are_active(unit) { 13 + return 0; /* no runtime_events ring under js */ 14 + } 15 + 16 + //Provides: probe_runtime_events_user_write 17 + //Requires: caml_failwith 18 + function probe_runtime_events_user_write(write_buffer, event, event_content) { 19 + /* Unreachable while the ring reports inactive; fail hard if reached. */ 20 + caml_failwith("probe_runtime_events_user_write: no runtime_events ring under js"); 21 + } 22 + 23 + //Provides: probe_minor_words 24 + function probe_minor_words(unit) { 25 + return 0; /* no minor-heap counter under js */ 26 + }