{"action":"created","comment":{"url":"https://api.github.com/repos/ipfs/ipfs-cluster/pulls/comments/186645169","pull_request_review_id":118261434,"id":186645169,"diff_hunk":"@@ -176,66 +177,20 @@ func (c *Cluster) syncWatcher() {\n \t}\n }\n \n-func (c *Cluster) broadcastMetric(m api.Metric) error {\n-\tpeers, err := c.consensus.Peers()\n-\tif err != nil {\n-\t\tlogger.Error(err)\n-\t\treturn err\n-\t}\n-\tleader, err := c.consensus.Leader()\n-\tif err != nil {\n-\t\treturn err\n-\t}\n-\n-\tif m.Discard() {\n-\t\tlogger.Warningf(\"discarding invalid metric: %+v\", m)\n-\t\treturn nil\n-\t}\n-\n-\t// If a peer is down, the rpc call will get locked. Therefore,\n-\t// we need to do it async. This way we keep broadcasting\n-\t// even if someone is down. Eventually those requests will\n-\t// timeout in libp2p and the errors logged.\n-\tgo func() {\n-\t\tif leader == c.id {\n-\t\t\t// Leader needs to broadcast its metric to everyone\n-\t\t\t// in case it goes down (new leader will have to detect this node went down)\n-\t\t\tlogger.Debugf(\"Leader %s about to broadcast metric %s to %s. Expires: %d\", c.id, m.Name, peers, m.Expire)\n-\t\t\terrs := c.multiRPC(peers,\n-\t\t\t\t\"Cluster\",\n-\t\t\t\t\"PeerMonitorLogMetric\",\n-\t\t\t\tm,\n-\t\t\t\tcopyEmptyStructToIfaces(make([]struct{}, len(peers), len(peers))))\n-\t\t\tfor i, e := range errs {\n-\t\t\t\tif e != nil {\n-\t\t\t\t\tlogger.Errorf(\"error pushing metric to %s: %s\", peers[i].Pretty(), e)\n-\t\t\t\t}\n-\t\t\t}\n-\t\t\tlogger.Debugf(\"Leader %s broadcasted metric %s to %s. Expires: %s\", c.id, m.Name, peers, m.Expire)\n-\t\t} else {\n-\t\t\t// non-leaders just need to forward their metrics to the leader\n-\t\t\tlogger.Debugf(\"Peer %s about to send metric %s to %s. Expires: %s\", c.id, m.Name, leader, m.Expire)\n-\n-\t\t\terr := c.rpcClient.Call(leader,\n-\t\t\t\t\"Cluster\", \"PeerMonitorLogMetric\",\n-\t\t\t\tm, &struct{}{})\n-\t\t\tif err != nil {\n-\t\t\t\tlogger.Error(err)\n-\t\t\t}\n-\t\t\tlogger.Debugf(\"Peer %s sent metric %s to %s. Expires: %s\", c.id, m.Name, leader, m.Expire)\n-\n-\t\t}\n-\t}()\n-\treturn nil\n-}\n-\n-// push metrics loops and pushes metrics to the leader's monitor\n+// pushInformerMetrics loops and publishes informers metrics using the\n+// cluster monitor. Metrics are pushed normally at a TTL/2 rate. If an error\n+// occurs, they are pushed at a TTL/4 rate.\n func (c *Cluster) pushInformerMetrics() {","path":"cluster.go","position":69,"original_position":69,"commit_id":"8c8487d74b7d6761f5538cd590d063789aef5e51","original_commit_id":"8c8487d74b7d6761f5538cd590d063789aef5e51","user":{"login":"lanzafame","id":5924712,"avatar_url":"https://avatars0.githubusercontent.com/u/5924712?v=4","gravatar_id":"","url":"https://api.github.com/users/lanzafame","html_url":"https://github.com/lanzafame","followers_url":"https://api.github.com/users/lanzafame/followers","following_url":"https://api.github.com/users/lanzafame/following{/other_user}","gists_url":"https://api.github.com/users/lanzafame/gists{/gist_id}","starred_url":"https://api.github.com/users/lanzafame/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lanzafame/subscriptions","organizations_url":"https://api.github.com/users/lanzafame/orgs","repos_url":"https://api.github.com/users/lanzafame/repos","events_url":"https://api.github.com/users/lanzafame/events{/privacy}","received_events_url":"https://api.github.com/users/lanzafame/received_events","type":"User","site_admin":false},"body":"Sure thing","created_at":"2018-05-08T07:58:01Z","updated_at":"2018-05-08T07:58:01Z","html_url":"https://github.com/ipfs/ipfs-cluster/pull/400#discussion_r186645169","pull_request_url":"https://api.github.com/repos/ipfs/ipfs-cluster/pulls/400","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/ipfs/ipfs-cluster/pulls/comments/186645169"},"html":{"href":"https://github.com/ipfs/ipfs-cluster/pull/400#discussion_r186645169"},"pull_request":{"href":"https://api.github.com/repos/ipfs/ipfs-cluster/pulls/400"}},"in_reply_to_id":186611188},"pull_request":{"url":"https://api.github.com/repos/ipfs/ipfs-cluster/pulls/400","id":185213000,"html_url":"https://github.com/ipfs/ipfs-cluster/pull/400","diff_url":"https://github.com/ipfs/ipfs-cluster/pull/400.diff","patch_url":"https://github.com/ipfs/ipfs-cluster/pull/400.patch","issue_url":"https://api.github.com/repos/ipfs/ipfs-cluster/issues/400","number":400,"state":"open","locked":false,"title":"Feat: pubsub monitoring","user":{"login":"hsanjuan","id":1027022,"avatar_url":"https://avatars3.githubusercontent.com/u/1027022?v=4","gravatar_id":"","url":"https://api.github.com/users/hsanjuan","html_url":"https://github.com/hsanjuan","followers_url":"https://api.github.com/users/hsanjuan/followers","following_url":"https://api.github.com/users/hsanjuan/following{/other_user}","gists_url":"https://api.github.com/users/hsanjuan/gists{/gist_id}","starred_url":"https://api.github.com/users/hsanjuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hsanjuan/subscriptions","organizations_url":"https://api.github.com/users/hsanjuan/orgs","repos_url":"https://api.github.com/users/hsanjuan/repos","events_url":"https://api.github.com/users/hsanjuan/events{/privacy}","received_events_url":"https://api.github.com/users/hsanjuan/received_events","type":"User","site_admin":false},"body":"This provides a new `pubsubmon` component that implements `PeerMonitor`, but before, it makes a number of changes to the `PeerMonitor` interface, `basic` monitor implementation:\r\n\r\n* Extraction of common functionality into a `util` module: MetricsWindow and MetricsChecker.\r\n* Adding the `PublishMetric` method to the interface and moving publish functionality to the monitor itself.\r\n* Adding some tests and small improvements to the codebase\r\n* Addding the new module.\r\n\r\nRight now there is duplicated code between the monitors. I'm thinking what to do about that and whether I want to deprecate the `basic` monitor in a future release and delete it, or simply refactor things further.","created_at":"2018-05-01T16:13:32Z","updated_at":"2018-05-08T07:58:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"901cc24eeffe9870fb0b2d46d223ec2157c83a40","assignee":{"login":"hsanjuan","id":1027022,"avatar_url":"https://avatars3.githubusercontent.com/u/1027022?v=4","gravatar_id":"","url":"https://api.github.com/users/hsanjuan","html_url":"https://github.com/hsanjuan","followers_url":"https://api.github.com/users/hsanjuan/followers","following_url":"https://api.github.com/users/hsanjuan/following{/other_user}","gists_url":"https://api.github.com/users/hsanjuan/gists{/gist_id}","starred_url":"https://api.github.com/users/hsanjuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hsanjuan/subscriptions","organizations_url":"https://api.github.com/users/hsanjuan/orgs","repos_url":"https://api.github.com/users/hsanjuan/repos","events_url":"https://api.github.com/users/hsanjuan/events{/privacy}","received_events_url":"https://api.github.com/users/hsanjuan/received_events","type":"User","site_admin":false},"assignees":[{"login":"hsanjuan","id":1027022,"avatar_url":"https://avatars3.githubusercontent.com/u/1027022?v=4","gravatar_id":"","url":"https://api.github.com/users/hsanjuan","html_url":"https://github.com/hsanjuan","followers_url":"https://api.github.com/users/hsanjuan/followers","following_url":"https://api.github.com/users/hsanjuan/following{/other_user}","gists_url":"https://api.github.com/users/hsanjuan/gists{/gist_id}","starred_url":"https://api.github.com/users/hsanjuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hsanjuan/subscriptions","organizations_url":"https://api.github.com/users/hsanjuan/orgs","repos_url":"https://api.github.com/users/hsanjuan/repos","events_url":"https://api.github.com/users/hsanjuan/events{/privacy}","received_events_url":"https://api.github.com/users/hsanjuan/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":510842526,"url":"https://api.github.com/repos/ipfs/ipfs-cluster/labels/in%20progress","name":"in progress","color":"fbca04","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ipfs/ipfs-cluster/pulls/400/commits","review_comments_url":"https://api.github.com/repos/ipfs/ipfs-cluster/pulls/400/comments","review_comment_url":"https://api.github.com/repos/ipfs/ipfs-cluster/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ipfs/ipfs-cluster/issues/400/comments","statuses_url":"https://api.github.com/repos/ipfs/ipfs-cluster/statuses/8c8487d74b7d6761f5538cd590d063789aef5e51","head":{"label":"ipfs:feat/pubsub-monitoring","ref":"feat/pubsub-monitoring","sha":"8c8487d74b7d6761f5538cd590d063789aef5e51","user":{"login":"ipfs","id":10536621,"avatar_url":"https://avatars0.githubusercontent.com/u/10536621?v=4","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"repo":{"id":62413100,"name":"ipfs-cluster","full_name":"ipfs/ipfs-cluster","owner":{"login":"ipfs","id":10536621,"avatar_url":"https://avatars0.githubusercontent.com/u/10536621?v=4","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ipfs/ipfs-cluster","description":"Pinset orchestration for IPFS","fork":false,"url":"https://api.github.com/repos/ipfs/ipfs-cluster","forks_url":"https://api.github.com/repos/ipfs/ipfs-cluster/forks","keys_url":"https://api.github.com/repos/ipfs/ipfs-cluster/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ipfs/ipfs-cluster/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ipfs/ipfs-cluster/teams","hooks_url":"https://api.github.com/repos/ipfs/ipfs-cluster/hooks","issue_events_url":"https://api.github.com/repos/ipfs/ipfs-cluster/issues/events{/number}","events_url":"https://api.github.com/repos/ipfs/ipfs-cluster/events","assignees_url":"https://api.github.com/repos/ipfs/ipfs-cluster/assignees{/user}","branches_url":"https://api.github.com/repos/ipfs/ipfs-cluster/branches{/branch}","tags_url":"https://api.github.com/repos/ipfs/ipfs-cluster/tags","blobs_url":"https://api.github.com/repos/ipfs/ipfs-cluster/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ipfs/ipfs-cluster/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ipfs/ipfs-cluster/git/refs{/sha}","trees_url":"https://api.github.com/repos/ipfs/ipfs-cluster/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ipfs/ipfs-cluster/statuses/{sha}","languages_url":"https://api.github.com/repos/ipfs/ipfs-cluster/languages","stargazers_url":"https://api.github.com/repos/ipfs/ipfs-cluster/stargazers","contributors_url":"https://api.github.com/repos/ipfs/ipfs-cluster/contributors","subscribers_url":"https://api.github.com/repos/ipfs/ipfs-cluster/subscribers","subscription_url":"https://api.github.com/repos/ipfs/ipfs-cluster/subscription","commits_url":"https://api.github.com/repos/ipfs/ipfs-cluster/commits{/sha}","git_commits_url":"https://api.github.com/repos/ipfs/ipfs-cluster/git/commits{/sha}","comments_url":"https://api.github.com/repos/ipfs/ipfs-cluster/comments{/number}","issue_comment_url":"https://api.github.com/repos/ipfs/ipfs-cluster/issues/comments{/number}","contents_url":"https://api.github.com/repos/ipfs/ipfs-cluster/contents/{+path}","compare_url":"https://api.github.com/repos/ipfs/ipfs-cluster/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ipfs/ipfs-cluster/merges","archive_url":"https://api.github.com/repos/ipfs/ipfs-cluster/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ipfs/ipfs-cluster/downloads","issues_url":"https://api.github.com/repos/ipfs/ipfs-cluster/issues{/number}","pulls_url":"https://api.github.com/repos/ipfs/ipfs-cluster/pulls{/number}","milestones_url":"https://api.github.com/repos/ipfs/ipfs-cluster/milestones{/number}","notifications_url":"https://api.github.com/repos/ipfs/ipfs-cluster/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ipfs/ipfs-cluster/labels{/name}","releases_url":"https://api.github.com/repos/ipfs/ipfs-cluster/releases{/id}","deployments_url":"https://api.github.com/repos/ipfs/ipfs-cluster/deployments","created_at":"2016-07-01T18:41:15Z","updated_at":"2018-05-07T06:29:18Z","pushed_at":"2018-05-07T17:02:44Z","git_url":"git://github.com/ipfs/ipfs-cluster.git","ssh_url":"git@github.com:ipfs/ipfs-cluster.git","clone_url":"https://github.com/ipfs/ipfs-cluster.git","svn_url":"https://github.com/ipfs/ipfs-cluster","homepage":"https://cluster.ipfs.io","size":2165,"stargazers_count":255,"watchers_count":255,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":39,"mirror_url":null,"archived":false,"open_issues_count":66,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":39,"open_issues":66,"watchers":255,"default_branch":"master"}},"base":{"label":"ipfs:master","ref":"master","sha":"029cd77c27b0a7335389db924f7d144159d83892","user":{"login":"ipfs","id":10536621,"avatar_url":"https://avatars0.githubusercontent.com/u/10536621?v=4","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"repo":{"id":62413100,"name":"ipfs-cluster","full_name":"ipfs/ipfs-cluster","owner":{"login":"ipfs","id":10536621,"avatar_url":"https://avatars0.githubusercontent.com/u/10536621?v=4","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ipfs/ipfs-cluster","description":"Pinset orchestration for IPFS","fork":false,"url":"https://api.github.com/repos/ipfs/ipfs-cluster","forks_url":"https://api.github.com/repos/ipfs/ipfs-cluster/forks","keys_url":"https://api.github.com/repos/ipfs/ipfs-cluster/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ipfs/ipfs-cluster/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ipfs/ipfs-cluster/teams","hooks_url":"https://api.github.com/repos/ipfs/ipfs-cluster/hooks","issue_events_url":"https://api.github.com/repos/ipfs/ipfs-cluster/issues/events{/number}","events_url":"https://api.github.com/repos/ipfs/ipfs-cluster/events","assignees_url":"https://api.github.com/repos/ipfs/ipfs-cluster/assignees{/user}","branches_url":"https://api.github.com/repos/ipfs/ipfs-cluster/branches{/branch}","tags_url":"https://api.github.com/repos/ipfs/ipfs-cluster/tags","blobs_url":"https://api.github.com/repos/ipfs/ipfs-cluster/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ipfs/ipfs-cluster/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ipfs/ipfs-cluster/git/refs{/sha}","trees_url":"https://api.github.com/repos/ipfs/ipfs-cluster/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ipfs/ipfs-cluster/statuses/{sha}","languages_url":"https://api.github.com/repos/ipfs/ipfs-cluster/languages","stargazers_url":"https://api.github.com/repos/ipfs/ipfs-cluster/stargazers","contributors_url":"https://api.github.com/repos/ipfs/ipfs-cluster/contributors","subscribers_url":"https://api.github.com/repos/ipfs/ipfs-cluster/subscribers","subscription_url":"https://api.github.com/repos/ipfs/ipfs-cluster/subscription","commits_url":"https://api.github.com/repos/ipfs/ipfs-cluster/commits{/sha}","git_commits_url":"https://api.github.com/repos/ipfs/ipfs-cluster/git/commits{/sha}","comments_url":"https://api.github.com/repos/ipfs/ipfs-cluster/comments{/number}","issue_comment_url":"https://api.github.com/repos/ipfs/ipfs-cluster/issues/comments{/number}","contents_url":"https://api.github.com/repos/ipfs/ipfs-cluster/contents/{+path}","compare_url":"https://api.github.com/repos/ipfs/ipfs-cluster/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ipfs/ipfs-cluster/merges","archive_url":"https://api.github.com/repos/ipfs/ipfs-cluster/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ipfs/ipfs-cluster/downloads","issues_url":"https://api.github.com/repos/ipfs/ipfs-cluster/issues{/number}","pulls_url":"https://api.github.com/repos/ipfs/ipfs-cluster/pulls{/number}","milestones_url":"https://api.github.com/repos/ipfs/ipfs-cluster/milestones{/number}","notifications_url":"https://api.github.com/repos/ipfs/ipfs-cluster/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ipfs/ipfs-cluster/labels{/name}","releases_url":"https://api.github.com/repos/ipfs/ipfs-cluster/releases{/id}","deployments_url":"https://api.github.com/repos/ipfs/ipfs-cluster/deployments","created_at":"2016-07-01T18:41:15Z","updated_at":"2018-05-07T06:29:18Z","pushed_at":"2018-05-07T17:02:44Z","git_url":"git://github.com/ipfs/ipfs-cluster.git","ssh_url":"git@github.com:ipfs/ipfs-cluster.git","clone_url":"https://github.com/ipfs/ipfs-cluster.git","svn_url":"https://github.com/ipfs/ipfs-cluster","homepage":"https://cluster.ipfs.io","size":2165,"stargazers_count":255,"watchers_count":255,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":39,"mirror_url":null,"archived":false,"open_issues_count":66,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":39,"open_issues":66,"watchers":255,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ipfs/ipfs-cluster/pulls/400"},"html":{"href":"https://github.com/ipfs/ipfs-cluster/pull/400"},"issue":{"href":"https://api.github.com/repos/ipfs/ipfs-cluster/issues/400"},"comments":{"href":"https://api.github.com/repos/ipfs/ipfs-cluster/issues/400/comments"},"review_comments":{"href":"https://api.github.com/repos/ipfs/ipfs-cluster/pulls/400/comments"},"review_comment":{"href":"https://api.github.com/repos/ipfs/ipfs-cluster/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ipfs/ipfs-cluster/pulls/400/commits"},"statuses":{"href":"https://api.github.com/repos/ipfs/ipfs-cluster/statuses/8c8487d74b7d6761f5538cd590d063789aef5e51"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"lanzafame"}}