Skip to main content

Traces exporter

Traces exporter

The tracesExporter callback gives you full control over how collected trace events are handled.
It receives a TraceExporterData object containing all trace data that the SDK has collected.

Setting it redirects your traces rather than copying them. The span data is removed from what the SDK sends to Coralogix and delivered to your callback instead, so Coralogix stops receiving traces until you forward them yourself from inside the callback.

This happens per batch, and only for batches that carry OpenTelemetry span data. When one does, the strip applies to every log in it, not only to custom spans: views, errors and network events still reach Coralogix as RUM events, but without their instrumentation_data, the field holding request and response span detail. A batch with no span data at all is sent unchanged and your callback is not called for it.

Treat the payload as a subset rather than a mirror. A span missing its trace id, span id, name or timestamps is dropped from the conversion, as is one whose timestamps fall outside the accepted window - more than an hour ahead or a day behind. Those spans can still reach Coralogix inside the RUM payload without a matching entry in what your callback receives, so resource_spans can be shorter than you expect, or empty.

Warning

The callback runs inline on the path that sends the RUM payload, and it is not wrapped. An exception escaping your callback also stops that batch reaching Coralogix, so keep your own work inside a try/catch.

CoralogixRum.init({
tracesExporter: (data: TraceExporterData) => {
fetch('https://api.mycompany.com/rum-traces', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
});
},
});
Last updated on
On this page
Was this page helpful?