Skip to content

Commit

Permalink
Add with_library(product, version) to track usage of each upstream …
Browse files Browse the repository at this point in the history
…library separately

This PR adds `with_library(product, version)` method to clients & config, creating a copy with the user-agent extra propagated only for the relevant calls
  • Loading branch information
nfx committed Feb 28, 2024
1 parent 9813180 commit 751496d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions databricks/sdk/__init__.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions databricks/sdk/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@ def with_user_agent_extra(self, key: str, value: str) -> 'Config':
self._user_agent_other_info.append(f"{key}/{value}")
return self

def with_library(self, product: str, version: str) -> 'Config':
config_copy = self.copy()
config_copy.with_user_agent_extra(product, version)
return config_copy

@property
def oidc_endpoints(self) -> Optional[OidcEndpoints]:
self._fix_host_if_needed()
Expand Down

0 comments on commit 751496d

Please sign in to comment.