I have built a Jira app using Forge with AI functionality where token usage is restricted and currently working fine. The app is now published on the Atlassian Marketplace and is being used by multiple customers.
Challenge:
We are unable to track per-user or per-tenant token usage.
Current setup:
Questions: What is the recommended way to track token usage in a Forge app?
Thanks in advance!
Hello Vitheya,
thanks for your question which is important for anyone offering AI-based Forge apps through the Marketplace.
Unfortunately I haven’t tried implementing detailed token usage tracking myself yet, but I found some relevant information in the official Atlassian Forge documentation that may help point you in the right direction.
Currently, Forge doesn’t provide a built-in mechanism to track per-user or per-tenant API token usage out of the box. Since Forge storage is scoped to the app and environment, it’s well-suited for storing usage counters or summaries per tenant (installation), but not for detailed per-user analytics unless you implement that logic yourself.
Here are a few approaches that align with Atlassian’s recommended practices:
usage:{accountId} or usage:{tenantId}.In short, for fine-grained tracking (like per-user token usage), the best practice is to:
Hope that helps clarify the options! You can also check out the official docs on Forge storage and external data connections for more details and examples.
Greetings and Happy New Year,
Alex
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.