dbt-labs / dbt-labs/dbt-adapters

[Feature] `platform_detection_timeout_seconds` for telemetry during Snowflake connection

Open
#1,730 0 comments 0 reactions 0 assignees View on GitHub
triage:product type:enhancement
Dominant language
Python
Stars
233
Forks
362
Avg merge
3d 22h
Merged PRs (30d)
9

Description

### Is this your first time submitting a feature request?

- [x] I have read the [expectations for open source contributors](https://docs.getdbt.com/docs/contributing/oss-expectations)
- [x] I have searched the existing issues, and I could not find an existing issue for this feature
- [x] I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion

### Describe the feature

Do one of the following:
1. Set `platform_detection_timeout_seconds=0.0` in the [`dbt-snowflake` Snowflake connection](https://github.com/dbt-labs/dbt-adapters/blob/c4c04de76d5a6c56c95965041a93156fdeaf4641/dbt-snowflake/src/dbt/adapters/snowflake/connections.py#L406) to disable this telemetry
2. Allow `platform_detection_timeout_seconds` in the Snowflake connection to be user-configurable
3. Do nothing and let `platform_detection_timeout_seconds` be the default (currently [0.2 seconds](https://github.com/snowflakedb/snowflake-connector-python/blob/v4.1.0/src/snowflake/connector/platform_detection.py#L465-L466))

### Background info

https://github.com/snowflakedb/snowflake-connector-python/pull/2387 added logic that tries to detect which [type of compute environment](https://github.com/snowflakedb/snowflake-connector-python/blob/8bd7fd906e93a4b483827f417a7209346cd07b49/src/snowflake/connector/platform_detection.py#L487-L493) that python library is being used within which currently includes:
- AWS Lambda
- Azure Function
- GCP Cloud Run service
- GCP Cloud Run job
- GitHub Action

This telemetry change landed somewhere around `snowflake-connector-python==3.17.0` (certainly by [`3.17.2`](https://pypi.org/project/snowflake-connector-python/3.17.2/)).

As mentioned in https://github.com/dbt-labs/dbt-core/issues/12011 and https://github.com/snowflakedb/snowflake-connector-python/issues/2499#issuecomment-3212115315, this change can lead to warnings like the following:

```
WARNING:snowflake.connector.vendored.urllib3.connectionpool:Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(, 'Connection to 169.254.169.254 timed out. (connect timeout=0.2)')': /metadata/instance?api-version=2021-02-01
WARNING:urllib3.connectionpool:Connection pool is full, discarding connection: 169.254.169.254. Connection pool size: 10
```

Therefore we should explicitly decide which one of the 3 options above that we want to adopt for the behavior of `dbt-snowflake` in regards to this telemetry:

1. Disable it
2. Allow users to configure it via a dbt config
3. Ignore it (which still allows users to disable via the `SNOWFLAKE_DISABLE_PLATFORM_DETECTION` environment variable)

### Describe alternatives you've considered

_No response_

### Who will this benefit?

_No response_

### Are you interested in contributing this feature?

_No response_

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.