< Summary

Class:SeungYongShim.Akka.OpenTelemetry.TraceLocalActorRefProvider
Assembly:SeungYongShim.Akka.OpenTelemetry
File(s):/home/runner/work/SeungYongShim.Akka/SeungYongShim.Akka/src/SeungYongShim.Akka.OpenTelemetry/TraceLocalActorRefProvider.cs
Covered lines:47
Uncovered lines:25
Coverable lines:72
Total lines:134
Line coverage:65.2% (47 of 72)
Covered branches:8
Total branches:14
Branch coverage:57.1% (8 of 14)
Tag:81_945672945

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)0%110100%
.ctor(...)0%550100%
GetExternalAddressFor(...)0%2100%
Init(...)0%110100%
RegisterTempActor(...)0%110100%
ResolveActorRef(...)0%2100%
ResolveActorRef(...)0%2100%
RootGuardianAt(...)0%2100%
TempPath()0%110100%
UnregisterTempActor(...)0%110100%
ActorOf(...)60%22.991212857.58%

File(s)

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

#LineLine coverage
 1using System;
 2using System.Configuration;
 3using System.Reflection;
 4using System.Threading.Tasks;
 5using Akka.Actor;
 6using Akka.Actor.Internal;
 7using Akka.Event;
 8using Akka.Routing;
 9using Akka.Serialization;
 10
 11namespace SeungYongShim.Akka.OpenTelemetry
 12{
 13    public sealed class TraceLocalActorRefProvider : IActorRefProvider
 14    {
 15        private readonly LocalActorRefProvider _localActorRefProvider;
 16        private ActorSystemImpl _system;
 17
 18        public TraceLocalActorRefProvider(string systemName, Settings settings, EventStream eventStream)
 619            : this(systemName, settings, eventStream, null, null)
 620        {
 621        }
 22
 623        public TraceLocalActorRefProvider(string systemName, Settings settings, EventStream eventStream, Deployer deploy
 624        {
 625            var rootPath = new RootActorPath(new Address("akka", systemName));
 626            Log = Logging.GetLogger(eventStream, "TraceLocalActorRefProvider(" + rootPath.Address + ")");
 627            _localActorRefProvider = new LocalActorRefProvider(systemName, settings, eventStream, deployer, deadLettersF
 28
 629            var design = Assembly.GetAssembly(typeof(RepointableActorRef));
 630            ActorTaskSchedulerMessageType = design?.GetType("Akka.Dispatch.SysMsg.ActorTaskSchedulerMessage");
 631        }
 32
 2433        public IInternalActorRef RootGuardian => _localActorRefProvider.RootGuardian;
 34
 2035        public LocalActorRef Guardian => _localActorRefProvider.Guardian;
 36
 3637        public LocalActorRef SystemGuardian => _localActorRefProvider.SystemGuardian;
 38
 9339        public IActorRef DeadLetters => _localActorRefProvider.DeadLetters;
 40
 041        public IActorRef IgnoreRef => _localActorRefProvider.IgnoreRef;
 42
 043        public ActorPath RootPath => _localActorRefProvider.RootPath;
 44
 3945        public Settings Settings => _localActorRefProvider.Settings;
 46
 3647        public Deployer Deployer => _localActorRefProvider.Deployer;
 48
 049        public IInternalActorRef TempContainer => _localActorRefProvider.TempContainer;
 50
 651        public Task TerminationTask => _localActorRefProvider.TerminationTask;
 52
 053        public Address DefaultAddress => _localActorRefProvider.DefaultAddress;
 54
 055        public Information SerializationInformation => _localActorRefProvider.SerializationInformation;
 56
 057        public Address GetExternalAddressFor(Address address) => _localActorRefProvider.GetExternalAddressFor(address);
 58
 59        public void Init(ActorSystemImpl system)
 660        {
 661            _system = system;
 662            _localActorRefProvider.Init(system);
 663        }
 64
 1565        public void RegisterTempActor(IInternalActorRef actorRef, ActorPath path) => _localActorRefProvider.RegisterTemp
 66
 067        public IActorRef ResolveActorRef(string path) => _localActorRefProvider.ResolveActorRef(path);
 68
 069        public IActorRef ResolveActorRef(ActorPath actorPath) => _localActorRefProvider.ResolveActorRef(actorPath);
 70
 071        public IActorRef RootGuardianAt(Address address) => _localActorRefProvider.RootGuardianAt(address);
 72
 1573        public ActorPath TempPath() => _localActorRefProvider.TempPath();
 74
 1475        public void UnregisterTempActor(ActorPath path) => _localActorRefProvider.UnregisterTempActor(path);
 76
 77        public ILoggingAdapter Log { get; }
 78        public Type ActorTaskSchedulerMessageType { get; }
 79
 80        public IInternalActorRef ActorOf(ActorSystemImpl system, Props props, IInternalActorRef supervisor, ActorPath pa
 3681        {
 3682            if (props.Deploy.RouterConfig is NoRouter)
 3683            {
 3684                if (Settings.DebugRouterMisconfiguration)
 085                {
 086                    var d = Deployer.Lookup(path);
 087                    if (d != null && !(d.RouterConfig is NoRouter))
 088                        Log.Warning("Configuration says that [{0}] should be a router, but code disagrees. Remove the co
 089                                    path);
 090                }
 91
 3692                var props2 = props;
 93
 94                // mailbox and dispatcher defined in deploy should override props
 3695                var propsDeploy = lookupDeploy ? Deployer.Lookup(path) : deploy;
 3696                if (propsDeploy != null)
 2497                {
 2498                    if (propsDeploy.Mailbox != Deploy.NoMailboxGiven)
 099                        props2 = props2.WithMailbox(propsDeploy.Mailbox);
 24100                    if (propsDeploy.Dispatcher != Deploy.NoDispatcherGiven)
 0101                        props2 = props2.WithDispatcher(propsDeploy.Dispatcher);
 24102                }
 103
 36104                if (!system.Dispatchers.HasDispatcher(props2.Dispatcher))
 0105                {
 0106                    throw new ConfigurationException($"Dispatcher [{props2.Dispatcher}] not configured for path {path}")
 107                }
 108
 109                try
 36110                {
 111                    // for consistency we check configuration of dispatcher and mailbox locally
 36112                    var dispatcher = _system.Dispatchers.Lookup(props2.Dispatcher);
 36113                    var mailboxType = _system.Mailboxes.GetMailboxType(props2, dispatcher.Configurator.Config);
 114
 36115                    if (async)
 32116                        return
 32117                            new TraceRepointableActorRef(system, props2, dispatcher,
 32118                                mailboxType, supervisor, path, ActorTaskSchedulerMessageType).Initialize(async);
 4119                    return new TraceLocalActorRef(system, props2, dispatcher,
 4120                        mailboxType, supervisor, path, ActorTaskSchedulerMessageType);
 121                }
 0122                catch (Exception ex)
 0123                {
 0124                    throw new ConfigurationException(
 0125                        $"Configuration problem while creating [{path}] with dispatcher [{props.Dispatcher}] and mailbox
 126                }
 127            }
 128            else //routers!!!
 0129            {
 0130                throw new NotImplementedException("Router not support");
 131            }
 36132        }
 133    }
 134}