All questions

Tagging every Croct event with our release version, is eventMetadata the right tool?

Asked by Klara Novotna on

KNKlara Novotna

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:

  1. How many entries can it hold?
  2. Is it static per plug call or can it change per event?
  3. Does it share a limit with the context attributes we pass to fetch calls, or are those counted separately
Was this helpful?

1 answer

LFLucia Ferreira

eventMetadata is the right tool for this, and here are your exact numbers:

  1. Maximum of 5 entries. A version string plus a build ID fits comfortably with room to spare.

  2. 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.

  3. 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.

Was this helpful?
Still have questions?