Skip to content

Commit

Permalink
fix issue#3276 (#1)
Browse files Browse the repository at this point in the history
fix Remote IP Address - NULL reference exception
  • Loading branch information
nayang7 authored Jul 24, 2022
1 parent f4dddbe commit ea14357
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,10 @@ private static void AddGrpcAttributes(Activity activity, string grpcMethod, Http
activity.DisplayName = grpcMethod.TrimStart('/');

activity.SetTag(SemanticConventions.AttributeRpcSystem, GrpcTagHelper.RpcSystemGrpc);
activity.SetTag(SemanticConventions.AttributeNetPeerIp, context.Connection.RemoteIpAddress.ToString());
if (context.Connection.RemoteIpAddress != null)
{
activity.SetTag(SemanticConventions.AttributeNetPeerIp, context.Connection.RemoteIpAddress.ToString());
}
activity.SetTag(SemanticConventions.AttributeNetPeerPort, context.Connection.RemotePort);

bool validConversion = GrpcTagHelper.TryGetGrpcStatusCodeFromActivity(activity, out int status);
Expand Down

0 comments on commit ea14357

Please sign in to comment.