Snowplow Collector Event Key - How it is calculated

Hello Everyone,

How are you?
We are looking into Scala Stream Collector Code,

And The key used to distribute records among the shards of the Kinesis Data Stream is the
prre.setPartitionKey(event.key)

Where does this come from? Where is this key set? We are currently using the Snowplow Trackers for Android and IOS. Is this key calculated there?
And more importantly, how is this key calculated? Which fields are being used for it? :open_mouth:

Thanks you in advance!!!
Best,
Raúl

In the collector config you have the option of setting the IP address as the partition key using the collector.streams.useIpAddressAsPartitionKey config flag (to either true or false).

If this is set to true and the collector is able to extract a valid IP address it will use this as the partition key. If this value is set to false or a valid IP address can’t be extracted then a UUID4 string is used as the partition key instead. It’s not currently possible (and I don’t think would be added) to configure this key in any of the trackers - only the collector itself.