Skip to main content
Send a signal (boolean, numerical, or string metric) to a specific entity by its type and ID.

Signature

async function sendSignal(
  entityType: 'session' | 'trace' | 'span' | 'completion',
  entityId: string,
  name: string,
  value: string | boolean | number,
  signalType?: 'boolean' | 'numerical'
): Promise<void>

Parameters

entityType
'session' | 'trace' | 'span' | 'completion'
required
Type of entity to send the signal to.
entityId
string
required
UUID of the entity to send the signal to.
name
string
required
Name of the signal.
value
string | boolean | number
required
Value of the signal. Can be a string, boolean, or number.
signalType
'boolean' | 'numerical'
Optional signal type. If not provided, the type will be auto-detected based on the value.

Returns

A Promise<void> that resolves when the signal has been sent.

Examples

Send a numerical signal to a trace

import { sendSignal } from 'zeroeval';

await sendSignal('trace', traceId, 'execution_time_ms', 1234);

Send a boolean signal to a session

import { sendSignal } from 'zeroeval';

await sendSignal('session', sessionId, 'user_engagement_score', 0.85);

Send a signal with explicit type

import { sendSignal } from 'zeroeval';

await sendSignal('span', spanId, 'cache_hit', true, 'boolean');

Build docs developers (and LLMs) love