Repository navigation
Hand the web request to the pipeline in the IP Intelligence web examples - #119
Merged
Merged
Conversation
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.
Problem
The Usage Sharing Element accepts no Evidence, and shares what it finds in the web request that the web integration adds as
server.http-request, together with the Evidence given to the Pipeline (found_evidenceinshare_usage.pylines 432 to 458 at 5b5a833).webevidenceinpipeline/fiftyone_pipeline_core/src/fiftyone_pipeline_core/web.pyline 139 adds it for every request it reads.Every web example in this repository calls
webevidenceapart from the two IP Intelligence ones, which add only the Evidence their engine reads (query.client-ip, and on-premiseheader.accept-languageandquery.translation). Both build a Pipeline with usage sharing on, the default, so usage sharing in those two examples shares no other header of the request.What the specification says
web-integration.md, Populating Evidence, lines 65 to 68, "Whichever approach it takes, the web integration MUST also add the web request itself to Evidence under the key
server.http-request, whether or not any Flow Element accepts that key. The value is a read-only view of the request with these named parts, and the web integration adds it on every request."usage-sharing-element.md, Accepted Evidence, lines 18 to 27, says the element shares what it finds in two places, "every Evidence value in the Flow Data" and every header other than Cookie, cookie, query string parameter and session value of the web request "when the web integration supplies the request as
server.http-request", and "This is how a header that no other Flow Element accepts is still shared."An example that builds its Evidence by hand is its own web integration, so it hands over the request as the Device Detection, location and pipeline web examples already do through
webevidence.What changed
cloud/gettingstarted_web/app.pyandonpremise/gettingstarted_web/app.pyinfiftyone_ipintelligence_exampleshand the whole request to the Pipeline withflowdata.evidence.add_from_dict(webevidence(request))before they add their own Evidence, as the Device Detection, location and pipeline web examples do. The Evidence they add after it is unchanged, andwebevidencealso adds every query parameter asquery.<name>(web.pyline 98). The IP Intelligence on-premise specification, "Choosing the IP address" lines 151 to 166, uses thequerykeys first in the data file's order, "for exampletrue-client-ip-51d, thenclient-ip-51d, thenclient-ip". So a request whose URL also carriestrue-client-ip-51dorclient-ip-51dis now looked up by that address, as the specification says. A request with no other client IP query parameter is looked up by the same address as before.test_web_examples_hand_over_request.pyis new. It reads both examples' source and fails if a function that makes Flow Data does not callwebevidence. It reads the source, so it needs no data file and no network.The examples package is tested but never published, so the release plan releases nothing for this change.
How it was verified
Both test runs are temporary branches holding a workflow that installs the pipeline packages from the checkout into a virtual environment of the runner's own Python (3.12.3 on Ubuntu, 3.12.10 on Windows) and runs the new test with pytest, on
ubuntu-latestandwindows-latest.rcat 5b5a8332 with the new test alone, commit 7e6b128, run 43519111679, failed on both with2 failed, 1 passed. The two failures are the two examples'indexroutes, each with'webevidence' not foundamong the names the route calls.1 passed, 2 subtests passed.tools/pr-matrix.pyontmp/pr-matrix-119, finished with success. Configure printed "Left out 5 macOS entries", and the 11Setting 'PullRequestSha'lines (Configure and the ten Build and Test jobs, Python 3.10 to 3.14 on Ubuntu and Windows) all give c94716c. macOS was left out of this draft's full build under the 9 November decision. The rc head is built with macOS before it merges into main.The head is 2 commits on
rcat 5b5a833 and merges with today'srcwithout conflict.What remains
Nothing in this draft. The last release into
mainwas #114, merged at 06:22 UTC on 13 November.