Skip to content

Commit

Permalink
Update AppInsightsProducerEventsHandler.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
dicko2 authored Dec 21, 2023
1 parent ecba799 commit 898bd65
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ public static Task OnProducerStarted(IMessageContext eventContextMessageContext,
return Task.CompletedTask;
}

public static Task OnProducerError(IMessageContext eventContextMessageContext, Exception eventContextException,
TelemetryClient telemetryClient)
public static Task OnProducerError(IMessageContext eventContextMessageContext, Exception eventContextException)
{
eventContextMessageContext.Items.TryGetValue("telemetryClient", out var telemetryClientOut);
var telemetryClient = (TelemetryClient)telemetryClientOut;
telemetryClient.TrackException(eventContextException, new Dictionary<string, string>()
{
{"topic" , eventContextMessageContext.ProducerContext.Topic},
Expand All @@ -36,8 +37,10 @@ public static Task OnProducerError(IMessageContext eventContextMessageContext, E
return Task.CompletedTask;
}

public static Task OnProducerCompleted(IMessageContext eventContextMessageContext, TelemetryClient telemetryClient)
public static Task OnProducerCompleted(IMessageContext eventContextMessageContext)
{
eventContextMessageContext.Items.TryGetValue("telemetryClient", out var telemetryClientOut);
var telemetryClient = (TelemetryClient)telemetryClientOut;
eventContextMessageContext.Items.TryGetValue("timer", out var timer);
var theTimer = (Stopwatch)timer;
theTimer.Stop();
Expand Down

0 comments on commit 898bd65

Please sign in to comment.