Function type for determining whether a span should be exported to Langfuse.
If provided, this is treated as a full override of the default filtering behavior.
Langfuse may call this predicate both when a span starts for app-root classification
and when the span ends for export filtering. Prefer side-effect-free predicates; the
start-time call sees only attributes available at span creation, and end-time fields
such as duration may not be populated yet.
Type declaration
(params:{otelSpan:ReadableSpan}):boolean
Parameters
params: {otelSpan:ReadableSpan}
Object containing the span to evaluate
otelSpan: ReadableSpan
The OpenTelemetry span to evaluate
Returns boolean
true if the span should be exported, false otherwise
Example
constshouldExportSpan: ShouldExportSpan = ({ otelSpan }) => { // Only export spans that took longer than 100ms returnotelSpan.duration[0] * 1000 + otelSpan.duration[1] / 1000000 > 100; };
Function type for determining whether a span should be exported to Langfuse. If provided, this is treated as a full override of the default filtering behavior. Langfuse may call this predicate both when a span starts for app-root classification and when the span ends for export filtering. Prefer side-effect-free predicates; the start-time call sees only attributes available at span creation, and end-time fields such as duration may not be populated yet.