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

[FEATURE] Add support for extra user agent through environment variable #850

Closed
osoucy opened this issue Mar 11, 2024 · 2 comments · Fixed by #854
Closed

[FEATURE] Add support for extra user agent through environment variable #850

osoucy opened this issue Mar 11, 2024 · 2 comments · Fixed by #854

Comments

@osoucy
Copy link

osoucy commented Mar 11, 2024

Problem Statement
I want to append user agent information when deploying resources through Terraform (and Pulumi) Databricks provider without having to re-implement the provider. This would be required to support a partner integration and properly track relevant metrics.

Proposed Solution
Given that the terraform databricks provider uses the databricks-sdk-go user agent to define the user agent value sent to the Databricks REST API calls, adding support for an environment variable would eliminate the need for re-implementation anytime a new UserAgent value is required.

A similar implementation has already been done in the python sdk here by @nfx and @kartikgupta-db. Adding the same logic to the go sdk would resolve the stated problem.

Another, less generic, option would be to add okube-laktory to the list of official CI/CD providers defined here

Additional Context
Most terraform providers support an environment variable called TF_APPEND_USER_AGENT as described here. Unfortunately, the Terraform Databricks Provider has its own custom implementation of the user agent which prevent from using this environment variable. If I wanted to add okube-laktory to the user agent, I would have to implement custom Terraform and Pulumi Databricks providers (I need to support both). Obviously, this is quite effort-intensive and cumbersome just for the sake of adding a property to the user agent.

Another option would be to force all calls to go through a proxy which updates the headers of the API calls, but that would be a less than stellar user experience and requires to support a live service.

@osoucy osoucy changed the title [FEATURE] Added support for extra user agent through environment variable [FEATURE] Add support for extra user agent through environment variable Mar 11, 2024
Copy link
Contributor

nfx commented Mar 11, 2024

Listing it as CI provider is a better option

@osoucy
Copy link
Author

osoucy commented Mar 11, 2024

Actually, thinking about it, Laktory (the framework I would like to have the UserAgent updated for), is more an Infrastructure as Code tool like Pulumi and Terraform than a CI/CD tool. It could possibly be used with github actions, azure-devops or others.

Given that additional context, do you still feel listing it as CI provider is the best option?

github-merge-queue bot pushed a commit that referenced this issue Mar 13, 2024
…854)

## Changes
This PR ports databricks/databricks-sdk-py#163
to the Go SDK. This enables partners who use the SDK through a tool
(like Terraform) to add custom information to the user agent without
having to make code changes to the tool.

Closes #850.

## Tests
Added unit test to verify that the user agent is only updated when both
DATABRICKS_SDK_UPSTREAM and DATABRICKS_SDK_UPSTREAM_VERSION are set.

Manually ran `examples/slog` to verify that the user agent is correctly
updated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants