diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/CHANGELOG.md b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/CHANGELOG.md index 152b15123ef..cacb52c6ecd 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/CHANGELOG.md +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/CHANGELOG.md @@ -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 diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/BaseOtlpHttpExportClient.cs b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/BaseOtlpHttpExportClient.cs index 81b59b6c336..a6b96d71e32 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/BaseOtlpHttpExportClient.cs +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/BaseOtlpHttpExportClient.cs @@ -55,7 +55,7 @@ public bool SendExportRequest(TRequest request, CancellationToken cancellationTo } catch (HttpRequestException ex) { - OpenTelemetryProtocolExporterEventSource.Log.FailedToReachCollector(ex); + OpenTelemetryProtocolExporterEventSource.Log.FailedToReachCollector(this.Options.Endpoint, ex); return false; } diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpGrpcLogExportClient.cs b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpGrpcLogExportClient.cs index 48c93d9eae8..2e50d821e9c 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpGrpcLogExportClient.cs +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpGrpcLogExportClient.cs @@ -51,7 +51,7 @@ public override bool SendExportRequest(OtlpCollector.ExportLogsServiceRequest re } catch (RpcException ex) { - OpenTelemetryProtocolExporterEventSource.Log.FailedToReachCollector(ex); + OpenTelemetryProtocolExporterEventSource.Log.FailedToReachCollector(this.Options.Endpoint, ex); return false; } diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpGrpcMetricsExportClient.cs b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpGrpcMetricsExportClient.cs index 6d904a73a8f..0086bcdd402 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpGrpcMetricsExportClient.cs +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpGrpcMetricsExportClient.cs @@ -51,7 +51,7 @@ public override bool SendExportRequest(OtlpCollector.ExportMetricsServiceRequest } catch (RpcException ex) { - OpenTelemetryProtocolExporterEventSource.Log.FailedToReachCollector(ex); + OpenTelemetryProtocolExporterEventSource.Log.FailedToReachCollector(this.Options.Endpoint, ex); return false; } diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpGrpcTraceExportClient.cs b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpGrpcTraceExportClient.cs index 92af4c854a8..e08abedf2c6 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpGrpcTraceExportClient.cs +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpGrpcTraceExportClient.cs @@ -51,7 +51,7 @@ public override bool SendExportRequest(OtlpCollector.ExportTraceServiceRequest r } catch (RpcException ex) { - OpenTelemetryProtocolExporterEventSource.Log.FailedToReachCollector(ex); + OpenTelemetryProtocolExporterEventSource.Log.FailedToReachCollector(this.Options.Endpoint, ex); return false; } diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OpenTelemetryProtocolExporterEventSource.cs b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OpenTelemetryProtocolExporterEventSource.cs index d42e9937832..2e46de5c651 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OpenTelemetryProtocolExporterEventSource.cs +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OpenTelemetryProtocolExporterEventSource.cs @@ -26,11 +26,12 @@ internal class OpenTelemetryProtocolExporterEventSource : EventSource 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 @@ public void ExportMethodException(Exception ex) } } - [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)]