Skip to content
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

Add Anyscale/Airflow telemetry #5

Merged
merged 2 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion anyscale_provider/hooks/anyscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,14 @@ def client(self) -> Anyscale:
if not token:
raise AirflowException(f"Missing API token for connection id {self.conn_id}")

return Anyscale(auth_token=token)
# 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"]
if telemetry_enabled:
headers["X-Anyscale-Source"] = "airflow"

return Anyscale(auth_token=token, headers=headers)

@classmethod
def get_ui_field_behaviour(cls) -> dict[str, Any]:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ requires-python = ">=3.8, <3.13"
dependencies = [
"apache-airflow>=2.7",
"pyyaml",
"anyscale==0.24.37"
"anyscale==0.24.44",
]

[project.urls]
Expand Down
Loading