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

Made sampling based on UserId configurable #650

Closed
wants to merge 1 commit into from

Conversation

d3r3kk
Copy link
Contributor

@d3r3kk d3r3kk commented Nov 16, 2017

  • Moved the configuration out as far as the AdaptiveSamplingTelemetryProcessor
  • Added unit test to ensure sampling with/without user id is tested
  • Updated changelog for beta 2.5.0-beta2
  • Updated PublicAPI.Unshipped.txt

Linked to issue #625

For significant contributions please make sure you have completed the following items:

- Moved the configuration out as far as the AdaptiveSamplingTelemetryProcessor
- Added unit test to ensure sampling with/without user id is tested
- Updated changelog for beta 2.5.0-beta2
- Updated PublicAPI.Unshipped.txt

Linked to issue #625
/// services on operation_Id field.
/// </remarks>
/// </summary>
public bool AllowSamplingBasedOnUserId { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Allow is not the best verb here. Maybe Calculate like in CalculateSamplingScoreFromUserId or Use like in UseUserIdSamplingScore

/// Default is false.
///
/// <remarks>
/// Calculation of the sampling score based on user_Id field is disabled by default to ensure successful correlation across many
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: why are you switching to Kusto names of the fields in remark?

@@ -13,12 +13,13 @@ internal static class SamplingScoreGenerator
/// Generates telemetry sampling score between 0 and 100.
/// </summary>
/// <param name="telemetry">Telemetry item to score.</param>
/// <param name="allowUserId">Sampling score can be determined by using the Context.User.Id information, default is false.</param>
Copy link
Contributor

Choose a reason for hiding this comment

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

Add remark that is can be used for backward compatibility

@@ -27,8 +27,8 @@ public void SamplingScoreGeneratedUsingUserIdIfPresent()
requestTelemetry.Context.User.Id = userId;
requestTelemetry.Context.Operation.Id = GenerateRandomOperaitonId();

var eventTelemetrySamplingScore = SamplingScoreGenerator.GetSamplingScore(eventTelemetry);
var requestTelemetrySamplingScore = SamplingScoreGenerator.GetSamplingScore(requestTelemetry);
var eventTelemetrySamplingScore = SamplingScoreGenerator.GetSamplingScore(eventTelemetry, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

update the name of the test method. IfPresentAndConfigured

requestTelemetry.Context.Operation.Id = operationId;
requestTelemetry.Context.User.Id = userId;

var eventTelemetrySamplingScore = SamplingScoreGenerator.GetSamplingScore(eventTelemetry, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

ever test it with false?

@d3r3kk
Copy link
Contributor Author

d3r3kk commented Nov 16, 2017

Shutting this PR down, we will simply remove our calculation of sampling score based on Context.User.Id altogether.

@d3r3kk d3r3kk closed this Nov 16, 2017
@d3r3kk d3r3kk deleted the dekeeler/sampling-config branch November 29, 2017 23:32
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.

2 participants