Example #1
0
        public static void ActorActivate(this IActorConfiguration configuration, IWorkContext context, ActorKey actorKey, Type actorType, string message = null)
        {
            Verify.IsNotNull(nameof(configuration), configuration);
            Verify.IsNotNull(nameof(actorKey), actorKey);
            Verify.IsNotNull(nameof(actorType), actorType);

            IEventDimensions dimensions = new EventDimensionsBuilder()
                                          .Add(nameof(actorKey), actorKey)
                                          .Add(nameof(actorType), actorType)
                                          .Add(nameof(message), message)
                                          .Build();

            configuration.WorkContext.EventLog.LogEvent(context, TelemetryLevel.Verbose, _actorEventName, nameof(ActorActivate), dimensions);
            configuration.WorkContext.EventLog.TrackMetric(context, nameof(ActorActivate), dimensions);
        }
        public static void ActorActivateEvent(this ActorConfiguration configuration, IWorkContext context, ActorKey actorKey, Type actorType, string?message = null)
        {
            configuration.Verify(nameof(configuration)).IsNotNull();
            actorKey.Verify(nameof(actorKey)).IsNotNull();
            actorType.Verify(nameof(actorType)).IsNotNull();

            IEventDimensions dimensions = new EventDimensionsBuilder()
                                          .Add(nameof(actorKey), actorKey)
                                          .Add(nameof(actorType), actorType)
                                          .Add(nameof(message), message)
                                          .Build();

            configuration.WorkContext.Telemetry.LogEvent(context, nameof(ActorActivateEvent), dimensions);
            configuration.WorkContext.Telemetry.TrackMetric(context, nameof(ActorActivateEvent), dimensions);
        }
Example #3
0
        public static void ActorCalled(this IActorConfiguration configuration, IWorkContext context, ActorKey actorKey, Type interfaceType, string methodName, string message = null)
        {
            Verify.IsNotNull(nameof(configuration), configuration);
            Verify.IsNotNull(nameof(actorKey), actorKey);
            Verify.IsNotNull(nameof(interfaceType), interfaceType);
            Verify.IsNotEmpty(nameof(methodName), methodName);

            IEventDimensions dimensions = new EventDimensionsBuilder()
                                          .Add(nameof(actorKey), actorKey)
                                          .Add(nameof(interfaceType), interfaceType)
                                          .Add(nameof(methodName), methodName)
                                          .Add(nameof(message), message)
                                          .Build();

            configuration.WorkContext.EventLog.LogEvent(context, TelemetryLevel.Verbose, _actorEventName, nameof(ActorCalled), dimensions);
        }
        public void TestDimensionsTest()
        {
            IWorkContext wrk = new WorkContextBuilder()
            {
                Dimensions = new EventDimensionsBuilder()
                             .Add("Key1", "Value1")
                             .Add("Key2", "Value2")
                             .Build(),
            }.Build();

            wrk.Dimensions.Count.Should().Be(2);
            wrk.Dimensions["Key1"].Should().Be("Value1");
            wrk.Dimensions["Key2"].Should().Be("Value2");

            var dim = new EventDimensionsBuilder()
                      .Add("Key3", "Value3")
                      .Add("Key4", "Value4")
                      .Build();

            wrk.Dimensions.Count.Should().Be(2);
            dim["Key3"].Should().Be("Value3");
            dim["Key4"].Should().Be("Value4");

            wrk = wrk.With(dim);
            wrk.Dimensions.Count.Should().Be(4);
            wrk.Dimensions["Key1"].Should().Be("Value1");
            wrk.Dimensions["Key2"].Should().Be("Value2");
            wrk.Dimensions["Key3"].Should().Be("Value3");
            wrk.Dimensions["Key4"].Should().Be("Value4");

            var dim2 = new EventDimensionsBuilder()
                       .Add("Key3", "Value33")
                       .Add("Key4", "Value44")
                       .Build();

            wrk = wrk.With(dim2);
            wrk.Dimensions.Count.Should().Be(4);
            wrk.Dimensions["Key1"].Should().Be("Value1");
            wrk.Dimensions["Key2"].Should().Be("Value2");
            wrk.Dimensions["Key3"].Should().Be("Value33");
            wrk.Dimensions["Key4"].Should().Be("Value44");
        }
        public void DimensionTest()
        {
            var dimensions = new EventDimensionsBuilder()
                             .Add("WorkflowCv", new CorrelationVector().ToString())
                             .Add("PackageName", "PackageNameData")
                             .Add("FriendlyName", "friendlyNameData")
                             .Add("BuildNumber", "buildNumberData")
                             .Build();

            dimensions.Count.Should().Be(4);

            IEventDimensions addDimensions = new EventDimensionsBuilder()
                                             .Add("ExeFile", "Exec.exe")
                                             .Add("NodeType", "LocalExec")
                                             .Build();

            addDimensions.Count.Should().Be(2);

            IEventDimensions newDimensions = (EventDimensions)dimensions + addDimensions;

            newDimensions.Count.Should().Be(6);
        }