{"action":"created","issue":{"url":"https://api.github.com/repos/p6spy/p6spy/issues/319","repository_url":"https://api.github.com/repos/p6spy/p6spy","labels_url":"https://api.github.com/repos/p6spy/p6spy/issues/319/labels{/name}","comments_url":"https://api.github.com/repos/p6spy/p6spy/issues/319/comments","events_url":"https://api.github.com/repos/p6spy/p6spy/issues/319/events","html_url":"https://github.com/p6spy/p6spy/issues/319","id":153068709,"number":319,"title":"Add support for events","user":{"login":"quintonm","id":991413,"avatar_url":"https://avatars.githubusercontent.com/u/991413?v=3","gravatar_id":"","url":"https://api.github.com/users/quintonm","html_url":"https://github.com/quintonm","followers_url":"https://api.github.com/users/quintonm/followers","following_url":"https://api.github.com/users/quintonm/following{/other_user}","gists_url":"https://api.github.com/users/quintonm/gists{/gist_id}","starred_url":"https://api.github.com/users/quintonm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quintonm/subscriptions","organizations_url":"https://api.github.com/users/quintonm/orgs","repos_url":"https://api.github.com/users/quintonm/repos","events_url":"https://api.github.com/users/quintonm/events{/privacy}","received_events_url":"https://api.github.com/users/quintonm/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/p6spy/p6spy/labels/Enhancement","name":"Enhancement","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-05-04T17:20:05Z","updated_at":"2016-05-11T14:44:33Z","closed_at":null,"body":"For applications extending/wrapping P6Spy, a better integration than simply adding a logger implementation is needed.  For example, if an application wants to aggregate the execution time of a prepared statement execution along with the associated calls to ResultSet.next(), the only option is to parse the log messages emitted through the logger.  Likewise, it is also not currently possible to get the number of returned rows through the logger since that information is not available at that level.\r\n\r\nThe only other integration point currently is to add a new module.  This would provide unlimited functionality (even the ability to modify the JDBC statements).  However, it means that the application would need to provide its own implementation of all of the interceptors.\r\n\r\nI think that a better integration point would be through events.  Applications which are extending/wrapping P6Spy could simply register listeners for the various events that they care about.  The data in the event would contain pretty much everything collected by the interceptors.\r\n\r\nThe current logging and outage modules could be refactored to listen for events as well.  This would remove the code duplication between the modules.\r\n\r\nThis could be a possible solution for the following issues:\r\n#299 \r\n#298 \r\n#295 \r\n"},"comment":{"url":"https://api.github.com/repos/p6spy/p6spy/issues/comments/218481503","html_url":"https://github.com/p6spy/p6spy/issues/319#issuecomment-218481503","issue_url":"https://api.github.com/repos/p6spy/p6spy/issues/319","id":218481503,"user":{"login":"quintonm","id":991413,"avatar_url":"https://avatars.githubusercontent.com/u/991413?v=3","gravatar_id":"","url":"https://api.github.com/users/quintonm","html_url":"https://github.com/quintonm","followers_url":"https://api.github.com/users/quintonm/followers","following_url":"https://api.github.com/users/quintonm/following{/other_user}","gists_url":"https://api.github.com/users/quintonm/gists{/gist_id}","starred_url":"https://api.github.com/users/quintonm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quintonm/subscriptions","organizations_url":"https://api.github.com/users/quintonm/orgs","repos_url":"https://api.github.com/users/quintonm/repos","events_url":"https://api.github.com/users/quintonm/events{/privacy}","received_events_url":"https://api.github.com/users/quintonm/received_events","type":"User","site_admin":false},"created_at":"2016-05-11T14:44:33Z","updated_at":"2016-05-11T14:44:33Z","body":"I really see the event system as being in the core of P6Spy with the modules just responding to events.  This would allow for a single set of interceptors which would reduce some of the code duplication between modules.  "}}