Add source-IP fallback to analytics ignore check - #21
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 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. Comment |
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 changed
Added
ANALYTICS_IGNORE_IPS(comma-separated) alongside the existingANALYTICS_IGNORE_HEADER/ANALYTICS_IGNORE_VALUES. A request from aconfigured IP skips analytics logging the same way a matching header does
Why
Part of the NESO API-usage-metrics work (neso-nextgen-shared#152). The DXP
frontend (the public-facing NESO data portal, separate from the admin
portal and Data Explorer) still doesn't send an identifying header - that
part of the original ask (neso-nextgen-shared#145) is still open. In the
meantime, the DXP team reported their web server's static egress IPs for
production:
https://github.com/datopian/client-national-grid-shared/issues/496#issuecomment-3158622385
(
54.247.74.82,63.32.18.228).IP is explicitly a weaker, secondary signal - callable out in #145's
original ask too ("useful, but as a secondary check... an IP-based rule
would need constant maintenance, and when it fell out of date it would
fail silently"). It's a stopgap until the header lands, not a replacement
for it.
Verified
pytest- 488 passed.ruff check/mypy- clean.checks are independent (either alone is sufficient).
Not verified: end-to-end against a live pipeline, and I have no way to
confirm those two IPs are still current from here - production traffic
isn't ingested into the monitoring stack I have access to. Whoever sets
ANALYTICS_IGNORE_IPSshould reconfirm with the DXP team first.