From 5d036bb48cc1bc12fec589b2270a04021181a647 Mon Sep 17 00:00:00 2001 From: James Greenhill Date: Thu, 3 Oct 2024 16:45:44 -0700 Subject: [PATCH] chore: use the wrapper token if it exists (#25381) --- livestream/kafka.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/livestream/kafka.go b/livestream/kafka.go index f8af88ea249..6d0929a2958 100644 --- a/livestream/kafka.go +++ b/livestream/kafka.go @@ -14,6 +14,7 @@ type PostHogEventWrapper struct { DistinctId string `json:"distinct_id"` Ip string `json:"ip"` Data string `json:"data"` + Token string `json:"token"` } type PostHogEvent struct { @@ -109,7 +110,9 @@ func (c *PostHogKafkaConsumer) Consume() { phEvent.Uuid = wrapperMessage.Uuid phEvent.DistinctId = wrapperMessage.DistinctId - if phEvent.Token == "" { + if wrapperMessage.Token != "" { + phEvent.Token = wrapperMessage.Token + } else if phEvent.Token == "" { if tokenValue, ok := phEvent.Properties["token"].(string); ok { phEvent.Token = tokenValue } else {