Skip to content

InstrumentationContext type

Home > @rimitive/core > InstrumentationContext

Instrumentation context for debugging and profiling.

Passed to the instrument hook of modules when instrumentation is enabled.

Signature:

export type InstrumentationContext = {
contextId: string;
contextName: string;
emit(event: {
type: string;
timestamp: number;
data: Record<string, unknown>;
}): void;
register<T>(resource: T, type: string, name?: string): {
id: string;
resource: T;
};
};
const Signal = defineModule({
name: 'signal',
create: ({ graphEdges }) => (value) => createSignal(value, graphEdges),
instrument(impl, instr) {
return (value) => {
const sig = impl(value);
instr.register(sig, 'signal');
return sig;
};
},
});