databricks / databricks-sdk-py

Databricks SDK for Python (Beta)
https://databricks-sdk-py.readthedocs.io/
Apache License 2.0
318 stars 103 forks source link

Added `with_product(...)` and `with_user_agent_extra(...)` public functions to improve telemetry for mid-stream libraries #679

Closed nfx closed 2 weeks ago

nfx commented 3 weeks ago

Changes

This PR solves three tracking challenges:

  1. Adds consistent mechanism with Go SDK Public API. See https://github.com/databricks/databricks-sdk-go/blob/00b1d09b24aa9fb971bcf23f3db3e80bf2bec6fe/useragent/user_agent.go#L20-L31 and https://github.com/databricks/databricks-sdk-go/blob/00b1d09b24aa9fb971bcf23f3db3e80bf2bec6fe/useragent/user_agent.go#L49-L54

  2. Some of our products, like UCX and Remorph, are used not only as standalone CLI, but also as mid-stream libraries in other products, where developers don't specify product name and product version within the WorkspaceClient. This results in missing tracking information for those integrations.

  3. Mid-stream libraries, like blueprint, pytester, and lsql, do have their own versions, but they don't create manage sdk.WorkspaceClient and/or core.Config themselves, so we currently lack traffic attribution for those libraries. Technically, Databricks Connect falls into the same use-case.

Tests

Moved unit tests that are relevant to User-Agent verification from test_core.py to test_config.py to bring back consistency.

github-actions[bot] commented 3 weeks ago

This PR breaks backwards compatibility for databrickslabs/ucx downstream. See build logs for more details.

Running from downstreams #185

codecov-commenter commented 3 weeks ago

Codecov Report

Attention: Patch coverage is 87.50000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 57.71%. Comparing base (f50af60) to head (4624127).

Files Patch % Lines
databricks/sdk/config.py 87.50% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #679 +/- ## ========================================== + Coverage 57.69% 57.71% +0.02% ========================================== Files 48 48 Lines 33079 33102 +23 ========================================== + Hits 19084 19104 +20 - Misses 13995 13998 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.