{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/apm/issues/108","repository_url":"https://api.github.com/repos/elastic/apm","labels_url":"https://api.github.com/repos/elastic/apm/issues/108/labels{/name}","comments_url":"https://api.github.com/repos/elastic/apm/issues/108/comments","events_url":"https://api.github.com/repos/elastic/apm/issues/108/events","html_url":"https://github.com/elastic/apm/issues/108","id":464169923,"node_id":"MDU6SXNzdWU0NjQxNjk5MjM=","number":108,"title":"[Agents] Oracle SQL parsing improvements","user":{"login":"axw","id":843579,"node_id":"MDQ6VXNlcjg0MzU3OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/843579?v=4","gravatar_id":"","url":"https://api.github.com/users/axw","html_url":"https://github.com/axw","followers_url":"https://api.github.com/users/axw/followers","following_url":"https://api.github.com/users/axw/following{/other_user}","gists_url":"https://api.github.com/users/axw/gists{/gist_id}","starred_url":"https://api.github.com/users/axw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/axw/subscriptions","organizations_url":"https://api.github.com/users/axw/orgs","repos_url":"https://api.github.com/users/axw/repos","events_url":"https://api.github.com/users/axw/events{/privacy}","received_events_url":"https://api.github.com/users/axw/received_events","type":"User","site_admin":false},"labels":[{"id":1140130627,"node_id":"MDU6TGFiZWwxMTQwMTMwNjI3","url":"https://api.github.com/repos/elastic/apm/labels/agents","name":"agents","color":"006b75","default":false},{"id":1140130692,"node_id":"MDU6TGFiZWwxMTQwMTMwNjky","url":"https://api.github.com/repos/elastic/apm/labels/poll","name":"poll","color":"b9d35b","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2019-07-04T09:42:06Z","updated_at":"2019-07-05T09:00:36Z","closed_at":null,"author_association":"MEMBER","body":"## Description of the issue\r\n\r\nIn https://github.com/elastic/apm-agent-java/pull/696 there are several further improvements made to SQL parsing which are relevant to all agents, relating to parsing Oracle SQL:\r\n\r\n - support for [MERGE](https://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_9016.htm#SQLRF01606) statements\r\n - support for extracting [Database Links](https://docs.oracle.com/cd/B28359_01/server.111/b28310/ds_concepts002.htm#ADMIN12083) from table/object identifiers\r\n\r\n## Proposed solution\r\n\r\n### MERGE statements\r\n\r\nFor a statement like `MERGE INTO <target> USING <source> ...`, we would set the span name to `MERGE INTO <target>`.\r\n\r\n### Database links\r\n\r\nAnywhere we extract a table name (e.g. in SELECT, UPDATE, INSERT, etc.), we should also look for a database link in the form of two consecutive tokens: a `@` character, followed by an identifier (possibly double-quoted). If we find this sequence immediately following a table name, we'll assume it is a database link.\r\n\r\nThe database link should not be recorded in span names, but instead recorded as a separate field per the proposal in https://github.com/elastic/apm/issues/107. This would permit aggregation of all like queries regardless of destination database, in addition to a breakdown by destination database. Until that proposal is accepted, we will not record the link anywhere.\r\n\r\n## Acceptance criteria\r\n\r\n<details>\r\n<summary>\r\nAdditional JSON test cases, from https://github.com/elastic/apm-agent-java/pull/696\r\n</summary>\r\n<pre>\r\n  {\r\n    \"input\": \"MERGE INTO TEST USING (SELECT * FROM DUAL) SOURCE on (TEST.X=SOURCE.DUMMY) WHEN NOT MATCHED THEN INSERT VALUES(SOURCE.DUMMY)\",\r\n    \"output\": \"MERGE INTO TEST\"\r\n  },\r\n  {\r\n    \"input\": \"MERGE INTO TEST ALIAS USING (SELECT * FROM DUAL) SOURCE on (TEST.X=SOURCE.DUMMY) WHEN NOT MATCHED THEN INSERT VALUES(SOURCE.DUMMY)\",\r\n    \"output\": \"MERGE INTO TEST\"\r\n  },\r\n  {\r\n    \"input\": \"MERGE INTO SCHEMA.TEST USING (SELECT * FROM DUAL) SOURCE on (TEST.X=SOURCE.DUMMY) WHEN NOT MATCHED THEN INSERT VALUES(SOURCE.DUMMY)\",\r\n    \"output\": \"MERGE INTO SCHEMA.TEST\"\r\n  },\r\n  {\r\n    \"input\": \"MERGE INTO SCHEMA.TEST@DBLINK USING (SELECT * FROM DUAL) SOURCE on (TEST.X=SOURCE.DUMMY) WHEN NOT MATCHED THEN INSERT VALUES(SOURCE.DUMMY)\",\r\n    \"output\": \"MERGE INTO SCHEMA.TEST\"\r\n  },\r\n  {\r\n    \"input\": \"MERGE INTO SCHEMA.TEST@\\\"DBLINK.FQDN.COM\\\" USING (SELECT * FROM DUAL) SOURCE on (TEST.X=SOURCE.DUMMY) WHEN NOT MATCHED THEN INSERT VALUES(SOURCE.DUMMY)\",\r\n    \"output\": \"MERGE INTO SCHEMA.TEST\"\r\n  },\r\n  {\r\n    \"input\": \"MERGE INTO SCHEMA.TEST@\\\"DBLINK.FQDN.COM@USER\\\" USING (SELECT * FROM DUAL) SOURCE on (TEST.X=SOURCE.DUMMY) WHEN NOT MATCHED THEN INSERT VALUES(SOURCE.DUMMY)\",\r\n    \"output\": \"MERGE INTO SCHEMA.TEST\"\r\n  },\r\n  {\r\n    \"input\": \"MERGE\",\r\n    \"output\": \"MERGE\"\r\n  },\r\n</pre>\r\n</details>\r\n\r\n## What we are voting on\r\n\r\n@elastic/apm-agent-devs Tick the N/A box if your agent isn't affected (e.g. there is no Oracle database driver). Otherwise, please create and link to an issue or PR and tick \"Yes\". If you have concerns about the proposed solution, let's discuss.\r\n\r\n## Vote\r\n\r\n| Agent   | Yes  | No  | Indifferent | N/A  | Link to agent issue\r\n| --------|:----:|:---:|:-----------:|:----:|:-------------------:|\r\n| .NET    |<ul><li> [x] </li></ul>|<ul><li> [ ] </li></ul>|<ul><li> [ ] </li></ul>|<ul><li> [ ] </li></ul>| https://github.com/elastic/apm-agent-dotnet/issues/357\r\n| Go      |<ul><li> [ ] </li></ul>|<ul><li> [ ] </li></ul>|<ul><li> [ ] </li></ul>|<ul><li> [ ] </li></ul>|\r\n| Java    |<ul><li> [x] </li></ul>|<ul><li> [ ] </li></ul>|<ul><li> [ ] </li></ul>|<ul><li> [ ] </li></ul>| https://github.com/elastic/apm-agent-java/pull/696\r\n| Node.js |<ul><li> [ ] </li></ul>|<ul><li> [ ] </li></ul>|<ul><li> [x] </li></ul>|<ul><li> [ ] </li></ul>|\r\n| Python  |<ul><li> [ ] </li></ul>|<ul><li> [ ] </li></ul>|<ul><li> [ ] </li></ul>|<ul><li> [ ] </li></ul>|\r\n| Ruby    |<ul><li> [ ] </li></ul>|<ul><li> [ ] </li></ul>|<ul><li> [x] </li></ul>|<ul><li> [ ] </li></ul>|\r\n"},"comment":{"url":"https://api.github.com/repos/elastic/apm/issues/comments/508687466","html_url":"https://github.com/elastic/apm/issues/108#issuecomment-508687466","issue_url":"https://api.github.com/repos/elastic/apm/issues/108","id":508687466,"node_id":"MDEyOklzc3VlQ29tbWVudDUwODY4NzQ2Ng==","user":{"login":"watson","id":10602,"node_id":"MDQ6VXNlcjEwNjAy","avatar_url":"https://avatars3.githubusercontent.com/u/10602?v=4","gravatar_id":"","url":"https://api.github.com/users/watson","html_url":"https://github.com/watson","followers_url":"https://api.github.com/users/watson/followers","following_url":"https://api.github.com/users/watson/following{/other_user}","gists_url":"https://api.github.com/users/watson/gists{/gist_id}","starred_url":"https://api.github.com/users/watson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/watson/subscriptions","organizations_url":"https://api.github.com/users/watson/orgs","repos_url":"https://api.github.com/users/watson/repos","events_url":"https://api.github.com/users/watson/events{/privacy}","received_events_url":"https://api.github.com/users/watson/received_events","type":"User","site_admin":false},"created_at":"2019-07-05T09:00:36Z","updated_at":"2019-07-05T09:00:36Z","author_association":"MEMBER","body":"I meant to tick N/A, as we don't support Oracle in the Node.js agent. Was just off by one. I'll update the checkbox"}}
{"actor":{"display_login":"watson"}}