Skip to content

Commit

Permalink
[ResourceDetector.AWS] Fixed Exception error while logging exceptions (
Browse files Browse the repository at this point in the history
  • Loading branch information
AsakerMohd authored Jan 3, 2025
1 parent d87ce66 commit c4a56e0
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/OpenTelemetry.Resources.AWS/AWSResourcesEventSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@ public void ResourceAttributesExtractException(string format, Exception ex)
}
}

[Event(EventIdFailedToExtractAttributes, Message = "Failed to extract resource attributes in '{0}'.", Level = EventLevel.Warning)]
[NonEvent]
public void FailedToCreateHttpHandler(Exception exception)
{
if (this.IsEnabled(EventLevel.Warning, (EventKeywords)(-1)))
{
this.FailedToCreateHttpHandler(exception.ToInvariantString());
}
}

[Event(EventIdFailedToExtractAttributes, Message = "Failed to extract resource attributes in '{0}'. Error Message: '{1}'", Level = EventLevel.Warning)]
public void FailedToExtractResourceAttributes(string format, string exception)
{
this.WriteEvent(EventIdFailedToExtractAttributes, format, exception);
Expand All @@ -39,9 +48,9 @@ public void FailedToValidateCertificate(string error)
}

[Event(EventIdFailedToCreateHttpHandler, Message = "Failed to create HTTP handler. Exception: '{0}'", Level = EventLevel.Warning)]
public void FailedToCreateHttpHandler(Exception exception)
public void FailedToCreateHttpHandler(string error)
{
this.WriteEvent(EventIdFailedToCreateHttpHandler, exception.ToInvariantString());
this.WriteEvent(EventIdFailedToCreateHttpHandler, error);
}

[Event(EventIdFailedCertificateFileNotExists, Message = "Certificate file does not exist. File: '{0}'", Level = EventLevel.Warning)]
Expand Down

0 comments on commit c4a56e0

Please sign in to comment.