:PROPERTIES: :ID: f4acd678-6415-44ee-8ef3-113ba1234e43 :END: #+title: 2022-03-22 * Debugging campaign tag automations https://jira.aweber.io/browse/CCPANEL-12031 Looking into why the campaign engine / ruleset changes for [[id:d06d3ab4-c2d0-47c3-aae1-4395567fc3d2][Tag Normalization]] aren't having the intended effect in staging. Looking at logs from the =campaign-tag-consumer=, it's loading the ruleset, and triggering only on the exact-match tag, not all normalized tags. #+begin_example campaign-tag-consumer-78c84676f8-27hbr campaign-tag-consumer {"name":"rulesengine.campaign","levelname":"INFO","asctime":"2022-03-22T16:23:22.966801+0000","processName":"campaign-tag-consumer-1","message":"Received tag.v1 for subscriber dc827a46-4941-4988-8ffd-127cdb992def in account 26b49bc2-207e-4a33-b267-5b9e64f2702e","module":"campaign","correlation_id":"75307660-bcd4-492b-ae98-cd5a1293ab28","exc_info":null} campaign-tag-consumer-78c84676f8-27hbr campaign-tag-consumer {"name":"rulesengine.campaign","levelname":"WARNING","asctime":"2022-03-22T16:23:22.968646+0000","processName":"campaign-tag-consumer-1","message":"Lock of dc827a46-4941-4988-8ffd-127cdb992def failed","module":"consumer","correlation_id":"75307660-bcd4-492b-ae98-cd5a1293ab28","exc_info":null} campaign-tag-consumer-78c84676f8-27hbr campaign-tag-consumer {"name":"rulesengine.campaign","levelname":"WARNING","asctime":"2022-03-22T16:23:22.969219+0000","processName":"campaign-tag-consumer-1","message":"ProcessingException processing delivery 6825: subscriber-locked: dc827a46-4941-4988-8ffd-127cdb992def","module":"consumer","correlation_id":"75307660-bcd4-492b-ae98-cd5a1293ab28","exc_info":null} campaign-tag-consumer-78c84676f8-27hbr campaign-tag-consumer {"name":"rulesengine.campaign","levelname":"INFO","asctime":"2022-03-22T16:23:27.975047+0000","processName":"campaign-tag-consumer-1","message":"Received tag.v1 for subscriber dc827a46-4941-4988-8ffd-127cdb992def in account 26b49bc2-207e-4a33-b267-5b9e64f2702e","module":"campaign","correlation_id":"75307660-bcd4-492b-ae98-cd5a1293ab28","exc_info":null} campaign-tag-consumer-78c84676f8-27hbr campaign-tag-consumer {"name":"rulesengine.campaign","levelname":"INFO","asctime":"2022-03-22T16:23:28.219805+0000","processName":"campaign-tag-consumer-1","message":"Found 2 rulesets","module":"campaign","correlation_id":"75307660-bcd4-492b-ae98-cd5a1293ab28","exc_info":null} campaign-tag-consumer-78c84676f8-27hbr campaign-tag-consumer {"name":"rulesengine.campaign","levelname":"INFO","asctime":"2022-03-22T16:23:28.420992+0000","processName":"campaign-tag-consumer-1","message":"Processed action 396cd5d3-d410-4ae2-a991-b93a0b816600 (ruleset.email.action.compose_v1) in ruleset 01955ad5-cbca-455c-934f-d69a71a5578f for list 9f1db623-fbc3-4112-a2f3-ab563e37e131 from account 26b49bc2-207e-4a33-b267-5b9e64f2702e, subscriber dc827a46-4941-4988-8ffd-127cdb992def scope","module":"consumer","correlation_id":"75307660-bcd4-492b-ae98-cd5a1293ab28","exc_info":null} campaign-tag-consumer-78c84676f8-27hbr campaign-tag-consumer {"name":"rulesengine.campaign","levelname":"INFO","asctime":"2022-03-22T16:23:28.608207+0000","processName":"campaign-tag-consumer-1","message":"Subscriber dc827a46-4941-4988-8ffd-127cdb992def completed campaign ruleset 01955ad5-cbca-455c-934f-d69a71a5578f","module":"campaign","correlation_id":"75307660-bcd4-492b-ae98-cd5a1293ab28","exc_info":null} #+end_example The subscriber was created and tagged with the normalized version of the tag. It is expected that it should trigger both the campaign using the normalized tag /and/ the campaign using the non-normalized tag. #+begin_src http :pretty :exports both :cache yes GET http://tagging.aweberstage.com/entity/dc827a46-4941-4988-8ffd-127cdb992def #+end_src #+RESULTS[b55ea1d22803f0ef37c5fbadbfd8fb656624f40e]: #+begin_example { "id": "dc827a46-4941-4988-8ffd-127cdb992def", "entity_type": "subscriber", "owner": "26b49bc2-207e-4a33-b267-5b9e64f2702e", "parent": "9f1db623-fbc3-4112-a2f3-ab563e37e131", "version": 1, "created_at": "2022-03-22T16:23:19+0000", "modified_at": "2022-03-22T16:23:19+0000", "labels": [ "scott miller" ] } #+end_example These are the rulesets for the normalized and non-normalized campaign triggers: #+CAPTION: Campaign triggering on a normalized tag #+begin_src http :pretty :exports both :cache yes GET https://rule.aweberstage.com/01955ad5-cbca-455c-934f-d69a71a5578f #+end_src #+RESULTS[685774a46bbaf38b945afcc0952a390d1bc53ed3]: #+begin_example { "id": "01955ad5-cbca-455c-934f-d69a71a5578f", "version": 2, "owner": "26b49bc2-207e-4a33-b267-5b9e64f2702e", "parent": "9f1db623-fbc3-4112-a2f3-ab563e37e131", "state": "active", "system": false, "iterator": null, "events": [ { "id": "b3b69bd4-0c7b-4253-ab65-e6fcbb726f07", "type": "tag.v1", "title": null, "filter": { "type": "all", "criteria": [ { "expect": true, "kwargs": { "key": "label", "values": [ "scott miller" ] }, "function": "rulesengine.filter.event_value_in", "operator": "==" }, { "expect": true, "kwargs": { "list": "", "labels": [ "scott miller" ], "account": "", "recipient": "" }, "function": "ruleset.tag.filter.any_tags_v1", "operator": "==" } ] }, "parents": [], "metadata": "tag.v1", "recurring": false } ], "actions": [ { "id": "396cd5d3-d410-4ae2-a991-b93a0b816600", "title": null, "parents": [ "b3b69bd4-0c7b-4253-ab65-e6fcbb726f07" ], "metadata": "send-message", "recurring": false, "definition": { "kwargs": { "list": "", "account": "", "message": "394c27bf-5853-4b45-9ff1-a0637848f4b6", "meapi_id": "6238dd85f227ef3f2d5ec3a5", "recipient": "" }, "function": "ruleset.email.action.compose_v1" } } ] } #+end_example #+CAPTION: Campaign triggering on a non-normalized tag #+begin_src http :pretty :exports both :cache yes GET https://rule.aweberstage.com/5ceb8b7d-9597-4927-917c-db7a3343860c #+end_src #+RESULTS[781befe5ea2d0073780b212d511eeffcc3d0a18d]: #+begin_example { "id": "5ceb8b7d-9597-4927-917c-db7a3343860c", "version": 2, "owner": "26b49bc2-207e-4a33-b267-5b9e64f2702e", "parent": "9f1db623-fbc3-4112-a2f3-ab563e37e131", "state": "active", "system": false, "iterator": null, "events": [ { "id": "6ef2cd40-3ab0-4744-8f11-23b8d59ac810", "type": "tag.v1", "title": null, "filter": { "type": "all", "criteria": [ { "expect": true, "kwargs": { "key": "label", "values": [ "scott miller" ] }, "function": "rulesengine.filter.event_value_in", "operator": "==" }, { "expect": true, "kwargs": { "list": "", "labels": [ "scott miller" ], "account": "", "recipient": "" }, "function": "ruleset.tag.filter.any_tags_v1", "operator": "==" } ] }, "parents": [], "metadata": "tag.v1", "recurring": false } ], "actions": [ { "id": "0dd0fbbd-b275-4db6-b43d-81c89e75d2de", "title": null, "parents": [ "6ef2cd40-3ab0-4744-8f11-23b8d59ac810" ], "metadata": "send-message", "recurring": false, "definition": { "kwargs": { "list": "", "account": "", "message": "a346d692-78b7-41f0-9063-e371f5e7f8d4", "meapi_id": "6238dd12f227ef3f27843f63", "recipient": "" }, "function": "ruleset.email.action.compose_v1" } } ] } #+end_example In both cases, there is a generalized filter applied /before/ checking the tags on the subscriber which is performing an exact match on the value in the tag event. This is to ensure the campaign is only triggered when the subscriber is /being tagged/ with one of the chosen tags. This check will have to be made tag-aware such that it normalizes the values before comparing them if and only if the event being compared is a =tag.v1= event. Updated =rulesengine= in https://gitlab.aweber.io/CC/Libraries/rulesengine/-/merge_requests/117.