-
Notifications
You must be signed in to change notification settings - Fork 7
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
PP-495 Analytics as a container service #1487
Conversation
Analytics is no more a singleton, and is not library dependant Analytics will be configured through env vars now and not the admin ui
The GET method returns a problem detail for the UI to display
… is created only once
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1487 +/- ##
==========================================
- Coverage 90.42% 90.37% -0.05%
==========================================
Files 231 232 +1
Lines 29513 29330 -183
Branches 6892 6852 -40
==========================================
- Hits 26687 26507 -180
- Misses 1798 1800 +2
+ Partials 1028 1023 -5
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
I haven't started a code review here, but it looks there will be some deployment changes associated with this PR (I've added a label for that). Specifically, it looks like we add at least the following environment variables:
It would be helpful to document these in the README. |
I added the UI update label as well, since this will require an admin UI update. |
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.
Just a few more comments on this one. Its looking good otherwise!
We also need two additional PRs before this can get merged:
- Add the new env var to the hosting-playbook
- Remove the analytics configuration from the admin interface
Can you work on those as well?
@@ -484,22 +484,6 @@ def metadata_service_self_tests(identifier): | |||
) | |||
|
|||
|
|||
@app.route("/admin/analytics_services", methods=["GET", "POST"]) |
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.
Can you make a PR to the admin interface to remove the analytics service component on that side as well?
README.md
Outdated
|
||
For generating quicksight dashboard links the following environment variable is required | ||
`QUICKSIGHT_AUTHORIZED_ARNS` - A dictionary of the format `"<dashboard name>": ["arn:aws:quicksight:...",...]` | ||
where each quicksight dashboard gets treated with an arbitrary "name", and a list of "authorized arns". | ||
The first the "authorized arns" is always considered as the `InitialDashboardID` when creating an embed URL | ||
for the respective "dashboard name". | ||
|
||
#### Analytics | ||
|
||
To enabled S3 based analytics add `PALACE_S3_ANALYTICS_ENABLED=true` else do not add the environment variable at all. |
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.
Suggested update:
Local analytics are enabled by default. S3 analytics can be enabled via the following environment variable:
PALACE_S3_ANALYTICS_ENABLED
: A boolean value to disable or enable s3 analytics. The default isfalse
.
@@ -1564,10 +1599,10 @@ def test_end_to_end( | |||
# book, and one to the metadata endpoint for information about | |||
# that book. | |||
api = default_monitor.api |
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.
Minor: If you wanted to avoid the # type: ignore [attr-defined]
comments here, you could do:
api = cast(MockBibliothecaAPI, default_monitor.api)
Since we inject the Analytics provider directly, this is unneeded
Sure, I'll make tickets for them and get started. |
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 looks good!
Before this gets merged, we should make sure that:
- PR for hosting playbook is merged and deployed
- PR for admin UI is merged
So that everything stays in sync.
Description
Using the
dependency_injector
framework, the Analytics class has been moved into a Container as a Singleton.The Analytics no longer supports per library configurations, any configuration is for the entire CM.
Configurations have been moved to environment variables.
The API objects also make use of the dependency injection pattern for analytics.
The Admin UI for the Analytics service will display a "This service is no longer configurable" message.
Database entries for Analytics have not been removed in case a rollback is required.
Motivation and Context
The CM no longer needed per-library Analytics, it required only CM-wide configurations, not via the Admin Panel.
JIRA
How Has This Been Tested?
Manually tested some feeds and Admin pages.
Updated all unit tests to reflect the new patterns.
Checklist