Skip to content

Commit 38f79df

Browse files
committed
pr feedback
1 parent 99344b1 commit 38f79df

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpGrpcExportClient.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public override ExportClientResponse SendExportRequest(byte[] buffer, int conten
9393
grpcStatusDetailsHeader = GrpcProtocolHelpers.GetHeaderValue(trailingHeaders, GrpcStatusDetailsHeader);
9494
}
9595

96-
OpenTelemetryProtocolExporterEventSource.Log.ExportFailure(this.Endpoint.ToString(), "Export failed due to unexpected status code.", status.StatusCode.ToString());
96+
OpenTelemetryProtocolExporterEventSource.Log.ExportFailure(this.Endpoint.ToString(), "Export failed due to unexpected status code.", status);
9797

9898
return new ExportClientGrpcResponse(
9999
success: false,

src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OpenTelemetryProtocolExporterEventSource.cs

+14-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System.Diagnostics.Tracing;
55
using Microsoft.Extensions.Configuration;
6+
using OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.ExportClient.Grpc;
67
using OpenTelemetry.Internal;
78

89
namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation;
@@ -92,6 +93,15 @@ public void GrpcRetryDelayParsingFailed(string? grpcStatusDetailsHeader, Excepti
9293
{
9394
this.GrpcRetryDelayParsingFailed(grpcStatusDetailsHeader ?? "null", ex.ToInvariantString());
9495
}
96+
}
97+
98+
[NonEvent]
99+
public void ExportFailure(string endpoint, string message, Status status)
100+
{
101+
if (Log.IsEnabled(EventLevel.Error, EventKeywords.All))
102+
{
103+
this.ExportFailure(endpoint, message, status.StatusCode.ToString(), status.Detail);
104+
}
95105
}
96106

97107
[Event(2, Message = "Exporter failed send data to collector to {0} endpoint. Data will not be sent. Exception: {1}", Level = EventLevel.Error)]
@@ -206,12 +216,12 @@ public void ExportSuccess(string endpoint, string message)
206216
public void GrpcStatusWarning(string endpoint, string statusCode)
207217
{
208218
this.WriteEvent(22, endpoint, statusCode);
209-
}
219+
}
210220

211-
[Event(23, Message = "Export failed for {0}. Message: {1}. Status code: {2}", Level = EventLevel.Error)]
212-
public void ExportFailure(string endpoint, string message, string statusCode)
221+
[Event(23, Message = "Export failed for {0}. Message: {1}. Status Code: {2}. Detail: {3}.", Level = EventLevel.Error)]
222+
public void ExportFailure(string endpoint, string message, string statusCode, string detail)
213223
{
214-
this.WriteEvent(23, endpoint, message, statusCode);
224+
this.WriteEvent(23, endpoint, message, statusCode, detail);
215225
}
216226

217227
[Event(24, Message = "Failed to parse gRPC retry delay from header grpcStatusDetailsHeader: '{0}'. Exception: {1}", Level = EventLevel.Warning)]

0 commit comments

Comments
 (0)