< Summary

Class:SeungYongShim.Akka.OpenTelemetry.TraceRepointableActorRef
Assembly:SeungYongShim.Akka.OpenTelemetry
File(s):/home/runner/work/SeungYongShim.Akka/SeungYongShim.Akka/src/SeungYongShim.Akka.OpenTelemetry/TraceRepointableActorRef.cs
Covered lines:14
Uncovered lines:11
Coverable lines:25
Total lines:57
Line coverage:56% (14 of 25)
Covered branches:0
Total branches:2
Branch coverage:0% (0 of 2)
Tag:81_945672945

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)0%110100%
SendSystemMessage(...)0%339233.33%
NewCell()0%110100%

File(s)

/home/runner/work/SeungYongShim.Akka/SeungYongShim.Akka/src/SeungYongShim.Akka.OpenTelemetry/TraceRepointableActorRef.cs

#LineLine coverage
 1using System;
 2using System.Diagnostics;
 3using Akka.Actor;
 4using Akka.Actor.Internal;
 5using Akka.Dispatch;
 6using Akka.Dispatch.SysMsg;
 7using System.Reflection;
 8
 9namespace SeungYongShim.Akka.OpenTelemetry
 10{
 11    public class TraceRepointableActorRef : RepointableActorRef
 12    {
 13        private MailboxType _mailboxType;
 14        private Type ActorTaskSchedulerMessageType;
 15
 16        public TraceRepointableActorRef(ActorSystemImpl system,
 17                                        Props props,
 18                                        MessageDispatcher dispatcher,
 19                                        MailboxType mailboxType,
 20                                        IInternalActorRef supervisor,
 21                                        ActorPath path,
 22                                        Type actorTaskSchedulerMessageType)
 3223            : base(system, props, dispatcher, mailboxType, supervisor, path)
 3224        {
 3225            _mailboxType = mailboxType;
 3226            ActorTaskSchedulerMessageType = actorTaskSchedulerMessageType;
 3227        }
 28
 29        public TraceActorCell TraceActorCell { get; private set; }
 30
 31        public override void SendSystemMessage(ISystemMessage message)
 1032        {
 1033            if (ActorTaskSchedulerMessageType.IsInstanceOfType(message))
 034            {
 035                if (ActorTaskSchedulerMessageType.GetProperty("Exception")?
 036                                                 .GetValue(message) is Exception ex)
 037                {
 038                    var m = ActorTaskSchedulerMessageType.GetProperty("Message")?
 039                                                         .GetValue(message);
 40
 041                    message = (ISystemMessage)Activator.CreateInstance(ActorTaskSchedulerMessageType,
 042                                                                       new TraceException(ex), m);
 043                    TraceActorCell.ActivityNew = Activity.Current?.Id;
 044                }
 045            }
 46
 1047            base.SendSystemMessage(message);
 1048        }
 49
 50        protected override ActorCell NewCell()
 3251        {
 3252            TraceActorCell = new TraceActorCell(System, this, Props, Dispatcher, Supervisor);
 3253            TraceActorCell.Init(false, _mailboxType);
 3254            return TraceActorCell;
 3255        }
 56    }
 57}