[Bug] DISABLE_CDP_ERROR_REPORTING and DISABLE_CDP_USAGE_TRACKING require both env vars set to disable analytics

Open Beginner friendly
#773 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
backend

Research direction

Start in python/cdp/cdp_client.py at the analytics enable condition shown in the issue, and inspect how the two environment variables are evaluated. Done means each disable variable works independently and both together prevent analytics setup; verify the combinations described in the issue.

Written by the indexing model from the issue text.

Description

Summary

In python/cdp/cdp_client.py, the analytics enable condition uses or instead of and, meaning you must set both env vars to disable analytics. Setting only one has no effect.

Affected Code

# python/cdp/cdp_client.py
if api_key_id and (
    os.getenv("DISABLE_CDP_ERROR_REPORTING") != "true"
    or os.getenv("DISABLE_CDP_USAGE_TRACKING") != "true"  # ← should be `and`
):
    Analytics["identifier"] = api_key_id

Current (broken) behavior

  • DISABLE_CDP_ERROR_REPORTING=true alone → analytics still active (or short-circuits to True)
  • Both env vars must be "true" to disable analytics

Expected behavior

Setting either env var to "true" should disable that feature; setting both should disable both.

Fix

if api_key_id and (
    os.getenv("DISABLE_CDP_ERROR_REPORTING") != "true"
    and os.getenv("DISABLE_CDP_USAGE_TRACKING") != "true"
):
    Analytics["identifier"] = api_key_id
Dominant language
Python
Stars
200
Forks
191
Avg merge
3h 52m
Merged PRs (30d)
13

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from coinbase/cdp-sdk

All issues in coinbase/cdp-sdk

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.