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

Hash code algorithm - min 8 chars input string #117

Merged
merged 4 commits into from
Jan 22, 2016
Merged

Conversation

MaxShehovtsov
Copy link
Contributor

Existing algorithm for creating userid/operationid produces 5 char strings (much shorter than it used to be with guids). This seems to screw up sampling algorithm (DJB hash) which seems to not work properly on short strings.

This affects both client AND server sampling (as user ids get created on client and passed to server SDK)

Proposed solution is to guarantee minimum 8 chars input string. Based on experiments it produces an acceptable random distribution.

@SergeyKanzhelev
Copy link

:shipit:

@@ -227,19 +227,18 @@ module Microsoft.ApplicationInsights {
/**
* generate GUID
Copy link
Contributor

Choose a reason for hiding this comment

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

Update comment, no longer a guid format?

MaxShehovtsov added a commit that referenced this pull request Jan 22, 2016
[Feel free to leave feedback after PR is closed] Hash code algorithm - min 8 chars input string.
@MaxShehovtsov MaxShehovtsov merged commit 030bf5b into master Jan 22, 2016
@MaxShehovtsov MaxShehovtsov deleted the hashAlgo branch January 22, 2016 21:34
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 this pull request may close these issues.

None yet

4 participants