Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Include endpoint URI in connection failure events #2686

Merged
merged 8 commits into from
Nov 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
tomkerkhove marked this conversation as resolved.
Show resolved Hide resolved

return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
tomkerkhove marked this conversation as resolved.
Show resolved Hide resolved
{
if (Log.IsEnabled(EventLevel.Error, EventKeywords.All))
{
this.FailedToReachCollector(ex.ToInvariantString());
var rawCollectorUri = collectorUri.ToString();
this.FailedToReachCollector(rawCollectorUri, ex.ToInvariantString());
}
}

Expand All @@ -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)]
Expand Down