Skip to content
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

[feature] Consent mechanism for clean insights measurements #452 #458

Merged
merged 4 commits into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,10 @@ Below are listed all the variables you can customize (you may also want to take
openwisp2_extra_supervisor_restart:
- name: my_custom_service
when: my_custom_service_enabled
# Disable usage metric collection. It is enabled by default.
# Read more about it at
# https://openwisp.io/docs/user/usage-metric-collection.html
openwisp2_usage_metric_collection_consent: false
# enable sentry example
openwisp2_sentry:
dsn: "https://7d2e3cd61acc32eca1fb2a390f7b55e1:[email protected]:443/12345"
Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,4 @@ openwisp2_django_cors:
allowed_origins_list: []
replace_https_referer: false
openwisp2_extra_supervisor_restart: []
openwisp2_usage_metric_collection_consent: null
12 changes: 12 additions & 0 deletions molecule/resources/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@
file:
path: /.dockerenv
state: absent
# TODO: Remove before merging
tasks:
- name: Install openwisp-utils metric collection
pip:
name: "openwisp-utils @ https://github.com/openwisp/openwisp-utils/tarball/issues/360-clean-insights"
state: forcereinstall
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
environment:
SETUPTOOLS_USE_DISTUTILS: stdlib
notify: Reload application
tags: [extra_pip, molecule-idempotence-notest]

roles:
- role: openwisp.openwisp2
24 changes: 24 additions & 0 deletions tasks/consent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---

- name: Show usage metric collection disclaimer
debug:
msg: |
By continuing with the ongoing installation process,
you are giving your consent for the collection of usage metrics
mentioned at https://openwisp.io/docs/user/usage-metric-collection.html

If you prefer not to participate, you can opt-out by configuring
pandafy marked this conversation as resolved.
Show resolved Hide resolved
"openwisp2_usage_metric_collection_consent: false" in your playbook.
However, before making that decision, we encourage you to explore how this
information contributes to the enhancement of OpenWISP at the following link:
https://openwisp.io/docs/user/usage-metric-collection.html

Should you wish to support us through data collection but prefer to disable
this disclaimer, you can do so by setting
"openwisp2_usage_metric_collection_consent: true" in your playbook.
when: "openwisp2_usage_metric_collection_consent == None"

- name: Ensure user has enough time to read
pause:
seconds: 30
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's bring this down to 13 seconds

when: "openwisp2_usage_metric_collection_consent == None"
3 changes: 3 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---

- import_tasks: apt.yml
tags: [openwisp2, ci_consent]

- import_tasks: apt.yml
tags: [openwisp2, apt]

Expand Down
9 changes: 9 additions & 0 deletions templates/openwisp2/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
# openwisp2 admin theme
# (must be loaded here)
'openwisp_utils.admin_theme',
{% if openwisp2_usage_metric_collection_consent %}
'openwisp_utils.measurements',
{% endif %}
'admin_auto_filters',
# admin
'django.contrib.admin',
Expand Down Expand Up @@ -318,6 +321,12 @@
'relative': True,
},
{% endif %}
{% if openwisp2_usage_metric_collection_consent %}
'send_usage_metrics': {
'task': 'openwisp_utils.measurements.tasks.send_usage_metrics',
'schedule': timedelta(days=7),
},
{% endif %}
{% endif %}
}

Expand Down
Loading