- TypeScript
- Python
observe(options, fn, …args)
Wrap a function to create a span. Automatically captures inputs, outputs, and errors.| Name | Type | Default | Description |
|---|---|---|---|
name | string | fn.name | Span name |
sessionId | string | — | Associate trace with session |
userId | string | — | Associate trace with user |
metadata | Record<string, any> | — | Trace metadata (JSON-serializable) |
tags | string[] | — | Span tags (deduplicated) |
traceType | 'DEFAULT' | 'EVALUATION' | 'DEFAULT' | Trace type |
spanType | 'DEFAULT' | 'LLM' | 'TOOL' | 'EXECUTOR' | 'EVALUATOR' | 'EVALUATION' | 'DEFAULT' | Span type |
input | any | — | Explicit input (overrides function args) |
ignoreInput | boolean | false | Don’t record input |
ignoreOutput | boolean | false | Don’t record output |
parentSpanContext | string | LaminarSpanContext | — | Parent context for distributed tracing |
Promise<ReturnType<F>>Behavior:- If one non-Map object argument, records that object as input; otherwise records array
- Maps converted to entries, circular references become
"[Circular reference]" - Exceptions recorded via
recordExceptionand re-thrown - Anonymous function name becomes
""ifnamenot provided - Works with both sync and async functions
observeDecorator(config)
Class method decorator version ofobserve.observe options. Config can be an object or a function (thisArg, ...args) => config for per-call configuration.Returns: Method decorator