{"action":"created","issue":{"url":"https://api.github.com/repos/stayallive/wp-sentry/issues/32","repository_url":"https://api.github.com/repos/stayallive/wp-sentry","labels_url":"https://api.github.com/repos/stayallive/wp-sentry/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/stayallive/wp-sentry/issues/32/comments","events_url":"https://api.github.com/repos/stayallive/wp-sentry/issues/32/events","html_url":"https://github.com/stayallive/wp-sentry/pull/32","id":440473573,"node_id":"MDExOlB1bGxSZXF1ZXN0Mjc2MDE1NTEz","number":32,"title":"Release/3.0.0","user":{"login":"codingwithchris","id":17693193,"node_id":"MDQ6VXNlcjE3NjkzMTkz","avatar_url":"https://avatars3.githubusercontent.com/u/17693193?v=4","gravatar_id":"","url":"https://api.github.com/users/codingwithchris","html_url":"https://github.com/codingwithchris","followers_url":"https://api.github.com/users/codingwithchris/followers","following_url":"https://api.github.com/users/codingwithchris/following{/other_user}","gists_url":"https://api.github.com/users/codingwithchris/gists{/gist_id}","starred_url":"https://api.github.com/users/codingwithchris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codingwithchris/subscriptions","organizations_url":"https://api.github.com/users/codingwithchris/orgs","repos_url":"https://api.github.com/users/codingwithchris/repos","events_url":"https://api.github.com/users/codingwithchris/events{/privacy}","received_events_url":"https://api.github.com/users/codingwithchris/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-05-05T18:17:27Z","updated_at":"2019-05-27T12:31:50Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/stayallive/wp-sentry/pulls/32","html_url":"https://github.com/stayallive/wp-sentry/pull/32","diff_url":"https://github.com/stayallive/wp-sentry/pull/32.diff","patch_url":"https://github.com/stayallive/wp-sentry/pull/32.patch"},"body":"## PR Overview\r\nThis is a proposed major re-write of the `wp-sentry` plugin which would effectively bring the new version of this plugin to `3.0.0`. The aim of this release is to refactor the plugin to work with the latest available SDKs from Sentry while doing our best to minimize breaking changes inherent in such a significant re-write.\r\n\r\n## Major Changes\r\n\r\n*Quick Overview*\r\n- `wp-sentry` plugin fully refactored with a strong focus on single responsibility, dependency injection, PSR4 standards, ES6 Standards, DRY principles, and ease of future maintenance.\r\n- PHP Requirement bumped to `7.0`\r\n- Sentry PHP SDK `2.0.2` implemented\r\n- Sentry JS SDK `5.1.2` implemented\r\n- New Webpack Build process introduced with NPM\r\n\r\n*Backend Notable Changes*\r\n1. `wp-sentry.php` was simplified and cleaned up and improved with expanded constants\r\n2. Advanced constant definitions and plugin setup was moved to the new `bootstrap` dir\r\n3. All plugin classes rebuilt and re-organized according to PSR4 conventions.\r\n4. `WPSentry` namespacing introduced to project.\r\n5. Context handling was moved to its own `Context` class to better adhere to the single responsibility principle. This class is responsible for getting the default context, filtering it, updating it with additional context data and finally updating the context config file. We are calling this process `hydration`\r\n6. The `TrackerBase` abstract class was drastically simplified -- this new class effectively replaces `WP_Sentry_Tracker_Base`.\r\n7. The `PHP` and `JS` classes were drastically simplified. They are now only responsible for sending context and init data to Sentry and getting filtered init configurations. These new classes effectively replace `WP_Sentry_Js_Tracker` and `WP_Sentry_Php_Tracker`\r\n8. A new `Config` class and `ConfigInterface` were introduced to make handling getting and updating runtime configurations for our project classes dead simple and incredibly elegant.\r\n9. All defaults were moved to the new `config/` dir. We introduced `config/context.php` and `config/init.php` to hold context defaults and default init options respectively.\r\n\r\n*Build Process + Frontend Notable Changes*\r\n1. The `public` directory was changed to `dist`\r\n2. Introduce a new JS build process including `webpack` and `babel`\r\n3. Include Sentry as NPM module\r\n4. Import Sentry as an ES6 module into JS file\r\n5. Rebuild JS File using a function-based approach and ES6 standards\r\n6. Create new `assets` directory to work with assets and build process\r\n7. Renamed working JS file with camel case for Webpack entry point reference\r\n8. When building assets, a manifest file is created in the `dist` directory via to `webpack-assets-manifest`. This manifest lets us reference a dynamically generated, hashed asset name. This gives us incredible control over caching and is far superior to query strings since they cause lots of caching problems.\r\n9. A new `Manifest` class was built to work with the asset manifest. it resolves dynamically hashed file names from a manifest key which we can easily use when enqueueing the asset!\r\n10. Sentry init and context options properly localized into enqueued file -- kept `wp_sentry` as local car name.\r\n\r\n## Modified Actions & Filters\r\n\r\n#### Deprecated Filters (Removed)\r\n- `wp_sentry_on_send_data` -- this filter is no longer relevant to the latest SDK\r\n\r\n- `wp_sentry_dsn` -- DSN  for PHP is no longer directly filtered. It can, however, be accessed and modified via the filter `wp_sentry_options`\r\n\r\n- `wp_sentry_public_dsn` -- DSN  for JS is no longer directly filtered. It can, however, be accessed and modified via the filter `wp_sentry_public_options`\r\n\r\n#### Modified Filters\r\n- `wp_sentry_options` -- This filter used to contain all properties available in one object (including all contexts and init options). It now only contains init properties. Context is handled separately due to how it is ultimately implemented in the new SDK\r\n\r\n- `wp_sentry_public_options` -- This filter used to contain all properties available in one object (including all contexts and init options). It now only contains init properties. Context is handled separately due to how it is ultimately implemented in the new SDK\r\n\r\n#### New Filters\r\nNew filters were added to allow the Sentry contexts to be easily modified\r\n- `wp_sentry_tags_context`\r\n- `wp_sentry_extra_context`\r\n- `wp_sentry_level_context`\r\n\r\n#### New Actions\r\nThese action hooks fire after each respective context has been hydrated by its data. They are currently used to run the new Sentry `configureScope` methods.\r\n- `wp_sentry_user_context_hydrated`\r\n- `wp_sentry_tags_context_hydrated`\r\n- `wp_sentry_extra_context_hydrated`\r\n\r\n### New Proposed Filter Usage (not updated in docs yet)\r\nDue to the separation of context and init options, we can simplify usage of the new filters by forgoing an array merge. An easier method is simply assigning your new value to the desired array key. Example:\r\n```\r\nadd_filter( 'wp_sentry_options', function( array $options ){\r\n\r\n    $options['dsn'] = 'newdsnvalue';\r\n    $options['sampleRate'] = '0.5';\r\n    $options['blacklistUrls'] = [\r\n        'https://github.com/',\r\n    ];\r\n\r\n     return $options;\r\n\r\n});\r\n```\r\n\r\n### New MU-Plugin Usage\r\n\r\n`define( 'WP_SENTRY_MU_LOADED', true );` No longer has to be implemented manually.\r\n\r\nThe constant `define( 'WP_SENTRY_EXISTS', true );` is automatically set after we are sure the plugin is going to run. If the plugin is loaded as an MU-Plugin and then attempted to load again at any other point thereafter, it will fail to load without manual intervention --- see the following block located at the very top of `wp-sentry.php`\r\n```\r\n// If the plugin was already loaded, do not load again.\r\nif ( defined( 'WP_SENTRY_EXISTS' ) ) {\r\n\treturn;\r\n}\r\n```\r\n\r\n###  Still To Do\r\n- Make sure this rewrite aligns with the author's vision for the plugin\r\n- Work through required changes\r\n- Thoroughly test the plugin in multiple environments\r\n- Thoroughly test the upgrade process in multiple environments\r\n- Update documentation based on changes and include information about the migration process if needed."},"comment":{"url":"https://api.github.com/repos/stayallive/wp-sentry/issues/comments/496197193","html_url":"https://github.com/stayallive/wp-sentry/pull/32#issuecomment-496197193","issue_url":"https://api.github.com/repos/stayallive/wp-sentry/issues/32","id":496197193,"node_id":"MDEyOklzc3VlQ29tbWVudDQ5NjE5NzE5Mw==","user":{"login":"killua99","id":457822,"node_id":"MDQ6VXNlcjQ1NzgyMg==","avatar_url":"https://avatars3.githubusercontent.com/u/457822?v=4","gravatar_id":"","url":"https://api.github.com/users/killua99","html_url":"https://github.com/killua99","followers_url":"https://api.github.com/users/killua99/followers","following_url":"https://api.github.com/users/killua99/following{/other_user}","gists_url":"https://api.github.com/users/killua99/gists{/gist_id}","starred_url":"https://api.github.com/users/killua99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/killua99/subscriptions","organizations_url":"https://api.github.com/users/killua99/orgs","repos_url":"https://api.github.com/users/killua99/repos","events_url":"https://api.github.com/users/killua99/events{/privacy}","received_events_url":"https://api.github.com/users/killua99/received_events","type":"User","site_admin":false},"created_at":"2019-05-27T12:31:50Z","updated_at":"2019-05-27T12:31:50Z","author_association":"NONE","body":"A really neat and simple refactoring.\r\n\r\nTwo thing I come with the refactoring.\r\n\r\n* PSR-4, it doesn't follow a close file name WordPress standard or structure, I probably will suggest to rollback to an autoloader classmap instead, and file name with class-thing.php instead.\r\n\r\n* Autoload, if you use compose in your project you will end up with two Sentry SDK, one on your root composer.json vendor folder, the other one directly on the plugin. Could we re-do the autoloader discovery better or more flexible for this cases?"}}
{"actor":{"display_login":"killua99"}}