-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AnalyticsEvent.endpoint
includes the HTTP request method
#66
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great start, but there are a few more changes we'll need on this PR:
-
Please update L60 of the
Makefile
:Line 60 in 1aca996
@$(RUN_NO_DEPS) black --check fideslog/ such that it becomes:
@$(RUN_NO_DEPS) black --check --exclude="sdk/python/_version\.py" fideslog/
This is because this will be the first PR opened since
versioneer
was added to the repo, and so the CI checks have never been run with those auto-generated files included. We need to ignore_version.py
from this check, or it will always fail. -
In
sdk/python/event.py
:-
Please update the
AnalyticsEvent
constructor docstring to match the updated documentation inapi/models/analytics_event.py
:fideslog/fideslog/sdk/python/event.py
Line 36 in 1aca996
:param endpoint: For events submitted as a result of making API server requests, the API endpoint path that was requested. If a fully-qualified URL is provided, only the URL path will be persisted. -
Please update the validation code to match the new validation code in
api/models/analytics_event.py
:fideslog/fideslog/sdk/python/event.py
Lines 71 to 74 in 1aca996
self.endpoint = None if endpoint is not None: assert urlparse(endpoint).path != "", "endpoint must include a URL path" self.endpoint = endpoint
-
-
In
tests/api/test_models.py
, please update thetest_full_payload
fixture:fideslog/tests/api/test_models.py
Line 24 in 1aca996
"endpoint": "https://www.example.com/path/string",
AnalyticsEvent.endpoint
includes the HTTP request method
Updated based on your suggestions, thanks for the review, @PSalant726 ! Re: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making all the static analysis related changes! Sorry you got stuck with those, that's my fault 😞
This is looking really good now - just some minor suggestions!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just one UX question for you.
The only way to guarantee that we store just the URL path is to accept a full URL, validate it, and then truncate it to only the URL path. Also prevents the Python SDK from importing from the API server code.
By modifying the API endpoint URL within the `AnalyticsEvent` validation mechanism, we prevent continued validations of `AnalyticsEvent` instances from succeeding. In order to guarantee that API endpoint URLs only have their paths stored in the database, truncation must occur immediately prior to writing the new record.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PSalant726 Just 1 blocking change request, otherwise looking good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thumbs up, tested manually full-stack and all looks good.
Purpose
Allows http method to be captured in analytics events
Closes #65