Skip to content

Add query-param fallback to analytics ignore check - #22

Merged
Gutts-n merged 1 commit into
mainfrom
feat/ignore-query-param
Aug 28, 2026
Merged

Add query-param fallback to analytics ignore check#22
Gutts-n merged 1 commit into
mainfrom
feat/ignore-query-param

Conversation

@Gutts-n

@Gutts-n Gutts-n commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

What changed

Added ANALYTICS_IGNORE_QUERY_PARAM alongside the header/values/IP checks.
A request whose query string carries this param with a matching value
(from the same ANALYTICS_IGNORE_VALUES list) skips analytics logging the
same way - any one of the four checks (header, query param, IP) is enough.

Why

Part of the NESO API-usage-metrics work (neso-nextgen-shared#152). The
admin portal's resource-download buttons render plain <a href target="_blank"> links to /datastore/dump/{resource_id} - a browser
navigation, not a fetch() call, so no custom header can be attached at
all (browsers don't allow it). The admin portal already sends
Request-Source: admin-portal on every fetch()-based call
(datopian/dx-helm-neso#75); this closes the one gap that was flagged but
left open in that PR - the download links can carry the same value as a
query param instead (?request_source=admin-portal), since that's just a
URL, no header machinery needed.

Verified

  • pytest - 490 passed.
  • ruff check / mypy - clean.
  • New tests exercise the real use case directly: a /datastore/dump/...
    request with ?request_source=admin-portal is not recorded; the same
    URL without the param still is.

Not verified: the admin portal side (building the query param into the
download link) is a separate change in dx-helm-neso, not done yet.

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3ad32c59-48cf-482b-8f50-99c1b684b674


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Gutts-n
Gutts-n merged commit ad2a1a4 into main Aug 28, 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.

1 participant