coinbase / coinbase/cdp-sdk

[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
Dominant language
Python
Stars
200
Forks
191
Avg merge
6h 16m
Merged PRs (30d)
17

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
# 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
```python
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
```

Contributor guide

Open the contributing guide

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.