GitHub PullRequestReviewCommentEvent at 2014-07-10 03:14:48
Repository: percona-agent
Actor: daniel-nichter
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/percona/percona-agent/pulls/comments/14748067","id":14748067,"diff_hunk":"@@ -1292,3 +1293,152 @@ func (s *WorkerTestSuite) TestResult014(t *C) {\n \t// This query required improving the log parser to get the correct checksum ID:\n \tt.Check(report.Class[0].Id, Equals, \"DB9EF18846547B8C\")\n }\n+\n+func (s *ManagerTestSuite) TestPerformanceSchemaStart(t *C) {\n+\tm := qan.NewPfsManager(s.logger, &mysql.RealConnectionFactory{}, s.im)\n+\tt.Assert(m, NotNil)\n+\n+\t// Create the qan config.\n+\tconfig := &qan.Config{\n+\t\tServiceInstance: s.mysqlInstance,\n+\t\tInterval:          300, // 5 min\n+\t\tExampleQueries:    true,\n+\t\tMaxWorkers:        2,\n+\t\tWorkerRunTime:     600, // 10 min\n+\t}\n+\n+\t// Create the StartService cmd which contains the qan config.\n+\tnow := time.Now()\n+\tqanConfig, _ := json.Marshal(config)\n+\tcmd := &proto.Cmd{\n+\t\tUser:      \"Oleg\",\n+\t\tTs:        now,\n+\t\tAgentUuid: \"123\",\n+\t\tService:   \"agent\",\n+\t\tCmd:       \"StartService\",\n+\t\tData:      qanConfig,\n+\t}\n+\n+\t// Have the service manager start the qa service\n+\treply := m.Handle(cmd)\n+\n+\t// It should start without error.\n+\tt.Assert(reply.Error, Equals, \"\")\n+}\n+\n+func (s *ManagerTestSuite) TestPerformanceSchemaStatus(t *C) {\n+\tm := qan.NewPfsManager(s.logger, &mysql.RealConnectionFactory{}, s.im)\n+\tt.Assert(m, NotNil)\n+\n+\t// Create the qan config.\n+\tconfig := &qan.Config{\n+\t\tServiceInstance: s.mysqlInstance,\n+\t\tInterval:          300, // 5 min\n+\t\tExampleQueries:    true,\n+\t\tMaxWorkers:        2,\n+\t\tWorkerRunTime:     600, // 10 min\n+\t}\n+\n+\tmysqlIt := &proto.MySQLInstance{}\n+\terr := m.Im.Get(config.Service, config.InstanceId, mysqlIt)\n+\tt.Assert(err, IsNil)\n+\n+\t// Connect to MySQL and set global vars to config/enable slow log.\n+\tm.MysqlConn = m.MysqlFactory.Make(mysqlIt.DSN)\n+\terr = m.MysqlConn.Connect(2)\n+\tt.Assert(err, IsNil)\n+\tdefer m.MysqlConn.Close()\n+\n+\tvar status string\n+\terr, status = m.StatusPfs()\n+\tt.Assert(err, IsNil)\n+\tt.Assert(status, Equals, \"ON\")\n+}\n+\n+func (s *ManagerTestSuite) TestPerformanceSchemaSetupConsumers(t *C) {\n+\tm := qan.NewPfsManager(s.logger, &mysql.RealConnectionFactory{}, s.im)\n+\tt.Assert(m, NotNil)\n+\n+\t// Create the qan config.\n+\tconfig := &qan.Config{\n+\t\tServiceInstance: s.mysqlInstance,\n+\t\tInterval:          300, // 5 min\n+\t\tExampleQueries:    true,\n+\t\tMaxWorkers:        2,\n+\t\tWorkerRunTime:     600, // 10 min\n+\t}\n+\n+\tmysqlIt := &proto.MySQLInstance{}\n+\terr := m.Im.Get(config.Service, config.InstanceId, mysqlIt)\n+\tt.Assert(err, IsNil)\n+\n+\t// Connect to MySQL and set global vars to config/enable slow log.\n+\tm.MysqlConn = m.MysqlFactory.Make(mysqlIt.DSN)\n+\terr = m.MysqlConn.Connect(2)\n+\tt.Assert(err, IsNil)\n+\tdefer m.MysqlConn.Close()\n+\n+\terr = m.SetupConsumers()\n+\tt.Assert(err, IsNil)\n+}\n+\n+func (s *ManagerTestSuite) TestPerformanceSchemaCollectData(t *C) {\n+\tm := qan.NewPfsManager(s.logger, &mysql.RealConnectionFactory{}, s.im)\n+\tt.Assert(m, NotNil)\n+\n+\t// Create the qan config.\n+\tconfig := &qan.Config{\n+\t\tServiceInstance: s.mysqlInstance,\n+\t\tInterval:          300, // 5 min\n+\t\tExampleQueries:    true,\n+\t\tMaxWorkers:        2,\n+\t\tWorkerRunTime:     600, // 10 min\n+\t}\n+\n+\tmysqlIt := &proto.MySQLInstance{}\n+\terr := m.Im.Get(config.Service, config.InstanceId, mysqlIt)\n+\tt.Assert(err, IsNil)\n+\n+\t// Connect to MySQL\n+\tm.MysqlConn = m.MysqlFactory.Make(mysqlIt.DSN)\n+\terr = m.MysqlConn.Connect(2)\n+\tt.Assert(err, IsNil)\n+\tdefer m.MysqlConn.Close()\n+\n+\tvar db = m.MysqlConn.DB()\n+\t_, err = db.Exec(\"USE `performance_schema`\")\n+\t_, err = db.Exec(\"TRUNCATE `events_statements_summary_by_digest`\")\n+\t_, err = db.Exec(\"SELECT NOW()\");\n+\t_, err = db.Exec(\"SELECT 1\")\n+\t_, err = db.Exec(\"SELECT * FROM `events_statements_summary_by_digest`\")\n+\n+\ttype pfsPart struct {\n+\t\tId           string\n+\t\tTotalQueries uint64\n+\t\tRowsSentSum  uint64\n+\t}\n+\n+\t/**\n+\t * as we don't have consistent order in maps from Go v1.3,\n+\t * let's use pre-defined map with queries\n+\t */\n+\texpectedResult := make(map[string]*pfsPart)\n+\texpectedResult[\"use `performance_schema`\"]                            = &pfsPart{TotalQueries: 1, Id: \"253E68FC88D3E520\", RowsSentSum: 0}\n+\texpectedResult[\"select now ( )\"]                                      = &pfsPart{TotalQueries: 1, Id: \"4A6916D0C86873CC\", RowsSentSum: 1}\n+\texpectedResult[\"select ?\"]                                            = &pfsPart{TotalQueries: 1, Id: \"16219655761820A2\", RowsSentSum: 1}\n+\texpectedResult[\"select * from `events_statements_summary_by_digest`\"] = &pfsPart{TotalQueries: 1, Id: \"9D250E8D34D1BFB2\", RowsSentSum: 3}\n+\texpectedResult[\"truncate `events_statements_summary_by_digest`\"]      = &pfsPart{TotalQueries: 1, Id: \"1924FF7D88731F64\", RowsSentSum: 0}\n+\n+\tgotResult, err := m.CollectData()\n+\t// test.Dump(gotResult)\n+\tt.Assert(err, IsNil)\n+\tt.Assert(gotResult, NotNil)\n+\tt.Check(gotResult.Global.TotalQueries, Equals, uint64(5))\n+\n+\tfor i := range gotResult.Classes {\n+\t\tt.Assert(expectedResult[gotResult.Classes[i].Fingerprint], NotNil)\n+\t\tt.Check(gotResult.Classes[i].TotalQueries, Equals, expectedResult[gotResult.Classes[i].Fingerprint].TotalQueries)\n+\t\tt.Check(gotResult.Classes[i].Id, Equals, expectedResult[gotResult.Classes[i].Fingerprint].Id)\n+\t\tt.Check(gotResult.Classes[i].Metrics.NumberMetrics[\"Rows_sent\"].Sum, Equals, expectedResult[gotResult.Classes[i].Fingerprint].RowsSentSum)","path":"qan/qan_test.go","position":158,"original_position":158,"commit_id":"f08c4edbb4ce87aa59964c48aaa2b3a776a9cf76","original_commit_id":"f08c4edbb4ce87aa59964c48aaa2b3a776a9cf76","user":{"login":"daniel-nichter","id":1683183,"avatar_url":"https://avatars.githubusercontent.com/u/1683183?","gravatar_id":"e357017698772e57169dbcf4db7ae6f6","url":"https://api.github.com/users/daniel-nichter","html_url":"https://github.com/daniel-nichter","followers_url":"https://api.github.com/users/daniel-nichter/followers","following_url":"https://api.github.com/users/daniel-nichter/following{/other_user}","gists_url":"https://api.github.com/users/daniel-nichter/gists{/gist_id}","starred_url":"https://api.github.com/users/daniel-nichter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daniel-nichter/subscriptions","organizations_url":"https://api.github.com/users/daniel-nichter/orgs","repos_url":"https://api.github.com/users/daniel-nichter/repos","events_url":"https://api.github.com/users/daniel-nichter/events{/privacy}","received_events_url":"https://api.github.com/users/daniel-nichter/received_events","type":"User","site_admin":false},"body":"This is a start, but we need to test everything (at least once).  The agent cannot be wrong, for people make business decisions based on the numbers it reports.","created_at":"2014-07-10T03:14:48Z","updated_at":"2014-07-10T03:14:48Z","html_url":"https://github.com/percona/percona-agent/pull/61#discussion_r14748067","pull_request_url":"https://api.github.com/repos/percona/percona-agent/pulls/61","_links":{"self":{"href":"https://api.github.com/repos/percona/percona-agent/pulls/comments/14748067"},"html":{"href":"https://github.com/percona/percona-agent/pull/61#discussion_r14748067"},"pull_request":{"href":"https://api.github.com/repos/percona/percona-agent/pulls/61"}}},"pull_request":{"url":"https://api.github.com/repos/percona/percona-agent/pulls/61","id":17016680,"html_url":"https://github.com/percona/percona-agent/pull/61","diff_url":"https://github.com/percona/percona-agent/pull/61.diff","patch_url":"https://github.com/percona/percona-agent/pull/61.patch","issue_url":"https://api.github.com/repos/percona/percona-agent/issues/61","number":61,"state":"open","title":"PCT-686: pfs status checking","user":{"login":"helginet","id":3428972,"avatar_url":"https://avatars.githubusercontent.com/u/3428972?","gravatar_id":"979d29f20a40c6524e4037fa8dd8bd2b","url":"https://api.github.com/users/helginet","html_url":"https://github.com/helginet","followers_url":"https://api.github.com/users/helginet/followers","following_url":"https://api.github.com/users/helginet/following{/other_user}","gists_url":"https://api.github.com/users/helginet/gists{/gist_id}","starred_url":"https://api.github.com/users/helginet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helginet/subscriptions","organizations_url":"https://api.github.com/users/helginet/orgs","repos_url":"https://api.github.com/users/helginet/repos","events_url":"https://api.github.com/users/helginet/events{/privacy}","received_events_url":"https://api.github.com/users/helginet/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-06-11T19:02:42Z","updated_at":"2014-07-10T03:14:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b14002320bf8ad308a558fba77bd9170553ad365","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/percona/percona-agent/pulls/61/commits","review_comments_url":"https://api.github.com/repos/percona/percona-agent/pulls/61/comments","review_comment_url":"https://api.github.com/repos/percona/percona-agent/pulls/comments/{number}","comments_url":"https://api.github.com/repos/percona/percona-agent/issues/61/comments","statuses_url":"https://api.github.com/repos/percona/percona-agent/statuses/f08c4edbb4ce87aa59964c48aaa2b3a776a9cf76","head":{"label":"percona:PCT-686--psf","ref":"PCT-686--psf","sha":"f08c4edbb4ce87aa59964c48aaa2b3a776a9cf76","user":{"login":"percona","id":1683025,"avatar_url":"https://avatars.githubusercontent.com/u/1683025?","gravatar_id":"5f02b19a52725a3dc324baf483b584d7","url":"https://api.github.com/users/percona","html_url":"https://github.com/percona","followers_url":"https://api.github.com/users/percona/followers","following_url":"https://api.github.com/users/percona/following{/other_user}","gists_url":"https://api.github.com/users/percona/gists{/gist_id}","starred_url":"https://api.github.com/users/percona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/percona/subscriptions","organizations_url":"https://api.github.com/users/percona/orgs","repos_url":"https://api.github.com/users/percona/repos","events_url":"https://api.github.com/users/percona/events{/privacy}","received_events_url":"https://api.github.com/users/percona/received_events","type":"Organization","site_admin":false},"repo":{"id":11132795,"name":"percona-agent","full_name":"percona/percona-agent","owner":{"login":"percona","id":1683025,"avatar_url":"https://avatars.githubusercontent.com/u/1683025?","gravatar_id":"5f02b19a52725a3dc324baf483b584d7","url":"https://api.github.com/users/percona","html_url":"https://github.com/percona","followers_url":"https://api.github.com/users/percona/followers","following_url":"https://api.github.com/users/percona/following{/other_user}","gists_url":"https://api.github.com/users/percona/gists{/gist_id}","starred_url":"https://api.github.com/users/percona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/percona/subscriptions","organizations_url":"https://api.github.com/users/percona/orgs","repos_url":"https://api.github.com/users/percona/repos","events_url":"https://api.github.com/users/percona/events{/privacy}","received_events_url":"https://api.github.com/users/percona/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/percona/percona-agent","description":"Percona Cloud Tools Agent","fork":false,"url":"https://api.github.com/repos/percona/percona-agent","forks_url":"https://api.github.com/repos/percona/percona-agent/forks","keys_url":"https://api.github.com/repos/percona/percona-agent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/percona/percona-agent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/percona/percona-agent/teams","hooks_url":"https://api.github.com/repos/percona/percona-agent/hooks","issue_events_url":"https://api.github.com/repos/percona/percona-agent/issues/events{/number}","events_url":"https://api.github.com/repos/percona/percona-agent/events","assignees_url":"https://api.github.com/repos/percona/percona-agent/assignees{/user}","branches_url":"https://api.github.com/repos/percona/percona-agent/branches{/branch}","tags_url":"https://api.github.com/repos/percona/percona-agent/tags","blobs_url":"https://api.github.com/repos/percona/percona-agent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/percona/percona-agent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/percona/percona-agent/git/refs{/sha}","trees_url":"https://api.github.com/repos/percona/percona-agent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/percona/percona-agent/statuses/{sha}","languages_url":"https://api.github.com/repos/percona/percona-agent/languages","stargazers_url":"https://api.github.com/repos/percona/percona-agent/stargazers","contributors_url":"https://api.github.com/repos/percona/percona-agent/contributors","subscribers_url":"https://api.github.com/repos/percona/percona-agent/subscribers","subscription_url":"https://api.github.com/repos/percona/percona-agent/subscription","commits_url":"https://api.github.com/repos/percona/percona-agent/commits{/sha}","git_commits_url":"https://api.github.com/repos/percona/percona-agent/git/commits{/sha}","comments_url":"https://api.github.com/repos/percona/percona-agent/comments{/number}","issue_comment_url":"https://api.github.com/repos/percona/percona-agent/issues/comments/{number}","contents_url":"https://api.github.com/repos/percona/percona-agent/contents/{+path}","compare_url":"https://api.github.com/repos/percona/percona-agent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/percona/percona-agent/merges","archive_url":"https://api.github.com/repos/percona/percona-agent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/percona/percona-agent/downloads","issues_url":"https://api.github.com/repos/percona/percona-agent/issues{/number}","pulls_url":"https://api.github.com/repos/percona/percona-agent/pulls{/number}","milestones_url":"https://api.github.com/repos/percona/percona-agent/milestones{/number}","notifications_url":"https://api.github.com/repos/percona/percona-agent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/percona/percona-agent/labels{/name}","releases_url":"https://api.github.com/repos/percona/percona-agent/releases{/id}","created_at":"2013-07-02T19:09:37Z","updated_at":"2014-06-27T05:53:05Z","pushed_at":"2014-07-09T23:38:04Z","git_url":"git://github.com/percona/percona-agent.git","ssh_url":"git@github.com:percona/percona-agent.git","clone_url":"https://github.com/percona/percona-agent.git","svn_url":"https://github.com/percona/percona-agent","homepage":"","size":10564,"stargazers_count":21,"watchers_count":21,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"forks_count":6,"mirror_url":null,"open_issues_count":3,"forks":6,"open_issues":3,"watchers":21,"default_branch":"release"}},"base":{"label":"percona:release","ref":"release","sha":"85639fe6d0304a02a4cd1cd27079c5e50b361b76","user":{"login":"percona","id":1683025,"avatar_url":"https://avatars.githubusercontent.com/u/1683025?","gravatar_id":"5f02b19a52725a3dc324baf483b584d7","url":"https://api.github.com/users/percona","html_url":"https://github.com/percona","followers_url":"https://api.github.com/users/percona/followers","following_url":"https://api.github.com/users/percona/following{/other_user}","gists_url":"https://api.github.com/users/percona/gists{/gist_id}","starred_url":"https://api.github.com/users/percona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/percona/subscriptions","organizations_url":"https://api.github.com/users/percona/orgs","repos_url":"https://api.github.com/users/percona/repos","events_url":"https://api.github.com/users/percona/events{/privacy}","received_events_url":"https://api.github.com/users/percona/received_events","type":"Organization","site_admin":false},"repo":{"id":11132795,"name":"percona-agent","full_name":"percona/percona-agent","owner":{"login":"percona","id":1683025,"avatar_url":"https://avatars.githubusercontent.com/u/1683025?","gravatar_id":"5f02b19a52725a3dc324baf483b584d7","url":"https://api.github.com/users/percona","html_url":"https://github.com/percona","followers_url":"https://api.github.com/users/percona/followers","following_url":"https://api.github.com/users/percona/following{/other_user}","gists_url":"https://api.github.com/users/percona/gists{/gist_id}","starred_url":"https://api.github.com/users/percona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/percona/subscriptions","organizations_url":"https://api.github.com/users/percona/orgs","repos_url":"https://api.github.com/users/percona/repos","events_url":"https://api.github.com/users/percona/events{/privacy}","received_events_url":"https://api.github.com/users/percona/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/percona/percona-agent","description":"Percona Cloud Tools Agent","fork":false,"url":"https://api.github.com/repos/percona/percona-agent","forks_url":"https://api.github.com/repos/percona/percona-agent/forks","keys_url":"https://api.github.com/repos/percona/percona-agent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/percona/percona-agent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/percona/percona-agent/teams","hooks_url":"https://api.github.com/repos/percona/percona-agent/hooks","issue_events_url":"https://api.github.com/repos/percona/percona-agent/issues/events{/number}","events_url":"https://api.github.com/repos/percona/percona-agent/events","assignees_url":"https://api.github.com/repos/percona/percona-agent/assignees{/user}","branches_url":"https://api.github.com/repos/percona/percona-agent/branches{/branch}","tags_url":"https://api.github.com/repos/percona/percona-agent/tags","blobs_url":"https://api.github.com/repos/percona/percona-agent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/percona/percona-agent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/percona/percona-agent/git/refs{/sha}","trees_url":"https://api.github.com/repos/percona/percona-agent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/percona/percona-agent/statuses/{sha}","languages_url":"https://api.github.com/repos/percona/percona-agent/languages","stargazers_url":"https://api.github.com/repos/percona/percona-agent/stargazers","contributors_url":"https://api.github.com/repos/percona/percona-agent/contributors","subscribers_url":"https://api.github.com/repos/percona/percona-agent/subscribers","subscription_url":"https://api.github.com/repos/percona/percona-agent/subscription","commits_url":"https://api.github.com/repos/percona/percona-agent/commits{/sha}","git_commits_url":"https://api.github.com/repos/percona/percona-agent/git/commits{/sha}","comments_url":"https://api.github.com/repos/percona/percona-agent/comments{/number}","issue_comment_url":"https://api.github.com/repos/percona/percona-agent/issues/comments/{number}","contents_url":"https://api.github.com/repos/percona/percona-agent/contents/{+path}","compare_url":"https://api.github.com/repos/percona/percona-agent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/percona/percona-agent/merges","archive_url":"https://api.github.com/repos/percona/percona-agent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/percona/percona-agent/downloads","issues_url":"https://api.github.com/repos/percona/percona-agent/issues{/number}","pulls_url":"https://api.github.com/repos/percona/percona-agent/pulls{/number}","milestones_url":"https://api.github.com/repos/percona/percona-agent/milestones{/number}","notifications_url":"https://api.github.com/repos/percona/percona-agent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/percona/percona-agent/labels{/name}","releases_url":"https://api.github.com/repos/percona/percona-agent/releases{/id}","created_at":"2013-07-02T19:09:37Z","updated_at":"2014-06-27T05:53:05Z","pushed_at":"2014-07-09T23:38:04Z","git_url":"git://github.com/percona/percona-agent.git","ssh_url":"git@github.com:percona/percona-agent.git","clone_url":"https://github.com/percona/percona-agent.git","svn_url":"https://github.com/percona/percona-agent","homepage":"","size":10564,"stargazers_count":21,"watchers_count":21,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"forks_count":6,"mirror_url":null,"open_issues_count":3,"forks":6,"open_issues":3,"watchers":21,"default_branch":"release"}},"_links":{"self":{"href":"https://api.github.com/repos/percona/percona-agent/pulls/61"},"html":{"href":"https://github.com/percona/percona-agent/pull/61"},"issue":{"href":"https://api.github.com/repos/percona/percona-agent/issues/61"},"comments":{"href":"https://api.github.com/repos/percona/percona-agent/issues/61/comments"},"review_comments":{"href":"https://api.github.com/repos/percona/percona-agent/pulls/61/comments"},"review_comment":{"href":"https://api.github.com/repos/percona/percona-agent/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/percona/percona-agent/pulls/61/commits"},"statuses":{"href":"https://api.github.com/repos/percona/percona-agent/statuses/f08c4edbb4ce87aa59964c48aaa2b3a776a9cf76"}}}}