Skip to content

Conversation

@Uddipaan-Hazarika
Copy link
Contributor

@Uddipaan-Hazarika Uddipaan-Hazarika commented May 17, 2023

Context:

We want telemetry headers to be added.
More details: https://delphix.atlassian.net/browse/HUBS-1562

Problem:

Doing this we can gather api usage reports

Solution:

Added telemetry headers.

Testing

x-dct-client-name:
{ "api_count": 52, "client_name": "Terraform" }
user_agent:
{ "api_count": 38, "user_agent": "Terraform/1.3.9 (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-delphix/1.0.0" }

@nick-mathison
Copy link
Contributor

Can we split this up?

"user_agent": "Terraform/1.3.9 (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-delphix/1.0.0"

I can see myself searching on which provider versions are installed and I suspect it'd be a lot harder if it's combined with other fields.

If not, can we put the provider version up front so it's easier to scan?

@Uddipaan-Hazarika
Copy link
Contributor Author

Can we split this up?

"user_agent": "Terraform/1.3.9 (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-delphix/1.0.0"

I can see myself searching on which provider versions are installed and I suspect it'd be a lot harder if it's combined with other fields.

If not, can we put the provider version up front so it's easier to scan?

So we dont have much control over this string as this is generated in the sdk code.
Ref:

func (p *Provider) UserAgent(name, version string) string {
	ua := fmt.Sprintf("Terraform/%s (+https://www.terraform.io) Terraform-Plugin-SDK/%s", p.TerraformVersion, meta.SDKVersionString())
	if name != "" {
		ua += " " + name
		if version != "" {
			ua += "/" + version
		}
	}

	if add := os.Getenv(uaEnvVar); add != "" {
		add = strings.TrimSpace(add)
		if len(add) > 0 {
			ua += " " + add
			log.Printf("[DEBUG] Using modified User-Agent: %s", ua)
		}
	}

	return ua
}

But if this is not something we would want, I think we can override the useragent.

@nick-mathison
Copy link
Contributor

We already send the user_agent, so not worth changing now.

Copy link
Contributor

@kishlay-delphix kishlay-delphix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Uddipaan-Hazarika Uddipaan-Hazarika merged commit 8522ddd into delphix-integrations:develop May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants