When you add a transformation and connect it to a destination supporting cloud mode, RudderStack:
- Tracks and collects events at the source.
- Applies the transformation logic to the your events.
- Forwards the transformed event to your connected destination.
Debugging transformations
Once you add a transformation, you can capture any event-related information in the form of logs while running a test on your transformation. You can do this by including the log
function in your transformation code.
An example of using the log
function is shown below:
export function transformEvent(event, metadata) { const meta = metadata(event); event.sourceId = meta.sourceId;
log("Event Name is", event.event, ";", "Message ID is", event.messageId); log("Source ID is", meta.sourceId);
return event;}
On adding the above transformation and clicking Run Test, you can see the resulting log in the Logs section of the dashboard, as shown:
log
function.Applying transformation on a batch of events
You can also perform any aggregation or roll-up operation on a batch of events using the transformBatch
function instead of transformEvent
, as shown:
export function transformBatch(events, metadata) { return events;}
transformBatch
, make sure you pass the messageId
from the input event to the output event. Without the messageId
, RudderStack will not guarantee the event ordering. It is highly recommended to use transformEvent
as much as possible, as it ensures event ordering.Limitations
The transformation fails if the following memory and time limits are exceeded:
Parameter | Limit |
---|---|
Memory limit | 128 MB |
Execution time limit | 4 seconds |
Contact us
For more information on the topics covered on this page, email us or start a conversation in our Slack community.