feat: Include endpoint URI in connection failure events (#2686)

This commit is contained in:
Tom Kerkhove 2021-11-29 18:54:11 +01:00 committed by GitHub
parent f153cb1000
commit 5f5238dd7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 9 deletions

View File

@ -5,6 +5,9 @@
* Added configuration options for `MetricReaderType` to allow for configuring
the `OtlpMetricExporter` to export either manually or periodically.
([#2674](https://github.com/open-telemetry/opentelemetry-dotnet/pull/2674))
* The internal log message used when OTLP export client connection failure occurs,
will now include the endpoint uri as well.
([#2686](https://github.com/open-telemetry/opentelemetry-dotnet/pull/2686))
## 1.2.0-beta2

View File

@ -55,7 +55,7 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.ExportClie
}
catch (HttpRequestException ex)
{
OpenTelemetryProtocolExporterEventSource.Log.FailedToReachCollector(ex);
OpenTelemetryProtocolExporterEventSource.Log.FailedToReachCollector(this.Options.Endpoint, ex);
return false;
}

View File

@ -51,7 +51,7 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.ExportClie
}
catch (RpcException ex)
{
OpenTelemetryProtocolExporterEventSource.Log.FailedToReachCollector(ex);
OpenTelemetryProtocolExporterEventSource.Log.FailedToReachCollector(this.Options.Endpoint, ex);
return false;
}

View File

@ -51,7 +51,7 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.ExportClie
}
catch (RpcException ex)
{
OpenTelemetryProtocolExporterEventSource.Log.FailedToReachCollector(ex);
OpenTelemetryProtocolExporterEventSource.Log.FailedToReachCollector(this.Options.Endpoint, ex);
return false;
}

View File

@ -51,7 +51,7 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.ExportClie
}
catch (RpcException ex)
{
OpenTelemetryProtocolExporterEventSource.Log.FailedToReachCollector(ex);
OpenTelemetryProtocolExporterEventSource.Log.FailedToReachCollector(this.Options.Endpoint, ex);
return false;
}

View File

@ -26,11 +26,12 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation
public static readonly OpenTelemetryProtocolExporterEventSource Log = new OpenTelemetryProtocolExporterEventSource();
[NonEvent]
public void FailedToReachCollector(Exception ex)
public void FailedToReachCollector(Uri collectorUri, Exception ex)
{
if (Log.IsEnabled(EventLevel.Error, EventKeywords.All))
{
this.FailedToReachCollector(ex.ToInvariantString());
var rawCollectorUri = collectorUri.ToString();
this.FailedToReachCollector(rawCollectorUri, ex.ToInvariantString());
}
}
@ -43,10 +44,10 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation
}
}
[Event(2, Message = "Exporter failed send data to collector. Data will not be sent. Exception: {0}", Level = EventLevel.Error)]
public void FailedToReachCollector(string ex)
[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)
{
this.WriteEvent(2, ex);
this.WriteEvent(2, rawCollectorUri, ex);
}
[Event(3, Message = "Could not translate activity from class '{0}' and method '{1}', span will not be recorded.", Level = EventLevel.Informational)]