Tagging every Croct event with our release version, is eventMetadata the right tool?
I tag everything we ship with the release version so regressions can be correlated with deploys. I want the same for Croct events: every event annotated with the version of the app build that sent it.
I found the eventMetadata option in the plug docs but the description is short. Before I wire it into the release pipeline I need the exact limits:
- How many entries can it hold?
- Is it static per plug call or can it change per event?
- Does it share a limit with the context attributes we pass to fetch calls, or are those counted separately
1 answer
eventMetadata is the right tool for this, and here are your exact numbers:
-
Maximum of 5 entries. A version string plus a build ID fits comfortably with room to spare.
-
It is static metadata attached to every event for the lifetime of the plug instance. You set it once at plug time, typically from an env var your release pipeline injects:
eventMetadata: { appVersion: process.env.NEXT_PUBLIC_APP_VERSION,}For per-event data you would use the event payload itself, not metadata.
-
Counted separately. Context attributes passed to fetch and evaluate calls have their own limit of 30 entries nested up to 5 levels deep, completely independent of the 5-entry metadata cap.
So: inject the version at build time, set it in eventMetadata, and every event from that build carries it. Exactly the correlation setup you described.