Catch general exception in OltpExporter (#1634)
* Catch general exception in OltpExporter * Corrected typo
This commit is contained in:
parent
fcc0b56904
commit
1630fb3abb
|
|
@ -43,6 +43,15 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation
|
|||
}
|
||||
}
|
||||
|
||||
[NonEvent]
|
||||
public void ExportMethodException(Exception ex)
|
||||
{
|
||||
if (Log.IsEnabled(EventLevel.Error, (EventKeywords)(-1)))
|
||||
{
|
||||
this.ExportMethodException(ex.ToInvariantString());
|
||||
}
|
||||
}
|
||||
|
||||
[Event(1, Message = "Exporter failed to convert SpanData content into gRPC proto definition. Data will not be sent. Exception: {0}", Level = EventLevel.Error)]
|
||||
public void FailedToConvertToProtoDefinitionError(string ex)
|
||||
{
|
||||
|
|
@ -60,5 +69,11 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation
|
|||
{
|
||||
this.WriteEvent(3, className, methodName);
|
||||
}
|
||||
|
||||
[Event(4, Message = "Unknown error in export method: {0}", Level = EventLevel.Error)]
|
||||
public void ExportMethodException(string ex)
|
||||
{
|
||||
this.WriteEvent(4, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,6 +85,12 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol
|
|||
|
||||
return ExportResult.Failure;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
OpenTelemetryProtocolExporterEventSource.Log.ExportMethodException(ex);
|
||||
|
||||
return ExportResult.Failure;
|
||||
}
|
||||
finally
|
||||
{
|
||||
request.Return();
|
||||
|
|
|
|||
Loading…
Reference in New Issue