Skip to content

Commit b5a7013

Browse files
authored
fix: Disable the Feast Usage feature by default. (feast-dev#4090)
1 parent fd5b620 commit b5a7013

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

docs/reference/usage.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
## How Feast SDK usage is measured
44

5-
The Feast project logs anonymous usage statistics and errors in order to inform our planning. Several client methods are tracked, beginning in Feast 0.9. Users are assigned a UUID which is sent along with the name of the method, the Feast version, the OS \(using `sys.platform`\), and the current time.
5+
The Feast project has a feature to log usage statistics and errors. Several client methods are tracked, beginning in Feast 0.9. Users are assigned a UUID which is sent along with the name of the method, the Feast version, the OS \(using `sys.platform`\), and the current time.
66

77
The [source code](https://github.com/feast-dev/feast/blob/master/sdk/python/feast/usage.py) is available here.
88

9-
## How to disable usage logging
9+
## How to enable the usage logging
1010

11-
Set the environment variable `FEAST_USAGE` to `False`.
11+
Set the environment variable `FEAST_USAGE` to `True` (in String type) and config your endpoint by the variable `FEAST_USAGE_ENDPOINT`.
1212

sdk/python/feast/constants.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
# Environment variable for registry
3030
REGISTRY_ENV_NAME: str = "REGISTRY_BASE64"
3131

32-
# Environment variable for toggling usage
32+
# Environment variable for toggling the Usage feature
3333
FEAST_USAGE = "FEAST_USAGE"
3434

35-
# Default value for FEAST_USAGE when environment variable is not set
36-
DEFAULT_FEAST_USAGE_VALUE = "True"
35+
# Environment variable for FEAST_USAGE_ENDPOINT
36+
FEAST_USAGE_ENDPOINT = "FEAST_USAGE_ENDPOINT"
3737

3838
# Environment variable for the path for overwriting universal test configs
3939
FULL_REPO_CONFIGS_MODULE_ENV_NAME: str = "FULL_REPO_CONFIGS_MODULE"

sdk/python/feast/usage.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,17 @@
3030
import requests
3131

3232
from feast import flags_helper
33-
from feast.constants import DEFAULT_FEAST_USAGE_VALUE, FEAST_USAGE
33+
from feast.constants import FEAST_USAGE, FEAST_USAGE_ENDPOINT
3434
from feast.version import get_version
3535

36-
USAGE_ENDPOINT = "https://usage.feast.dev"
37-
3836
_logger = logging.getLogger(__name__)
3937
_executor = concurrent.futures.ThreadPoolExecutor(max_workers=3)
4038

41-
_is_enabled = os.getenv(FEAST_USAGE, default=DEFAULT_FEAST_USAGE_VALUE) == "True"
39+
_is_enabled = os.getenv(FEAST_USAGE, default="False") == "True"
40+
41+
# Default usage endpoint value.
42+
# Will raise an exception if the configured value is not working.
43+
_usage_endpoint = os.getenv(FEAST_USAGE_ENDPOINT, default="")
4244

4345
_constant_attributes = {
4446
"project_id": "",
@@ -177,7 +179,7 @@ def _set_installation_id():
177179

178180

179181
def _export(event: typing.Dict[str, typing.Any]):
180-
_executor.submit(requests.post, USAGE_ENDPOINT, json=event, timeout=2)
182+
_executor.submit(requests.post, _usage_endpoint, json=event, timeout=2)
181183

182184

183185
def _produce_event(ctx: UsageContext):

0 commit comments

Comments
 (0)