{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/php-docs-samples/issues/264","repository_url":"https://api.github.com/repos/GoogleCloudPlatform/php-docs-samples","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/php-docs-samples/issues/264/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/php-docs-samples/issues/264/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/php-docs-samples/issues/264/events","html_url":"https://github.com/GoogleCloudPlatform/php-docs-samples/issues/264","id":193737287,"number":264,"title":"Error Reporting sample is not working.","user":{"login":"steren","id":360895,"avatar_url":"https://avatars.githubusercontent.com/u/360895?v=3","gravatar_id":"","url":"https://api.github.com/users/steren","html_url":"https://github.com/steren","followers_url":"https://api.github.com/users/steren/followers","following_url":"https://api.github.com/users/steren/following{/other_user}","gists_url":"https://api.github.com/users/steren/gists{/gist_id}","starred_url":"https://api.github.com/users/steren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steren/subscriptions","organizations_url":"https://api.github.com/users/steren/orgs","repos_url":"https://api.github.com/users/steren/repos","events_url":"https://api.github.com/users/steren/events{/privacy}","received_events_url":"https://api.github.com/users/steren/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2016-12-06T10:37:06Z","updated_at":"2016-12-09T15:38:32Z","closed_at":null,"body":"I realized today that the following [Error Reporting sample](https://github.com/GoogleCloudPlatform/php-docs-samples/blob/master/compute/logging/index.php):\r\n```php\r\n$msg = array(\r\n        'message' => $e->getMessage(),\r\n        'serviceContext' => array('service' => 'myapp'),\r\n        // ... add more metadata\r\n    );\r\n```\r\nDoes not produce log messages that are processed by Stackdriver Error Reporting.\r\n\r\nWhile waiting for the Stackdriver error parser to be updated, we must update our code sample to log errors in the appropriate format:\r\n\r\nThis code produces a payload that is correctly processed, I tested it and another person confirmed:\r\n```php\r\n$msg = array(\r\n        'message' => sprintf(\"PHP Notice: %s\", (string)$e),\r\n        'serviceContext' => array('service' => 'myapp'),\r\n        // ... add more metadata\r\n    );\r\n```\r\n\r\nI wanted to submit a PR, but realize that there are tests associated. Please update the sample as soon as possible to fix the Stackdriver Error Reporting compute engine instructions: https://cloud.google.com/error-reporting/docs/setup/compute-engine"},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/php-docs-samples/issues/comments/266043649","html_url":"https://github.com/GoogleCloudPlatform/php-docs-samples/issues/264#issuecomment-266043649","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/php-docs-samples/issues/264","id":266043649,"user":{"login":"steren","id":360895,"avatar_url":"https://avatars.githubusercontent.com/u/360895?v=3","gravatar_id":"","url":"https://api.github.com/users/steren","html_url":"https://github.com/steren","followers_url":"https://api.github.com/users/steren/followers","following_url":"https://api.github.com/users/steren/following{/other_user}","gists_url":"https://api.github.com/users/steren/gists{/gist_id}","starred_url":"https://api.github.com/users/steren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steren/subscriptions","organizations_url":"https://api.github.com/users/steren/orgs","repos_url":"https://api.github.com/users/steren/repos","events_url":"https://api.github.com/users/steren/events{/privacy}","received_events_url":"https://api.github.com/users/steren/received_events","type":"User","site_admin":false},"created_at":"2016-12-09T15:38:32Z","updated_at":"2016-12-09T15:38:32Z","body":"Yes, adding a `severity` in the payload probably is better for users. But is not a hard requirement for errors to be processed.\r\n\r\nSo after the parser fix, the sample should be:\r\n\r\n```php\r\n$msg = array(\r\n        'message' => (string)$e,\r\n        'serviceContext' => array('service' => 'myapp'),\r\n        'severity'=>'ERROR'\r\n        // ... add more metadata\r\n    );\r\n```"}}
{"actor":{"display_login":"steren"}}