private void PublishCommandTelemetry(IExecutionContext context, TaskDefinitionRestrictions restrictions, Command command)
        {
            ArgUtil.NotNull(context, nameof(context));
            ArgUtil.NotNull(restrictions, nameof(restrictions));
            ArgUtil.NotNull(command, nameof(command));

            var data = new Dictionary <string, object>()
            {
                { "Command", $"{command.Area}.{command.Event}" }
            };

            PublishTelemetry(context, restrictions, "TaskRestrictions_Command", data);
        }
        private void PublishVariableTelemetry(IExecutionContext context, TaskDefinitionRestrictions restrictions, string variable)
        {
            ArgUtil.NotNull(context, nameof(context));
            ArgUtil.NotNull(restrictions, nameof(restrictions));
            ArgUtil.NotNull(variable, nameof(variable));

            var data = new Dictionary <string, object>()
            {
                { "Variable", variable }
            };

            PublishTelemetry(context, restrictions, "TaskRestrictions_SetVariable", data);
        }
        private void PublishTelemetry(IExecutionContext context, TaskDefinitionRestrictions restrictions, string feature, Dictionary <string, object> data)
        {
            ArgUtil.NotNull(context, nameof(context));
            ArgUtil.NotNull(restrictions, nameof(restrictions));
            ArgUtil.NotNull(feature, nameof(feature));
            ArgUtil.NotNull(data, nameof(data));

            data.Add("TaskName", restrictions.Definition.Name);
            data.Add("TaskVersion", restrictions.Definition.Version);

            CustomerIntelligenceEvent ciEvent = new CustomerIntelligenceEvent()
            {
                Area       = "AzurePipelinesAgent",
                Feature    = feature,
                Properties = data
            };

            var publishCommand = new PublishTelemetryCommand();

            publishCommand.PublishEvent(context, ciEvent);
        }