Skip to content

Commit

Permalink
eventsource
Browse files Browse the repository at this point in the history
  • Loading branch information
vishweshbankwar committed Feb 21, 2024
1 parent 0d08c78 commit 9a0e14f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ public void ExportMethodException(Exception ex, bool isRetry = false)
}
}

[NonEvent]
public void SubmitRequestException(Exception ex)
{
if (Log.IsEnabled(EventLevel.Error, EventKeywords.All))
{
this.SubmitRequestException(ex.ToInvariantString());
}
}

[Event(2, Message = "Exporter failed send data to collector to {0} endpoint. Data will not be sent. Exception: {1}", Level = EventLevel.Error)]
public void FailedToReachCollector(string rawCollectorUri, string ex)
{
Expand Down Expand Up @@ -83,4 +92,13 @@ public void InvalidEnvironmentVariable(string key, string value)
{
this.WriteEvent(11, key, value);
}

#if NET6_0_OR_GREATER
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "Parameters to this method are primitive and are trimmer safe.")]
#endif
[Event(12, Message = "Unknown error in TrySubmitRequest method. Message: '{0}'. IsRetry: {1}", Level = EventLevel.Error)]
public void SubmitRequestException(string ex)
{
this.WriteEvent(12, ex);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public bool TrySubmitRequest(TRequest request)
}
catch (Exception ex)
{
OpenTelemetryProtocolExporterEventSource.Log.ExportMethodException(ex);
OpenTelemetryProtocolExporterEventSource.Log.SubmitRequestException(ex);
this.OnRequestDropped(request);
return false;
}
Expand Down

0 comments on commit 9a0e14f

Please sign in to comment.