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

[MAINTENANCE] Refactor legacy anonymous_usage_statistics into new top-level fields #9891

Merged
merged 21 commits into from
May 8, 2024

Conversation

cdkini
Copy link
Member

@cdkini cdkini commented May 7, 2024

We're removing anonymous_usage_statistics in favor of two new top-level config options: analytics (a bool) and data_context_id (an optional UUID)

  • Description of PR changes above includes a link to an existing GitHub issue
  • PR title is prefixed with one of: [BUGFIX], [FEATURE], [DOCS], [MAINTENANCE], [CONTRIB]
  • Code is linted - run invoke lint (uses ruff format + ruff check)
  • Appropriate tests and docs have been updated

For more information about contributing, see Contribute.

After you submit your PR, keep the page open and monitor the statuses of the various checks made by our continuous integration process at the bottom of the page. Please fix any issues that come up and reach out on Slack if you need help. Thanks for contributing!

Copy link

netlify bot commented May 7, 2024

Deploy Preview for niobium-lead-7998 ready!

Name Link
🔨 Latest commit 4ec3478
🔍 Latest deploy log https://app.netlify.com/sites/niobium-lead-7998/deploys/663bc1cf0f02490008d68745
😎 Deploy Preview https://deploy-preview-9891.docs.greatexpectations.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@@ -57,7 +57,7 @@ def fixed_length_key(self):
def store_name(self):
return self._store_name

def _construct_store_backend_id(self, suppress_warning: bool = False) -> Optional[str]:
def _construct_store_backend_id(self, suppress_warning: bool = False) -> Optional[uuid.UUID]:
Copy link
Member Author

Choose a reason for hiding this comment

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

Actively trying to fight against primitive obsession here - the data_context_id top level field has the opportunity to be a rich type instead of a string UUID

@@ -1,7 +0,0 @@
[ge_cloud_config]
Copy link
Member Author

Choose a reason for hiding this comment

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

Unused test fixtures

Copy link

codecov bot commented May 7, 2024

Codecov Report

Attention: Patch coverage is 87.93103% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 77.33%. Comparing base (a1c0c5a) to head (4ec3478).

Files Patch % Lines
...ions/data_context/migrator/configuration_bundle.py 33.33% 4 Missing ⚠️
...xpectations/data_context/data_context_variables.py 84.61% 2 Missing ⚠️
...ns/data_context/data_context/cloud_data_context.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9891      +/-   ##
===========================================
- Coverage    77.36%   77.33%   -0.03%     
===========================================
  Files          493      493              
  Lines        42360    42238     -122     
===========================================
- Hits         32770    32665     -105     
+ Misses        9590     9573      -17     
Flag Coverage Δ
3.10 63.92% <86.20%> (-0.02%) ⬇️
3.11 63.91% <86.20%> (-0.02%) ⬇️
3.11 athena or clickhouse or openpyxl or pyarrow or project or sqlite or aws_creds 53.88% <75.86%> (-0.05%) ⬇️
3.11 aws_deps 44.68% <75.86%> (-0.08%) ⬇️
3.11 big 54.09% <74.13%> (-0.07%) ⬇️
3.11 databricks 45.87% <68.96%> (-0.09%) ⬇️
3.11 filesystem 59.27% <86.20%> (-0.02%) ⬇️
3.11 mssql 48.63% <68.96%> (-0.07%) ⬇️
3.11 mysql 48.69% <68.96%> (-0.07%) ⬇️
3.11 postgresql 52.59% <72.41%> (-0.07%) ⬇️
3.11 snowflake 46.50% <72.41%> (-0.07%) ⬇️
3.11 spark 56.15% <82.75%> (-0.02%) ⬇️
3.11 trino 50.67% <68.96%> (-0.07%) ⬇️
3.8 63.94% <86.20%> (-0.02%) ⬇️
3.8 athena or clickhouse or openpyxl or pyarrow or project or sqlite or aws_creds 53.89% <75.86%> (-0.05%) ⬇️
3.8 aws_deps 44.69% <75.86%> (-0.08%) ⬇️
3.8 big 54.10% <74.13%> (-0.07%) ⬇️
3.8 databricks 45.88% <68.96%> (-0.09%) ⬇️
3.8 filesystem 59.28% <86.20%> (-0.02%) ⬇️
3.8 mssql 48.61% <68.96%> (-0.07%) ⬇️
3.8 mysql 48.67% <68.96%> (-0.07%) ⬇️
3.8 postgresql 52.58% <72.41%> (-0.07%) ⬇️
3.8 snowflake 46.51% <72.41%> (-0.07%) ⬇️
3.8 spark 56.11% <82.75%> (-0.02%) ⬇️
3.8 trino 50.66% <68.96%> (-0.07%) ⬇️
3.9 63.93% <86.20%> (-0.02%) ⬇️
cloud 0.00% <0.00%> (ø)
docs-basic 47.35% <75.86%> (-0.08%) ⬇️
docs-creds-needed 48.82% <75.86%> (-0.07%) ⬇️
docs-spark 47.07% <75.86%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cdkini cdkini self-assigned this May 7, 2024
@cdkini cdkini changed the title [MAINTENANCE] Refactor legacy anonymous_usage_statistics into analytics and data_context_id top-level fields [MAINTENANCE] Refactor legacy anonymous_usage_statistics into new top-level fields May 7, 2024
anonymous_usage_statistics:
enabled: false
data_context_id: b6743b23-ed35-4b09-814d-88ba86566295
analytics: false
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at this now I feel like the name doesn't reflect that that it's a boolean. use_analytics maybe?

@@ -247,10 +247,6 @@ http://old.docs.greatexpectations.io/* http://648b46c2ec119e00089c4318--niobium-
/docs/reference/api/expectations/util.py /docs/reference/api/expectations/util
/docs/reference/api/render/util.py /docs/reference/api/render/util

# Redirects for renamed reference docs

/docs/reference/anonymous_usage_statistics /docs/reference/usage_statistics
Copy link
Contributor

Choose a reason for hiding this comment

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

My understanding is that we don't want to break links, and that this should redirect to the appropriate place in the legacy docs.

# Analytics are enabled by default
# A user can opt out through the config or by setting the environment variable
# If one is set to False, analytics will be disabled
enabled_from_config = True if enabled_from_config is None else enabled_from_config
Copy link
Contributor

Choose a reason for hiding this comment

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

Why aren't we just defining the param as enabled_from_config: bool = True? Maybe I'm missing context, but why does it being enabled from config determine anything about analytics?

@@ -297,11 +294,16 @@ def _init_factories(self) -> None:
)

def _init_analytics(self) -> None:
enabled_from_config = self.config.analytics
if enabled_from_config is None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Same thoughts as above - I don't understand how enabled_from_config ties to analytics, and we should avoid None if we can just ensure it's instantiated with a default True

usage_statistics_url: https://qa.stats.greatexpectations.io/great_expectations/v1/usage_statistics
enabled: false
data_context_id: f98647c3-0120-42ff-ae47-e48b8a6500cf
analytics: false
Copy link
Member Author

Choose a reason for hiding this comment

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

analytics_enabled

env_var_enabled = ENV_CONFIG.posthog_enabled

# A user must opt out through either the config file or env var to disable analytics
return config_file_enabled and env_var_enabled
Copy link
Contributor

Choose a reason for hiding this comment

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

This logic seems wrong (and doesn't match the comment). s/and/or. I might move the comment up to a docstring too!

@cdkini cdkini enabled auto-merge May 8, 2024 18:22
@cdkini cdkini added this pull request to the merge queue May 8, 2024
Merged via the queue into develop with commit e122123 May 8, 2024
69 checks passed
@cdkini cdkini deleted the m/v1-158/analytics branch May 8, 2024 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants