Skip to content

Commit e53aeb0

Browse files
committed
Resolving comments
1 parent f9cb776 commit e53aeb0

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/Microsoft.FeatureManagement/FeatureManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ private async ValueTask<EvaluationEvent> EvaluateFeature<TContext>(string featur
373373
Activity.Current != null &&
374374
Activity.Current.IsAllDataRequested)
375375
{
376-
TelemetryEventHandler.HandleEvaluationEvent(evaluationEvent, Logger);
376+
FeatureEvaluationTelemetry.Publish(evaluationEvent, Logger);
377377
}
378378
}
379379

src/Microsoft.FeatureManagement/Telemetry/TelemetryEventHandler.cs renamed to src/Microsoft.FeatureManagement/Telemetry/FeatureEvaluationTelemetry.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Microsoft.FeatureManagement.Telemetry
88
{
9-
internal static class TelemetryEventHandler
9+
internal static class FeatureEvaluationTelemetry
1010
{
1111
private static readonly string EvaluationEventVersion = "1.0.0";
1212

@@ -15,10 +15,22 @@ internal static class TelemetryEventHandler
1515
/// </summary>
1616
/// <param name="evaluationEvent">The <see cref="EvaluationEvent"/> to publish as an <see cref="ActivityEvent"/></param>
1717
/// <param name="logger">Optional logger to log warnings to</param>
18-
public static void HandleEvaluationEvent(EvaluationEvent evaluationEvent, ILogger logger)
18+
public static void Publish(EvaluationEvent evaluationEvent, ILogger logger)
1919
{
20-
Debug.Assert(evaluationEvent != null);
21-
Debug.Assert(evaluationEvent.FeatureDefinition != null);
20+
if (Activity.Current == null)
21+
{
22+
throw new InvalidOperationException("An Activity must be created before calling this method.");
23+
}
24+
25+
if (evaluationEvent == null)
26+
{
27+
throw new ArgumentNullException(nameof(evaluationEvent));
28+
}
29+
30+
if (evaluationEvent.FeatureDefinition == null)
31+
{
32+
throw new ArgumentNullException(nameof(evaluationEvent.FeatureDefinition));
33+
}
2234

2335
var tags = new ActivityTagsCollection()
2436
{

0 commit comments

Comments
 (0)