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

Adaptive Telemetry Instrumentation #3491

Merged
merged 12 commits into from
Mar 5, 2020
Merged

Conversation

garypretty
Copy link
Contributor

Addressed #2406

Adds the P0 telemetry for adaptive - covering dialog start / cancel / complete, triggers, actions and adaptive recognizers.

@tomlm tomlm added adaptive and removed no parity labels Mar 5, 2020
/// </summary>
/// <value>The <see cref="IBotTelemetryClient"/> being used to log events.</value>
[JsonIgnore]
public IBotTelemetryClient TelemetryClient { get; set; } = new NullBotTelemetryClient();
Copy link
Contributor

@tomlm tomlm Mar 5, 2020

Choose a reason for hiding this comment

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

public IBotTelemetryClient TelemetryClient { get; set; } = new NullBotTelemetryClient() [](start = 8, length = 87)

Do we have to add properties for this? Why not dialogContext.TurnState.Get()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The TelemetryClient isn't currently added to TurnState. I saw your suggestion regarding having the middleware add it, but that telemetry middleware is currently optional and we want to ensure this telemetry lights up for folks who already have it enabled when they start to adopt adaptive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This also keeps the telemetry implementation consistent across the SDK. Any developers who are currently using telemetry may be using the telemetry client to log trace / custom events etc. It's better, in my opinion, to keep that consistent so they can continue to use the same approach.

@@ -82,6 +82,7 @@ public Dialog RootDialog
if (value != null)
{
this.rootDialogId = value.Id;
this.Dialogs.TelemetryClient = value.TelemetryClient;
Copy link
Contributor

Choose a reason for hiding this comment

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

this.Dialogs.TelemetryClient = value.TelemetryClient; [](start = 19, length = 54)

?? Is this right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the underlying DialogSet needs to have the TelemetryClient set, after which point it will automatically assign the client to any dialogs that are added.

return await wrapper.RecognizeAsync(tempContext, cancellationToken).ConfigureAwait(false);
var result = await wrapper.RecognizeAsync(tempContext, cancellationToken).ConfigureAwait(false);

this.TelemetryClient.TrackEvent("LuisResult", this.FillRecognizerResultTelemetryProperties(result, telemetryProperties, dialogContext.Context), telemetryMetrics);
Copy link
Contributor

Choose a reason for hiding this comment

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

this.TelemetryClient [](start = 9, length = 23)

Why not dialogContext.TurnState.Get() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As per above, The TelemetryClient isn't currently added to TurnState. I saw your suggestion regarding having the middleware add it, but that telemetry middleware is currently optional and we want to ensure this telemetry lights up for folks who already have it enabled when they start to adopt adaptive.

@@ -212,6 +212,8 @@ public override async Task<RecognizerResult> RecognizeAsync(DialogContext dialog
recognizerResult.Intents.Add("None", new IntentScore() { Score = 1.0f });
}

this.TelemetryClient.TrackEvent("QnAMakerRecognizerResult", this.FillRecognizerResultTelemetryProperties(recognizerResult, telemetryProperties), telemetryMetrics);
Copy link
Contributor

Choose a reason for hiding this comment

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

this.TelemetryClient [](start = 11, length = 21)

Why not dialogContext.TurnState.Get()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As per response above.

return ProcessResults(results);
var result = ProcessResults(results);

this.TelemetryClient.TrackEvent("CrossTrainedRecognizerSetResult", this.FillRecognizerResultTelemetryProperties(result, telemetryProperties), telemetryMetrics);
Copy link
Contributor

Choose a reason for hiding this comment

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

same same

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As per response above.

Copy link
Contributor

@tomlm tomlm left a comment

Choose a reason for hiding this comment

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

🕐

Copy link
Contributor

@tomlm tomlm left a comment

Choose a reason for hiding this comment

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

:shipit:

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

2 participants