-
Notifications
You must be signed in to change notification settings - Fork 479
/
TelemetryOverrideRecognizer.cs
39 lines (34 loc) · 1.61 KB
/
TelemetryOverrideRecognizer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System.Collections.Generic;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.Bot.Builder.AI.Luis.Tests
{
public class TelemetryOverrideRecognizer : LuisRecognizer
{
public TelemetryOverrideRecognizer(LuisApplication application, LuisPredictionOptions predictionOptions = null, bool includeApiResults = false, bool logPersonalInformation = false, HttpClientHandler clientHandler = null)
: base(application, predictionOptions, includeApiResults, clientHandler)
{
LogPersonalInformation = logPersonalInformation;
}
protected override Task OnRecognizerResultAsync(RecognizerResult recognizerResult, ITurnContext turnContext, Dictionary<string, string> properties = null, Dictionary<string, double> metrics = null, CancellationToken cancellationToken = default)
{
properties.TryAdd("MyImportantProperty", "myImportantValue");
// Log event
TelemetryClient.TrackEvent(
LuisTelemetryConstants.LuisResult,
properties,
metrics);
// Create second event.
var secondEventProperties = new Dictionary<string, string> {
{ "MyImportantProperty2", "myImportantValue2" },
};
TelemetryClient.TrackEvent(
"MySecondEvent",
secondEventProperties);
return Task.CompletedTask;
}
}
}