Interface: FusionSpan
Defined in: packages/core/src/observability/Tracing.ts:98
Minimal span interface — structural subtype of OTel's Span.
All methods match OTel's signatures so that an OTel Span satisfies this interface without any adapter.
See
Methods
addEvent()?
optional addEvent(name, attributes?): void;Defined in: packages/core/src/observability/Tracing.ts:125
Add a timestamped event to this span.
Optional — not all tracer implementations support events. The pipeline uses span.addEvent?.() (optional chaining).
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | Event name (e.g. 'mcp.route', 'mcp.validate') |
attributes? | Record<string, FusionAttributeValue> | Optional event attributes |
Returns
void
end()
end(): void;Defined in: packages/core/src/observability/Tracing.ts:131
End this span. Must be called exactly once. The pipeline calls this in a finally block to prevent span leaks.
Returns
void
recordException()
recordException(exception): void;Defined in: packages/core/src/observability/Tracing.ts:139
Record an exception as a span event. Called before setStatus(ERROR) when a handler throws.
Parameters
| Parameter | Type | Description |
|---|---|---|
exception | string | Error | The caught error or string message |
Returns
void
setAttribute()
setAttribute(key, value): void;Defined in: packages/core/src/observability/Tracing.ts:104
Set a single attribute on this span.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | Attribute key (use mcp.* namespace for MCP Fusion attributes) |
value | FusionAttributeValue | Primitive or array of primitives |
Returns
void
setStatus()
setStatus(status): void;Defined in: packages/core/src/observability/Tracing.ts:114
Set the span's status.
Use SpanStatusCode.UNSET for AI/validation errors. Use SpanStatusCode.ERROR only for system failures (handler exceptions).
Parameters
| Parameter | Type | Description |
|---|---|---|
status | { code: number; message?: string; } | Object with code and optional message |
status.code | number | - |
status.message? | string | - |
Returns
void