Skip to content

docs(activity-data): document apiUsage map_id + workflow_id columns#47

Merged
srtena merged 1 commit into
masterfrom
docs/apiusage-map-workflow-id
Jun 9, 2026
Merged

docs(activity-data): document apiUsage map_id + workflow_id columns#47
srtena merged 1 commit into
masterfrom
docs/apiusage-map-workflow-id

Conversation

@srtena

@srtena srtena commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

What

The Activity Data apiUsage table carries map_id and workflow_id columns, 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 through MapLoadedEvent / OpenBuilderMap activity events.

Verified against the actual export:

$ DESCRIBE SELECT * FROM read_parquet('<cache>/apiUsage-001.parquet')
ts                 | TIMESTAMP
user_id            | VARCHAR
metric             | VARCHAR
amount             | DECIMAL(38,9)
map_id             | VARCHAR      ← undocumented
workflow_id        | VARCHAR      ← undocumented
quota_usage_weight | DECIMAL(38,9)

Changes

  • activity-queries.md — add map_id + workflow_id to the canonical apiUsage schema row, and add a "Quota consumption by map (or workflow)" SQL example that groups apiUsage directly by map_id / workflow_id. Notes cover: NULL rows (non-map/non-workflow surfaces), public-map anonymous-viewer attribution (NULL user_id), per-metric breakdown of a single map, and resolving a map_id to its name via carto 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

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>
@srtena
srtena merged commit 8e73b02 into master Jun 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants