{"action":"created","comment":{"url":"https://api.github.com/repos/ecadlabs/tezos_exporter/pulls/comments/236539976","pull_request_review_id":178633051,"id":236539976,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNjUzOTk3Ng==","diff_hunk":"@@ -100,9 +95,72 @@ func (c *NetworkCollector) Collect(ch chan<- prometheus.Metric) {\n \t\tconnStats[direction][private]++\n \t}\n \n-\tfor direction, stats := range connStats {\n-\t\tfor private, count := range stats {\n-\t\t\tch <- prometheus.MustNewConstMetric(connsDesc, prometheus.GaugeValue, float64(count), direction, private)\n+\treturn connStats, nil\n+}\n+\n+func (c *NetworkCollector) getBootstrapped(ctx context.Context) (bool, error) {\n+\tctx, cancel := context.WithTimeout(ctx, bootstrappedTimeout)\n+\tdefer cancel()\n+\n+\tch := make(chan *tezos.BootstrappedBlock, 10)\n+\tvar err error\n+\n+\tgo func() {\n+\t\terr = c.service.GetBootstrapped(ctx, ch)\n+\t\tclose(ch)\n+\t}()\n+\n+\tvar cnt int\n+\tfor range ch {\n+\t\tif cnt > 0 {\n+\t\t\t// More than one record returned\n+\t\t\treturn false, nil\n+\t\t}\n+\t\tcnt++\n+\t}\n+\n+\tif err != nil {\n+\t\tif e, ok := err.(net.Error); ok && e.Timeout() {\n+\t\t\treturn false, nil\n+\t\t}\n+\t\treturn false, err\n+\t}\n+\n+\treturn true, nil\n+}\n+\n+// Collect implements prometheus.Collector and is called by the Prometheus registry when collecting metrics.\n+func (c *NetworkCollector) Collect(ch chan<- prometheus.Metric) {\n+\tctx, cancel := context.WithTimeout(context.Background(), c.timeout)\n+\tdefer cancel()\n+\n+\tif stats, err := c.service.GetNetworkStats(ctx); err != nil {\n+\t\tc.errors.WithLabelValues(\"network_stat\").Add(1)","path":"collector/network.go","position":127,"original_position":127,"commit_id":"3b46a38f22d77c29226dba8cbf439949aa456f8e","original_commit_id":"3b46a38f22d77c29226dba8cbf439949aa456f8e","user":{"login":"juliusv","id":538008,"node_id":"MDQ6VXNlcjUzODAwOA==","avatar_url":"https://avatars2.githubusercontent.com/u/538008?v=4","gravatar_id":"","url":"https://api.github.com/users/juliusv","html_url":"https://github.com/juliusv","followers_url":"https://api.github.com/users/juliusv/followers","following_url":"https://api.github.com/users/juliusv/following{/other_user}","gists_url":"https://api.github.com/users/juliusv/gists{/gist_id}","starred_url":"https://api.github.com/users/juliusv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juliusv/subscriptions","organizations_url":"https://api.github.com/users/juliusv/orgs","repos_url":"https://api.github.com/users/juliusv/repos","events_url":"https://api.github.com/users/juliusv/events{/privacy}","received_events_url":"https://api.github.com/users/juliusv/received_events","type":"User","site_admin":false},"body":"(same for the occurrences below)","created_at":"2018-11-27T07:04:27Z","updated_at":"2018-11-27T07:04:27Z","html_url":"https://github.com/ecadlabs/tezos_exporter/pull/9#discussion_r236539976","pull_request_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/pulls/9","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/ecadlabs/tezos_exporter/pulls/comments/236539976"},"html":{"href":"https://github.com/ecadlabs/tezos_exporter/pull/9#discussion_r236539976"},"pull_request":{"href":"https://api.github.com/repos/ecadlabs/tezos_exporter/pulls/9"}},"in_reply_to_id":236539720},"pull_request":{"url":"https://api.github.com/repos/ecadlabs/tezos_exporter/pulls/9","id":233294307,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMzMjk0MzA3","html_url":"https://github.com/ecadlabs/tezos_exporter/pull/9","diff_url":"https://github.com/ecadlabs/tezos_exporter/pull/9.diff","patch_url":"https://github.com/ecadlabs/tezos_exporter/pull/9.patch","issue_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/issues/9","number":9,"state":"open","locked":false,"title":"bootstrapped metric #6","user":{"login":"jevonearth","id":1114943,"node_id":"MDQ6VXNlcjExMTQ5NDM=","avatar_url":"https://avatars1.githubusercontent.com/u/1114943?v=4","gravatar_id":"","url":"https://api.github.com/users/jevonearth","html_url":"https://github.com/jevonearth","followers_url":"https://api.github.com/users/jevonearth/followers","following_url":"https://api.github.com/users/jevonearth/following{/other_user}","gists_url":"https://api.github.com/users/jevonearth/gists{/gist_id}","starred_url":"https://api.github.com/users/jevonearth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jevonearth/subscriptions","organizations_url":"https://api.github.com/users/jevonearth/orgs","repos_url":"https://api.github.com/users/jevonearth/repos","events_url":"https://api.github.com/users/jevonearth/events{/privacy}","received_events_url":"https://api.github.com/users/jevonearth/received_events","type":"User","site_admin":false},"body":"Opening on behalf of @e-asphyx  for @juliusv to review.","created_at":"2018-11-24T01:21:13Z","updated_at":"2018-11-27T07:04:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dd9f9c6a91434f98b96792c0ee9976aea8a19e0b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/pulls/9/commits","review_comments_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/pulls/9/comments","review_comment_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/issues/9/comments","statuses_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/statuses/3b46a38f22d77c29226dba8cbf439949aa456f8e","head":{"label":"ecadlabs:node-bootstrapped-flag","ref":"node-bootstrapped-flag","sha":"3b46a38f22d77c29226dba8cbf439949aa456f8e","user":{"login":"ecadlabs","id":26172016,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2MTcyMDE2","avatar_url":"https://avatars3.githubusercontent.com/u/26172016?v=4","gravatar_id":"","url":"https://api.github.com/users/ecadlabs","html_url":"https://github.com/ecadlabs","followers_url":"https://api.github.com/users/ecadlabs/followers","following_url":"https://api.github.com/users/ecadlabs/following{/other_user}","gists_url":"https://api.github.com/users/ecadlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/ecadlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ecadlabs/subscriptions","organizations_url":"https://api.github.com/users/ecadlabs/orgs","repos_url":"https://api.github.com/users/ecadlabs/repos","events_url":"https://api.github.com/users/ecadlabs/events{/privacy}","received_events_url":"https://api.github.com/users/ecadlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":151715745,"node_id":"MDEwOlJlcG9zaXRvcnkxNTE3MTU3NDU=","name":"tezos_exporter","full_name":"ecadlabs/tezos_exporter","private":false,"owner":{"login":"ecadlabs","id":26172016,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2MTcyMDE2","avatar_url":"https://avatars3.githubusercontent.com/u/26172016?v=4","gravatar_id":"","url":"https://api.github.com/users/ecadlabs","html_url":"https://github.com/ecadlabs","followers_url":"https://api.github.com/users/ecadlabs/followers","following_url":"https://api.github.com/users/ecadlabs/following{/other_user}","gists_url":"https://api.github.com/users/ecadlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/ecadlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ecadlabs/subscriptions","organizations_url":"https://api.github.com/users/ecadlabs/orgs","repos_url":"https://api.github.com/users/ecadlabs/repos","events_url":"https://api.github.com/users/ecadlabs/events{/privacy}","received_events_url":"https://api.github.com/users/ecadlabs/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ecadlabs/tezos_exporter","description":null,"fork":false,"url":"https://api.github.com/repos/ecadlabs/tezos_exporter","forks_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/forks","keys_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/teams","hooks_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/hooks","issue_events_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/issues/events{/number}","events_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/events","assignees_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/assignees{/user}","branches_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/branches{/branch}","tags_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/tags","blobs_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/git/refs{/sha}","trees_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/statuses/{sha}","languages_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/languages","stargazers_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/stargazers","contributors_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/contributors","subscribers_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/subscribers","subscription_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/subscription","commits_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/commits{/sha}","git_commits_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/git/commits{/sha}","comments_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/comments{/number}","issue_comment_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/issues/comments{/number}","contents_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/contents/{+path}","compare_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/merges","archive_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/downloads","issues_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/issues{/number}","pulls_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/pulls{/number}","milestones_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/milestones{/number}","notifications_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/labels{/name}","releases_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/releases{/id}","deployments_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/deployments","created_at":"2018-10-05T12:13:42Z","updated_at":"2018-11-18T20:22:00Z","pushed_at":"2018-11-24T01:34:53Z","git_url":"git://github.com/ecadlabs/tezos_exporter.git","ssh_url":"git@github.com:ecadlabs/tezos_exporter.git","clone_url":"https://github.com/ecadlabs/tezos_exporter.git","svn_url":"https://github.com/ecadlabs/tezos_exporter","homepage":null,"size":287,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":9,"watchers":1,"default_branch":"master"}},"base":{"label":"ecadlabs:master","ref":"master","sha":"d798a175475d3a8d0beb3a9c6a3ea97d76f9fbc3","user":{"login":"ecadlabs","id":26172016,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2MTcyMDE2","avatar_url":"https://avatars3.githubusercontent.com/u/26172016?v=4","gravatar_id":"","url":"https://api.github.com/users/ecadlabs","html_url":"https://github.com/ecadlabs","followers_url":"https://api.github.com/users/ecadlabs/followers","following_url":"https://api.github.com/users/ecadlabs/following{/other_user}","gists_url":"https://api.github.com/users/ecadlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/ecadlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ecadlabs/subscriptions","organizations_url":"https://api.github.com/users/ecadlabs/orgs","repos_url":"https://api.github.com/users/ecadlabs/repos","events_url":"https://api.github.com/users/ecadlabs/events{/privacy}","received_events_url":"https://api.github.com/users/ecadlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":151715745,"node_id":"MDEwOlJlcG9zaXRvcnkxNTE3MTU3NDU=","name":"tezos_exporter","full_name":"ecadlabs/tezos_exporter","private":false,"owner":{"login":"ecadlabs","id":26172016,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2MTcyMDE2","avatar_url":"https://avatars3.githubusercontent.com/u/26172016?v=4","gravatar_id":"","url":"https://api.github.com/users/ecadlabs","html_url":"https://github.com/ecadlabs","followers_url":"https://api.github.com/users/ecadlabs/followers","following_url":"https://api.github.com/users/ecadlabs/following{/other_user}","gists_url":"https://api.github.com/users/ecadlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/ecadlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ecadlabs/subscriptions","organizations_url":"https://api.github.com/users/ecadlabs/orgs","repos_url":"https://api.github.com/users/ecadlabs/repos","events_url":"https://api.github.com/users/ecadlabs/events{/privacy}","received_events_url":"https://api.github.com/users/ecadlabs/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ecadlabs/tezos_exporter","description":null,"fork":false,"url":"https://api.github.com/repos/ecadlabs/tezos_exporter","forks_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/forks","keys_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/teams","hooks_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/hooks","issue_events_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/issues/events{/number}","events_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/events","assignees_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/assignees{/user}","branches_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/branches{/branch}","tags_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/tags","blobs_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/git/refs{/sha}","trees_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/statuses/{sha}","languages_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/languages","stargazers_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/stargazers","contributors_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/contributors","subscribers_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/subscribers","subscription_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/subscription","commits_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/commits{/sha}","git_commits_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/git/commits{/sha}","comments_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/comments{/number}","issue_comment_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/issues/comments{/number}","contents_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/contents/{+path}","compare_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/merges","archive_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/downloads","issues_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/issues{/number}","pulls_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/pulls{/number}","milestones_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/milestones{/number}","notifications_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/labels{/name}","releases_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/releases{/id}","deployments_url":"https://api.github.com/repos/ecadlabs/tezos_exporter/deployments","created_at":"2018-10-05T12:13:42Z","updated_at":"2018-11-18T20:22:00Z","pushed_at":"2018-11-24T01:34:53Z","git_url":"git://github.com/ecadlabs/tezos_exporter.git","ssh_url":"git@github.com:ecadlabs/tezos_exporter.git","clone_url":"https://github.com/ecadlabs/tezos_exporter.git","svn_url":"https://github.com/ecadlabs/tezos_exporter","homepage":null,"size":287,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":9,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ecadlabs/tezos_exporter/pulls/9"},"html":{"href":"https://github.com/ecadlabs/tezos_exporter/pull/9"},"issue":{"href":"https://api.github.com/repos/ecadlabs/tezos_exporter/issues/9"},"comments":{"href":"https://api.github.com/repos/ecadlabs/tezos_exporter/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/ecadlabs/tezos_exporter/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/ecadlabs/tezos_exporter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ecadlabs/tezos_exporter/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/ecadlabs/tezos_exporter/statuses/3b46a38f22d77c29226dba8cbf439949aa456f8e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"juliusv"}}