apache kafka – Sending events (for analytics) for the same transaction, from front end and back end

In my application, the user makes transactions, that trigger events, that can later be analyzed or aggregated in dashboards. Each event has a schema (so for example, {"name": pressedLikeButton", "user_id": 123, "post_id": "123123"}).

Sometimes, we might wish (for analytics purposes) to query data from the frontend as well.

We’re debating whether –

  1. Front end should be in charge of events (since it has all the relevant context). This feels a little weird, since front end is not a source of truth; and also this might be an issue from a data tampering/consistency point of view.
  2. Back end should be in charge of events (and then it needs to receive some additional context from the front end).
  3. Each should send their own events, and then something in the data engineering/analytics layers will join them to uncover the full data.

Are there relevant tools or best practices?

Read more here: Source link