{"action":"created","issue":{"url":"https://api.github.com/repos/adobe/commerce-cif-magento/issues/27","repository_url":"https://api.github.com/repos/adobe/commerce-cif-magento","labels_url":"https://api.github.com/repos/adobe/commerce-cif-magento/issues/27/labels{/name}","comments_url":"https://api.github.com/repos/adobe/commerce-cif-magento/issues/27/comments","events_url":"https://api.github.com/repos/adobe/commerce-cif-magento/issues/27/events","html_url":"https://github.com/adobe/commerce-cif-magento/pull/27","id":349520833,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA3NjE2MjQ4","number":27,"title":"CIF-287 - PROPOSAL: Debugging mode","user":{"login":"herzog31","id":4084418,"node_id":"MDQ6VXNlcjQwODQ0MTg=","avatar_url":"https://avatars0.githubusercontent.com/u/4084418?v=4","gravatar_id":"","url":"https://api.github.com/users/herzog31","html_url":"https://github.com/herzog31","followers_url":"https://api.github.com/users/herzog31/followers","following_url":"https://api.github.com/users/herzog31/following{/other_user}","gists_url":"https://api.github.com/users/herzog31/gists{/gist_id}","starred_url":"https://api.github.com/users/herzog31/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/herzog31/subscriptions","organizations_url":"https://api.github.com/users/herzog31/orgs","repos_url":"https://api.github.com/users/herzog31/repos","events_url":"https://api.github.com/users/herzog31/events{/privacy}","received_events_url":"https://api.github.com/users/herzog31/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-08-10T13:43:27Z","updated_at":"2018-08-15T11:02:33Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/adobe/commerce-cif-magento/pulls/27","html_url":"https://github.com/adobe/commerce-cif-magento/pull/27","diff_url":"https://github.com/adobe/commerce-cif-magento/pull/27.diff","patch_url":"https://github.com/adobe/commerce-cif-magento/pull/27.patch"},"body":"**NOTE:** This is just a proposal, open for discussion. Please do not merge.\r\n\r\nThe motivation for these changes are to make developers' lives easier and to enable deeper insights for testing.\r\n\r\n### 1. Enable Debug mode\r\nYou can enable the debug mode by setting the `DEBUG` parameter either as query or form parameter.\r\n\r\n### 2. OpenWhisk Activation ID\r\nIf the debug mode is enabled, the action will return it's activation Id as response header in the `OW-Activation-Id` field. Exposing an activation ID to the outside is no security concern, since it's only useful if you have actually access to the OpenWhisk namespace.\r\n\r\n#### Example\r\nRequest: `https://runtime.adobe.io/api/v1/web/namespace/magento/getCategories?DEBUG=1`\r\nResponse Header: `OW-Activation-Id: c58858d6a7d642f78858d6a7d682f71d`\r\n\r\n### 3. Backend Requests\r\nEvery request made to the commerce engine (Magento in this case) is logged and visible in the activation log. In comparison to the previous approach with the performance headers, the information is not exposed to the public and only available with access to the OpenWhisk namespace.\r\n\r\nI also looked into alternative approaches. In comparison to the headers, the logging is much simpler and only requires changes at one location (where the request is made). All other metrics like action invocations, sequence duration etc. can be retrieved from the activation logs. Another approach is the usage of OpenWhisk triggers which can be bound to actions. This approach however has the disadvantage that the `openwhisk` node package communicates with the OpenWhisk API via HTTP calls. This comes with potential performance drawbacks. Also to actually process the performance data, for each trigger an action has to be called which results in a high load on the OpenWhisk instance.\r\n\r\n#### Example\r\nRequest: `https://runtime.adobe.io/api/v1/web/namespace/magento/postCartEntry?DEBUG=1&productVariantId=eqbisumas-10&quantity=2`\r\nActivation log: \r\n```\r\n\"logs\": [\r\n    \"2018-08-10T10:43:44.261868285Z stdout: BACKEND-CALL POST http://hostname/rest/V1/guest-carts 556188.263 PASS\",\r\n    \"2018-08-10T10:43:45.140676575Z stdout: BACKEND-CALL POST http://hostname/rest/V1/guest-carts/481ce6af452e567f3212b5fed7fa2337/items 878420.555 PASS\",\r\n    \"2018-08-10T10:43:45.97952998Z  stdout: BACKEND-CALL GET http://hostname/rest/V1/guest-aggregated-carts/481ce6af452e567f3212b5fed7fa2337?productAttributesSearchCriteria[filter_groups][0][filters][0][field]=attribute_code&productAttributesSearchCriteria[filter_groups][0][filters][0][value]=color&productAttributesSearchCriteria[filter_groups][0][filters][1][field]=attribute_code&productAttributesSearchCriteria[filter_groups][0][filters][1][value]=size 838461.798 PASS\"\r\n]\r\n```"},"comment":{"url":"https://api.github.com/repos/adobe/commerce-cif-magento/issues/comments/413164738","html_url":"https://github.com/adobe/commerce-cif-magento/pull/27#issuecomment-413164738","issue_url":"https://api.github.com/repos/adobe/commerce-cif-magento/issues/27","id":413164738,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMzE2NDczOA==","user":{"login":"mhaack","id":2643450,"node_id":"MDQ6VXNlcjI2NDM0NTA=","avatar_url":"https://avatars2.githubusercontent.com/u/2643450?v=4","gravatar_id":"","url":"https://api.github.com/users/mhaack","html_url":"https://github.com/mhaack","followers_url":"https://api.github.com/users/mhaack/followers","following_url":"https://api.github.com/users/mhaack/following{/other_user}","gists_url":"https://api.github.com/users/mhaack/gists{/gist_id}","starred_url":"https://api.github.com/users/mhaack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhaack/subscriptions","organizations_url":"https://api.github.com/users/mhaack/orgs","repos_url":"https://api.github.com/users/mhaack/repos","events_url":"https://api.github.com/users/mhaack/events{/privacy}","received_events_url":"https://api.github.com/users/mhaack/received_events","type":"User","site_admin":false},"created_at":"2018-08-15T11:02:33Z","updated_at":"2018-08-15T11:02:33Z","author_association":"COLLABORATOR","body":"@herzog31 I think there might be some performance aspect since OW activation log will be bigger, hence more data must be processed OW internally.\r\n\r\nRegarding the parameters & default parameters, I'm referring to https://github.com/apache/incubator-openwhisk/blob/master/docs/webactions.md#protected-parameters"}}
{"actor":{"display_login":"mhaack"}}