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

Add API to azcore.Client for shallow copying with new client name #20973

Closed
jhendrixMSFT opened this issue Jun 6, 2023 · 2 comments · Fixed by #21065
Closed

Add API to azcore.Client for shallow copying with new client name #20973

jhendrixMSFT opened this issue Jun 6, 2023 · 2 comments · Fixed by #21065
Assignees
Labels
Azure.Core Client This issue points to a problem in the data-plane of the library. feature-request This issue requires a new behavior in the product in order be resolved.

Comments

@jhendrixMSFT
Copy link
Member

jhendrixMSFT commented Jun 6, 2023

I think it would look something like this.

// WithClientName returns a shallow copy of the Client with its tracing client name changed to clientName.
//   - clientName - the fully qualified name of the client ("package.Client"); this is used by the tracing provider when creating spans
func (c *Client) WithClientName(clientName string) *Client { /*...*/ }

This is similar to how *http.Request.WithContext() works.

@jhendrixMSFT jhendrixMSFT self-assigned this Jun 6, 2023
@jhendrixMSFT jhendrixMSFT changed the title Add API to azcore.Client for shallow cloning with new client name Add API to azcore.Client for shallow copying with new client name Jun 6, 2023
@JeffreyRichter
Copy link
Member

This is a public API exposed to customers?

@jhendrixMSFT
Copy link
Member Author

jhendrixMSFT commented Jun 13, 2023

The API is on the azcore.Client type which is not typically exposed to customers (SDK clients internally use this). However, since this client is our raw HTTP client "escape hatch" mechanism, in those scenarios, customers would see this API (and a few others).

Since this is an exported type from azcore there's no way to avoid making the API exported. However, we could probably do some type-aliasing magic so that the API shows up in the runtime package if we think exposing it in the "escape hatch" scenario is unwanted.

@RickWinter RickWinter added Client This issue points to a problem in the data-plane of the library. feature-request This issue requires a new behavior in the product in order be resolved. labels Jun 14, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Core Client This issue points to a problem in the data-plane of the library. feature-request This issue requires a new behavior in the product in order be resolved.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants