Skip to content

Commit

Permalink
use airflow config instead of env vars for setting telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
marwan116 committed Jun 28, 2024
1 parent 59cbde8 commit daef55f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ We will not sell data or buy data about you.

You will always be able to disable the usage stats collection.

To disable usage stats collection, set the environment variable `ANYSCALE__AIRFLOW_TELEMETRY_ENABLED` to `false`.
To disable usage stats collection, set the configuration anyscale.telemetry_enabled to False in your airflow.cfg file.


### Changelog
Expand Down
5 changes: 3 additions & 2 deletions anyscale_provider/hooks/anyscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
from functools import cached_property
from typing import Any

from airflow.configuration import conf
from airflow.exceptions import AirflowException
from airflow.hooks.base import BaseHook

from anyscale import Anyscale
from anyscale.job.models import JobConfig, JobStatus
from anyscale.service.models import ServiceConfig, ServiceStatus
Expand Down Expand Up @@ -44,8 +46,7 @@ def client(self) -> Anyscale:

# Add custom headers if telemetry is enabled - by default telemetry is enabled.
headers = {}
telemetry_env = os.getenv("ANYSCALE__AIRFLOW_TELEMETRY_ENABLED", "true")
telemetry_enabled = telemetry_env.lower() in ["true", "1", "yes", "on"]
telemetry_enabled = conf.getboolean("anyscale", "telemetry_enabled", fallback=True)
if telemetry_enabled:
headers["X-Anyscale-Source"] = "airflow"

Expand Down

0 comments on commit daef55f

Please sign in to comment.