Skip to content

Commit 336c9a1

Browse files
committed
include status code in failure log
1 parent 71e6cb4 commit 336c9a1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
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.");
96+
OpenTelemetryProtocolExporterEventSource.Log.ExportFailure(this.Endpoint.ToString(), "Export failed due to unexpected status code.", (int)status.StatusCode);
9797

9898
return new ExportClientGrpcResponse(
9999
success: false,

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,10 @@ public void GrpcStatusWarning(string endpoint, string statusCode)
208208
this.WriteEvent(22, endpoint, statusCode);
209209
}
210210

211-
[Event(23, Message = "Export failed for {0}. Message: {1}", Level = EventLevel.Error)]
212-
public void ExportFailure(string endpoint, string message)
211+
[Event(23, Message = "Export failed for {0}. Message: {1}. Status code: {2}", Level = EventLevel.Error)]
212+
public void ExportFailure(string endpoint, string message, int statusCode)
213213
{
214-
this.WriteEvent(23, endpoint, message);
214+
this.WriteEvent(23, endpoint, message, statusCode);
215215
}
216216

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

0 commit comments

Comments
 (0)