Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Log to eventsource.
  • Loading branch information
rajkumar-rangaraj committed Apr 22, 2025
commit 25d28d0dd5ba542c292c1af95d91dba102870cdd
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ protected override void Dispose(bool disposing)
{
return RuntimeContext.GetValue<string>(AFDCorrelationId);
}
catch
catch (Exception ex)
{
ExporterEventSource.Log.FailedToGetAFDCorrelationId(ex);
GenevaAfdCorrelationIdStateTracker.Set(true);
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ internal sealed class ExporterEventSource : EventSource
private const int EVENT_ID_TRANSPORT_ERROR = 7; // Transport error
private const int EVENT_ID_TRANSPORT_EXCEPTION = 8; // Transport exception
private const int EVENT_ID_TRANSPORT_INFO = 9; // Transport info
private const int EVENT_ID_AFD_CORRELATION_ID = 10; // Failed to get AFD correlation ID

[NonEvent]
public void FailedToSendTraceData(Exception ex)
Expand Down Expand Up @@ -87,6 +88,16 @@ public void TransportException(string transportType, string message, Exception e
}
}

[NonEvent]
public void FailedToGetAFDCorrelationId(Exception ex)
{
if (Log.IsEnabled(EventLevel.Error, EventKeywords.All))
{
// TODO: Do not hit ETW size limit even for external library exception stack.
this.FailedToGetAFDCorrelationId(ex.ToInvariantString());
}
}

[Event(EVENT_ID_TRACE, Message = "Exporter failed to send trace data. Exception: {0}", Level = EventLevel.Error)]
public void FailedToSendTraceData(string error)
{
Expand Down Expand Up @@ -140,4 +151,10 @@ public void TransportInformation(string transportType, string error)
{
this.WriteEvent(EVENT_ID_TRANSPORT_INFO, transportType, error);
}

[Event(EVENT_ID_AFD_CORRELATION_ID, Message = "Failed to get AFD correlation ID. Exception: {0}", Level = EventLevel.Error)]
public void FailedToGetAFDCorrelationId(string error)
{
this.WriteEvent(EVENT_ID_AFD_CORRELATION_ID, error);
}
}