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

UserAgent: Fix feature tracking #1462

Merged
merged 2 commits into from
May 4, 2020
Merged

UserAgent: Fix feature tracking #1462

merged 2 commits into from
May 4, 2020

Conversation

ealsur
Copy link
Member

@ealsur ealsur commented May 1, 2020

Description

Due to the underlying inheritance from Cosmos.UserAgentContainer and Documents.UserAgentContainer, the base user agent string only gets re-calculated if the Suffix (ApplicationName) setter is used on the underlying Documents.UserAgentContainer.

Currently we are tracking a set of Features through the user Agent, but since these Features are set during Client creation, cannot be part of the BaseUserAgent. So we set them after, like the Suffix, when building the ConnectionPolicy:

https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs#L748

The problem is that if the user is not setting ApplicationName / Suffix, and using features like Bulk or the new HttpClientFactory, those features do not get added to the UserAgent because the Suffix is not modified.

Calling the Suffix setter with a string.Empty forces the base user agent to be recalculated. This does not affect the scenario where the user is indeed setting the ApplicationName because that happens after.

Since this only happens on client building, there is no performance impact.

Ideal solution would be to stop inheriting from Documents.UserAgentContainer but that would require a rewiring through the complete stack including files in the Direct package.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

@ealsur ealsur added the bug Something isn't working label May 1, 2020
@ealsur ealsur self-assigned this May 1, 2020
@ealsur ealsur merged commit 83e20ca into master May 4, 2020
@ealsur ealsur deleted the users/ealsur/featurefix branch May 4, 2020 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants