What it is
License-key usage tracking is the audit trail behind MokoGIT's licensing. Each license key accumulates a list of usage entries, one per update check, stored in the license_key_usage table. An entry records:
- Key and repository the check was made against.
- Domain - the site that made the request, taken from the update query.
- IP address of the requester.
- User-agent string of the client.
- Version-from - the version the client is updating away from.
- Timestamp - when the check happened (indexed, so recent-first queries are cheap).
Nothing here identifies an end user; it is operational telemetry about where and how a paid key is being exercised.
Why and when it matters
Usage tracking does two jobs. First, it is visibility: you (as a repo admin) can see a key's recent activity - which domains are pulling updates, from what versions, and how often - which is invaluable for support ("is their site even reaching us?"), for spotting a key being shared far beyond what was sold, and for understanding upgrade adoption across your customer base.
Second, and more structurally, it is the data source for site-limit enforcement. A license package can cap how many distinct sites a single key may activate (its max sites). MokoGIT does not keep a separate "activations" ledger for this - it derives the current site count directly from the distinct domains seen in the usage history. The usage log is therefore not just a report; it is the system of record that domain limiting is computed from.
How it works
When a licensed client performs an update check against a repo whose feed requires a license key, MokoGIT validates the key and then, on success, does two things in sequence:
- Touches the heartbeat - stamps the key's last-seen time (and, on the very first successful check, its first-used time, which starts the domain-lock grace clock).
- Records usage - inserts a new
license_key_usagerow with the key ID, repo ID, the requesting domain, the caller's IP (RemoteAddr), the request's user-agent, and theversionquery value as the version-from.
The recording is best-effort: it is deliberately non-fatal, so a hiccup writing a usage row never blocks a legitimate customer's update. The update itself has already been authorized by validation before the row is written.
Unique-domain counting and site limits
The heart of enforcement is counting distinct domains for a key. MokoGIT asks the usage table for the number of different non-empty domains that key has ever been seen on. That count is compared against the key's effective max-sites - the per-key override if set, otherwise the package's max-sites (0 means unlimited).
Crucially, counting unique domains (not raw request count) is what lets the same site check in repeatedly without ever "using up" a seat, while a genuinely new domain is what consumes one. Because the check reads the real usage history, there is no drift between what the audit log shows and what the limiter believes.
Auto-association under the limit
For a key that has no explicit domain allow-list, the first site to use it is auto-associated (lock-on-first-use). That association runs inside a database transaction that both counts the existing unique domains and adds the new one atomically, so two simultaneous activations from different sites can never both slip past the cap and exceed max sites. When the limit is already reached, the new domain is rejected with a clear "site limit reached (used/max)" error.
Validation reflects live counts
When a client calls the public validate endpoint, the response includes the current sites_used (the live unique-domain count) alongside max_sites. A product can show its user "2 of 3 sites activated" straight from that response, and the number always matches what the usage log actually contains.
Viewing usage (UI and API)
Through the API, a repo admin can pull a key's recent usage - up to the 100 most recent entries, newest first:
curl -H "Authorization: token YOUR_TOKEN" \
https://git.mokoenterprises.us/api/v2/repos/OWNER/REPO/license-keys/{id}/usage
Each entry in the response carries the key ID, repo ID, domain, IP address, user-agent, version-from, and creation time. Access is gated: the endpoint first confirms the key belongs to the calling repo's owner, so a repo admin cannot read another org's domains and IPs by guessing a key ID.
In the web UI, the same history is surfaced on a key's detail view under the repository's Licenses area, so you can review a key's recent activity without scripting an API call.
Step by step: watching a key's footprint
- Issue or locate the license key you want to inspect under {owner}/{repo} then Licenses.
- Have the licensed product perform an update check (or call the validate endpoint with the key and its domain).
- Open the key's usage view in the UI, or call the
/usageendpoint, to see the new entry appear with its domain, IP, user-agent, and version-from. - Compare
sites_usedagainst the package's max sites - either from the validate response or by counting the distinct domains in the usage list - to confirm how many seats the key has consumed.
Caveats
- Only checks that pass validation and carry a domain contribute to unique-domain counting; the domain comes from the update request, so a client that omits it is not counted toward the site total (and a key that declares a domain restriction refuses to validate without one).
- Usage recording is best-effort and non-blocking - a failed insert will not stop a customer's update, so the log is operationally complete but not a hard transactional guarantee of every single request.
- Usage entries are retained to support the distinct-domain count; the key-level site limit is derived from them, not from a separate counter, so pruning usage history would also reset what the limiter sees.
- The usage endpoint returns the 100 most recent entries. For long-term analytics, pull periodically rather than expecting the full lifetime history in one call.
- Reading a key's usage requires repo-admin rights and token auth, and only ever exposes keys owned by that repo's owner.
Get help
Open a support ticket or call (931) 820-0265.