12 KiB
2022-03-22
Debugging campaign tag automations
https://jira.aweber.io/browse/CCPANEL-12031
Looking into why the campaign engine / ruleset changes for 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.
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}
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.
GET http://tagging.aweberstage.com/entity/dc827a46-4941-4988-8ffd-127cdb992def
{ "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" ] }
These are the rulesets for the normalized and non-normalized campaign triggers:
{ "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": "<event:list>", "labels": [ "scott miller" ], "account": "<event:account>", "recipient": "<event: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": "<event:list>", "account": "<event:account>", "message": "394c27bf-5853-4b45-9ff1-a0637848f4b6", "meapi_id": "6238dd85f227ef3f2d5ec3a5", "recipient": "<event:recipient>" }, "function": "ruleset.email.action.compose_v1" } } ] }
{ "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": "<event:list>", "labels": [ "scott miller" ], "account": "<event:account>", "recipient": "<event: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": "<event:list>", "account": "<event:account>", "message": "a346d692-78b7-41f0-9063-e371f5e7f8d4", "meapi_id": "6238dd12f227ef3f27843f63", "recipient": "<event:recipient>" }, "function": "ruleset.email.action.compose_v1" } } ] }
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.
Looking up a campaign's ruleset
Fetch the campaign record using the UUID in the control0-panel campaign URL.
GET http://campaign.service.staging.consul/210b4a4f-ee07-4f1e-98c8-d16541f6e686
{ "id": "210b4a4f-ee07-4f1e-98c8-d16541f6e686", "name": "Normal Scott", "owner": "26b49bc2-207e-4a33-b267-5b9e64f2702e", "parent": "9f1db623-fbc3-4112-a2f3-ab563e37e131", "rule_set": "01955ad5-cbca-455c-934f-d69a71a5578f", "created_at": "2022-03-21T20:17:39.795431+00:00", "modified_at": "2022-03-24T18:34:37.909620+00:00", "state_changed_at": "2022-03-22T15:24:45.727430+00:00", "url": "http://campaign.service.staging.consul/210b4a4f-ee07-4f1e-98c8-d16541f6e686?owner=26b49bc2-207e-4a33-b267-5b9e64f2702e&parent=9f1db623-fbc3-4112-a2f3-ab563e37e131", "state": "active", "state_serial": 3, "is_valid": true, "is_legacy_followup": false, "sharing_enabled": false, "auto_extend_enabled": true, "extend_needed": false, "extended_at": null, "custom_fields": [], "global_fields": [], "campaign_type": "autoresponder", "properties": null }
Fetch the rule set using the rule_set
id returned with the campaign.
GET https://rule.aweberstage.com/01955ad5-cbca-455c-934f-d69a71a5578f
{ "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": [ "normalize test", "foo" ] }, "function": "rulesengine.filter.event_value_in", "operator": "==" }, { "expect": true, "kwargs": { "list": "<event:list>", "labels": [ "normalize test", "foo" ], "account": "<event:account>", "recipient": "<event:recipient>" }, "function": "ruleset.tag.filter.any_tags_v1", "operator": "==" }, { "expect": false, "kwargs": { "list": "<event:list>", "labels": [ "normalized tag" ], "account": "<event:account>", "recipient": "<event: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": "<event:list>", "account": "<event:account>", "message": "394c27bf-5853-4b45-9ff1-a0637848f4b6", "meapi_id": "6238dd85f227ef3f2d5ec3a5", "recipient": "<event:recipient>" }, "function": "ruleset.email.action.compose_v1" } } ] }