-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[CT-3525] [Bug] Option --no-send-anonymous-usage-stats
creates different behavior compared to DBT_SEND_ANONYMOUS_USAGE_STATS=false
#9336
Comments
--no-send-anonymous-usage-stats
creates different behavior compared to DBT_SEND_ANONYMOUS_USAGE_STATS=false
--no-send-anonymous-usage-stats
creates different behavior compared to DBT_SEND_ANONYMOUS_USAGE_STATS=false
Thanks for reporting this @mbarugelCA 🙏 I was able to reproduce the same thing that you reported. ReprexFirst, I needed to make sure I had all the relevant environment variables unset: echo $DBT_SEND_ANONYMOUS_USAGE_STATS
echo $DO_NOT_TRACK
unset DBT_SEND_ANONYMOUS_USAGE_STATS
unset DO_NOT_TRACK From there, I ran all the following commands to see what dbt is doing: dbt --debug ls -s something --send-anonymous-usage-stats | grep -Eo "'send_anonymous_usage_stats': '(.*)'"
DBT_SEND_ANONYMOUS_USAGE_STATS=true dbt --debug ls -s something | grep -Eo "'send_anonymous_usage_stats': '(.*)'"
dbt --debug ls -s something --no-send-anonymous-usage-stats | grep -Eo "'send_anonymous_usage_stats': '(.*)'"
DBT_SEND_ANONYMOUS_USAGE_STATS=false dbt --debug ls -s something | grep -Eo "'send_anonymous_usage_stats': '(.*)'"
DO_NOT_TRACK=true dbt --debug ls -s something | grep -Eo "'send_anonymous_usage_stats': '(.*)'" Explanation:
The output we'd expect is:
But depending on the config setting for When
When
Conclusion👉 So it looks like the Acceptance criteriaThe output from the above commands is always the following, regardless if the
|
…rue` (#4713) ## What are you changing in this pull request and why? While responding to dbt-labs/dbt-core#9336, I set `DO_NOT_TRACK=0` and examined the result. It does not behave the same way as `DBT_SEND_ANONYMOUS_USAGE_STATS=True`. Looking at the source code [here](https://github.com/dbt-labs/dbt-core/blob/11cc71b75fa64b09888461339eb1eb3b394f9528/core/dbt/cli/flags.py#L252-L254) explains why. So we can safely just remove this line from the docs for [`send_anonymous_usage_stats`](https://docs.getdbt.com/reference/global-configs/usage-stats) to avoid confusion. ## Additional info We first added support for the [Console Do Not Track](https://consoledonottrack.com/) initiative within dbt-labs/dbt-core#5000 as described in dbt-labs/dbt-core#3540. Any of the following are equivalent to `DBT_SEND_ANONYMOUS_USAGE_STATS=False` (whether they are uppercase, lowercase, or mixed case): ``` export DO_NOT_TRACK=1 export DO_NOT_TRACK=t export DO_NOT_TRACK=true export DO_NOT_TRACK=y export DO_NOT_TRACK=yes ``` Any other values of `DO_NOT_TRACK` are ignored altogether and not have any effect. ## Checklist - [x] Review the [Content style guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md) so my content adheres to these guidelines.
I'm not sure if it affects the behavior described in this issue or not, but we take an additional environment variable dbt-core/core/dbt/cli/flags.py Lines 281 to 283 in 68970d0
We mostly expose only a single environment variable to control flags / global configs, but this is the rare case (and maybe only one) in which we allow two different environment variable names:
According to the
Also,
This happens to be exactly what is in the logic below, which would lower the barriers to that portion of the code refactor: dbt-core/core/dbt/cli/flags.py Line 282 in 68970d0
So we might be able to remove this code in favor of adding this here: envvar=["DO_NOT_TRACK", "DBT_SEND_ANONYMOUS_USAGE_STATS"], At the very least, it would reduce the number of occurrences of |
I just found out this same issue! I was running I suspected it was due to tracking so I tried adding This seems related to this value: Line 59 in afb2d61
Should we raise another issue that if the client is not connected to the internet we should not hang for 30 secs? |
It seems reasonable to give the anonymous tracking a quick shot and give up after a very short amount of time (1 or 2 seconds total) if it isn't able to establish a connection. If you want to open an issue for this, I'll label it as |
Is this a new bug in dbt-core?
Current Behavior
Running
time dbt ls -s something --no-send-anonymous-usage-stats
generates these logs:and the
time
output is:Whereas running
time DBT_SEND_ANONYMOUS_USAGE_STATS=false dbt ls -s something
generates these logs:And
time
output is:So using the env var config actually results in fewer events logged and a large improvement in runtime.
Expected Behavior
As I understand it,
--no-send-anonymous-usage-stats
andDBT_SEND_ANONYMOUS_USAGE_STATS=false
should be identical.Steps To Reproduce
Run:
time dbt ls -s something --no-send-anonymous-usage-stats
and
time DBT_SEND_ANONYMOUS_USAGE_STATS=false dbt ls -s something
Compare the logs and runtime.
Relevant log output
No response
Environment
Which database adapter are you using with dbt?
snowflake
Additional Context
No response
The text was updated successfully, but these errors were encountered: