{"action":"created","issue":{"url":"https://api.github.com/repos/pingcap/tidb/issues/7631","repository_url":"https://api.github.com/repos/pingcap/tidb","labels_url":"https://api.github.com/repos/pingcap/tidb/issues/7631/labels{/name}","comments_url":"https://api.github.com/repos/pingcap/tidb/issues/7631/comments","events_url":"https://api.github.com/repos/pingcap/tidb/issues/7631/events","html_url":"https://github.com/pingcap/tidb/pull/7631","id":357546350,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEzNTMzMTU4","number":7631,"title":"metrics: add different labels for restricted SQL and general SQL","user":{"login":"eurekaka","id":6261973,"node_id":"MDQ6VXNlcjYyNjE5NzM=","avatar_url":"https://avatars2.githubusercontent.com/u/6261973?v=4","gravatar_id":"","url":"https://api.github.com/users/eurekaka","html_url":"https://github.com/eurekaka","followers_url":"https://api.github.com/users/eurekaka/followers","following_url":"https://api.github.com/users/eurekaka/following{/other_user}","gists_url":"https://api.github.com/users/eurekaka/gists{/gist_id}","starred_url":"https://api.github.com/users/eurekaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eurekaka/subscriptions","organizations_url":"https://api.github.com/users/eurekaka/orgs","repos_url":"https://api.github.com/users/eurekaka/repos","events_url":"https://api.github.com/users/eurekaka/events{/privacy}","received_events_url":"https://api.github.com/users/eurekaka/received_events","type":"User","site_admin":false},"labels":[{"id":829687649,"node_id":"MDU6TGFiZWw4Mjk2ODc2NDk=","url":"https://api.github.com/repos/pingcap/tidb/labels/component/metrics","name":"component/metrics","color":"e26f88","default":false},{"id":256872088,"node_id":"MDU6TGFiZWwyNTY4NzIwODg=","url":"https://api.github.com/repos/pingcap/tidb/labels/type/enhancement","name":"type/enhancement","color":"84b6eb","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-06T08:21:43Z","updated_at":"2018-09-06T09:40:18Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/pingcap/tidb/pulls/7631","html_url":"https://github.com/pingcap/tidb/pull/7631","diff_url":"https://github.com/pingcap/tidb/pull/7631.diff","patch_url":"https://github.com/pingcap/tidb/pull/7631.patch"},"body":"The newly added label is `sql_type`, it has value: `general` and `restricted`,\r\nusers can use this label to filter metrics they have interest.\r\n\r\nAlso, add keyword `[RESTRICTED]` for restricted SQL printed in slow log for\r\nconvenient identification.\r\n\r\n<!--\r\nThank you for contributing to TiDB! Please read TiDB's [CONTRIBUTING](https://github.com/pingcap/tidb/blob/master/CONTRIBUTING.md) document **BEFORE** filing this PR.\r\n-->\r\n\r\n### What problem does this PR solve? <!--add issue link with summary if exists-->\r\n\r\nImprove usability of TiDB. We output bunch of metrics for monitoring status of TiDB now, such as  time spent on distsql. Sometimes users may notice high distsql time on dashboard, and they may wonder why my simple SQL is spending much time here, but actually, the monitored distsql time may belong to internal SQL queries(called restricted SQL) issued by DDL or auto Analyze for example. To avoid this confusion, we differentiate restricted SQL and general SQL in metrics, users can choose to only reflect metrics of general SQL on dashboard now, or they can monitor restricted SQL status as well.\r\n\r\n\r\n### What is changed and how it works?\r\n\r\nadd label for:\r\n- `DistSQLQueryHistgram`\r\n- `QueryDurationHistogram`\r\n- `SessionExecuteParseDuration`\r\n- `SessionExecuteCompileDuration`\r\n- `SessionExecuteRunDuration`\r\n\r\nAlso, add keyword `[RESTRICTED]` for restricted SQL printed in slow log for convenient identification.\r\n\r\n### Check List <!--REMOVE the items that are not applicable-->\r\n\r\nTests <!-- At least one of them must be included. -->\r\n\r\n - Manual test (add detailed scripts or steps below)\r\n\r\n    deploy a TiDB instance with pushgateway, prometheus and grafana for monitor(see also https://github.com/pingcap/tidb-ansible for instructions), run some workload on TiDB instance, then monitor status in grafana using the newly added label `sql_type` for filtering.\r\n\r\nRelated changes\r\n\r\n - Need to be included in the release note: `add different labels for restricted SQL and general SQL in metrics`\r\n"},"comment":{"url":"https://api.github.com/repos/pingcap/tidb/issues/comments/419031441","html_url":"https://github.com/pingcap/tidb/pull/7631#issuecomment-419031441","issue_url":"https://api.github.com/repos/pingcap/tidb/issues/7631","id":419031441,"node_id":"MDEyOklzc3VlQ29tbWVudDQxOTAzMTQ0MQ==","user":{"login":"winkyao","id":6949944,"node_id":"MDQ6VXNlcjY5NDk5NDQ=","avatar_url":"https://avatars0.githubusercontent.com/u/6949944?v=4","gravatar_id":"","url":"https://api.github.com/users/winkyao","html_url":"https://github.com/winkyao","followers_url":"https://api.github.com/users/winkyao/followers","following_url":"https://api.github.com/users/winkyao/following{/other_user}","gists_url":"https://api.github.com/users/winkyao/gists{/gist_id}","starred_url":"https://api.github.com/users/winkyao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/winkyao/subscriptions","organizations_url":"https://api.github.com/users/winkyao/orgs","repos_url":"https://api.github.com/users/winkyao/repos","events_url":"https://api.github.com/users/winkyao/events{/privacy}","received_events_url":"https://api.github.com/users/winkyao/received_events","type":"User","site_admin":false},"created_at":"2018-09-06T09:40:18Z","updated_at":"2018-09-06T09:40:18Z","author_association":"MEMBER","body":"@shenli @coocood PTAL"}}
{"actor":{"display_login":"winkyao"}}