Skip to content

feat: require explicit metrics and add scope flags - #22

Open
adressop6789-max wants to merge 2 commits into
mainfrom
feature/ASA-794-explicit-metrics
Open

feat: require explicit metrics and add scope flags#22
adressop6789-max wants to merge 2 commits into
mainfrom
feature/ASA-794-explicit-metrics

Conversation

@adressop6789-max

Copy link
Copy Markdown
Collaborator

Pairs with asa-analytics!1584, which makes metrics required on POST /cli/metrics/.

Why the backend changed: subscribers and paid_subscribers are exact-uniqueness aggregations over profile ids, one hash set per entity per renewal window. On a keyword list that measured 11.4 GB against 0.13 GB for the same page without them, and production ClickHouse killed 17 queries on it. Omitting --metric used to mean "every column", which is how a paginated keyword export became the most expensive query on the cluster.

  • --metric is now required, and its help says why a short list matters.
  • New --app, --campaign, --ad-group scope filters go into the request body as app_id / campaign_id / ad_group_id. They are what unlocks subscribers on --entity keyword (the backend refuses those metrics account-wide with 422 cli_metric_scope_too_wide), and the cheapest way to make any keyword call fast.
  • Agent docs and the flag table updated to match.

Ship to npm together with the backend: a client without --metric gets 422 after that deploy.

tsc -b clean, 174 mocha tests passing.

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.

1 participant