docs(activity-data): document apiUsage map_id + workflow_id columns#47
Merged
Conversation
The apiUsage table carries map_id and workflow_id columns, but the documented schema omitted them — leading to the assumption that quota could only be attributed to maps by proxying through MapLoadedEvent / OpenBuilderMap activity events. - Add both columns to the canonical schema row in activity-queries.md - Add a "Quota consumption by map (or workflow)" example that groups apiUsage directly by map_id / workflow_id, with notes on NULL rows, public-map (anonymous-viewer) attribution, per-metric breakdown, and resolving a map_id to its name via `carto maps get` - Cross-link from the per-user attribution section in org-and-quotas.md Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
palenz
approved these changes
Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Activity Data
apiUsagetable carriesmap_idandworkflow_idcolumns, but the documented schema omitted them. This led to the (wrong) assumption that usage-quota consumption could only be attributed to a map by proxying throughMapLoadedEvent/OpenBuilderMapactivity events.Verified against the actual export:
Changes
activity-queries.md— addmap_id+workflow_idto the canonicalapiUsageschema row, and add a "Quota consumption by map (or workflow)" SQL example that groupsapiUsagedirectly bymap_id/workflow_id. Notes cover: NULL rows (non-map/non-workflow surfaces), public-map anonymous-viewer attribution (NULL user_id), per-metricbreakdown of a single map, and resolving amap_idto its name viacarto maps get(which respects map-level ACLs).org-and-quotas.md— cross-link the per-user attribution section to the new per-map pattern.Why it matters
Answering "which maps drive our quota consumption?" is a common admin/PM question. The direct path (
GROUP BY map_id) is simpler and more accurate than reconstructing it from event counts — but only discoverable if the columns are documented.🤖 Generated with Claude Code