{"action":"created","comment":{"url":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/comments/227300258","pull_request_review_id":167307653,"id":227300258,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNzMwMDI1OA==","diff_hunk":"@@ -63,15 +63,16 @@ func (s *Sampler) Run() {\n }\n \n // Add samples a trace and returns true if trace was sampled (should be kept), false otherwise\n-func (s *Sampler) Add(t processedTrace) bool {\n+func (s *Sampler) Add(t processedTrace) (sampled bool, sampleRate float64) {","path":"cmd/trace-agent/sampler.go","position":5,"original_position":5,"commit_id":"b83d6e800157cb4bbd584680e3e1ea1041fed015","original_commit_id":"b83d6e800157cb4bbd584680e3e1ea1041fed015","user":{"login":"furmmon","id":22001182,"node_id":"MDQ6VXNlcjIyMDAxMTgy","avatar_url":"https://avatars1.githubusercontent.com/u/22001182?v=4","gravatar_id":"","url":"https://api.github.com/users/furmmon","html_url":"https://github.com/furmmon","followers_url":"https://api.github.com/users/furmmon/followers","following_url":"https://api.github.com/users/furmmon/following{/other_user}","gists_url":"https://api.github.com/users/furmmon/gists{/gist_id}","starred_url":"https://api.github.com/users/furmmon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/furmmon/subscriptions","organizations_url":"https://api.github.com/users/furmmon/orgs","repos_url":"https://api.github.com/users/furmmon/repos","events_url":"https://api.github.com/users/furmmon/events{/privacy}","received_events_url":"https://api.github.com/users/furmmon/received_events","type":"User","site_admin":false},"body":"I prefer sampled over ok, I think it's more explicit.\r\nIf ok is false, what does it mean? The `rate` value is still right","created_at":"2018-10-23T09:17:46Z","updated_at":"2018-10-23T09:17:46Z","html_url":"https://github.com/DataDog/datadog-trace-agent/pull/494#discussion_r227300258","pull_request_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/494","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/comments/227300258"},"html":{"href":"https://github.com/DataDog/datadog-trace-agent/pull/494#discussion_r227300258"},"pull_request":{"href":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/494"}},"in_reply_to_id":226931206},"pull_request":{"url":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/494","id":222954556,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIyOTU0NTU2","html_url":"https://github.com/DataDog/datadog-trace-agent/pull/494","diff_url":"https://github.com/DataDog/datadog-trace-agent/pull/494.diff","patch_url":"https://github.com/DataDog/datadog-trace-agent/pull/494.patch","issue_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/issues/494","number":494,"state":"open","locked":false,"title":"cmd/trace-agent: combine sampler rates","user":{"login":"furmmon","id":22001182,"node_id":"MDQ6VXNlcjIyMDAxMTgy","avatar_url":"https://avatars1.githubusercontent.com/u/22001182?v=4","gravatar_id":"","url":"https://api.github.com/users/furmmon","html_url":"https://github.com/furmmon","followers_url":"https://api.github.com/users/furmmon/followers","following_url":"https://api.github.com/users/furmmon/following{/other_user}","gists_url":"https://api.github.com/users/furmmon/gists{/gist_id}","starred_url":"https://api.github.com/users/furmmon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/furmmon/subscriptions","organizations_url":"https://api.github.com/users/furmmon/orgs","repos_url":"https://api.github.com/users/furmmon/repos","events_url":"https://api.github.com/users/furmmon/events{/privacy}","received_events_url":"https://api.github.com/users/furmmon/received_events","type":"User","site_admin":false},"body":"Traces are sampled by various independent samplers. If one decides to sample it, the trace is sampled. The usual samplers are: a scoreSampler and a prioritySampler.\r\n\r\nIn sampled traces we add the applied `sampling_rate`. This value is currently wrong as it does not take in account the sampling rate applied by the prioritySampler.\r\n\r\nThis PR aims at fixing the sample_rate values\r\n\r\n1. Fetching Priority sampler sample rate\r\nRetrieving client applied rate with the key `_sampling_priority_rate_v1`. If it does not exist, applying the next rate that will be sent to clients.\r\n\r\n2. Merging signature|error sampling rates with priority.\r\nSignature/Error samplers are run in parallel to the Priority sampler. Both are independent.\r\nSampling rate is, signatureSamplingRate + prioritySamplingRate - signatureSamplingRate*prioritySamplingRate \r\n\r\n3. Add sampling rate to the pre-sampler and agent sampler rates that are already set in the trace\r\n\r\n4. Isolate sampling decision in a function and have specific tests for it","created_at":"2018-10-15T15:47:45Z","updated_at":"2018-10-23T09:17:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3510a1eb2f36d6870b353aa033abc855c5f31b7e","assignee":null,"assignees":[],"requested_reviewers":[{"login":"LotharSee","id":2720261,"node_id":"MDQ6VXNlcjI3MjAyNjE=","avatar_url":"https://avatars1.githubusercontent.com/u/2720261?v=4","gravatar_id":"","url":"https://api.github.com/users/LotharSee","html_url":"https://github.com/LotharSee","followers_url":"https://api.github.com/users/LotharSee/followers","following_url":"https://api.github.com/users/LotharSee/following{/other_user}","gists_url":"https://api.github.com/users/LotharSee/gists{/gist_id}","starred_url":"https://api.github.com/users/LotharSee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LotharSee/subscriptions","organizations_url":"https://api.github.com/users/LotharSee/orgs","repos_url":"https://api.github.com/users/LotharSee/repos","events_url":"https://api.github.com/users/LotharSee/events{/privacy}","received_events_url":"https://api.github.com/users/LotharSee/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/494/commits","review_comments_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/494/comments","review_comment_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/issues/494/comments","statuses_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/statuses/b83d6e800157cb4bbd584680e3e1ea1041fed015","head":{"label":"DataDog:raphael/fix_sampling_rate","ref":"raphael/fix_sampling_rate","sha":"b83d6e800157cb4bbd584680e3e1ea1041fed015","user":{"login":"DataDog","id":365230,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NTIzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/365230?v=4","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"repo":{"id":38379832,"node_id":"MDEwOlJlcG9zaXRvcnkzODM3OTgzMg==","name":"datadog-trace-agent","full_name":"DataDog/datadog-trace-agent","private":false,"owner":{"login":"DataDog","id":365230,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NTIzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/365230?v=4","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/DataDog/datadog-trace-agent","description":"Datadog APM agent.","fork":false,"url":"https://api.github.com/repos/DataDog/datadog-trace-agent","forks_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/forks","keys_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/teams","hooks_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/hooks","issue_events_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/issues/events{/number}","events_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/events","assignees_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/assignees{/user}","branches_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/branches{/branch}","tags_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/tags","blobs_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/statuses/{sha}","languages_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/languages","stargazers_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/stargazers","contributors_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/contributors","subscribers_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/subscribers","subscription_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/subscription","commits_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/contents/{+path}","compare_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/merges","archive_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/downloads","issues_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/issues{/number}","pulls_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls{/number}","milestones_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/milestones{/number}","notifications_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/labels{/name}","releases_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/releases{/id}","deployments_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/deployments","created_at":"2015-07-01T15:45:17Z","updated_at":"2018-10-22T13:53:12Z","pushed_at":"2018-10-23T09:06:08Z","git_url":"git://github.com/DataDog/datadog-trace-agent.git","ssh_url":"git@github.com:DataDog/datadog-trace-agent.git","clone_url":"https://github.com/DataDog/datadog-trace-agent.git","svn_url":"https://github.com/DataDog/datadog-trace-agent","homepage":"http://www.datadog.com","size":5448,"stargazers_count":65,"watchers_count":65,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":25,"mirror_url":null,"archived":false,"open_issues_count":24,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":25,"open_issues":24,"watchers":65,"default_branch":"master"}},"base":{"label":"DataDog:master","ref":"master","sha":"24d4c766c03f408d2182b0aed52d7c41e4c1d2c0","user":{"login":"DataDog","id":365230,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NTIzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/365230?v=4","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"repo":{"id":38379832,"node_id":"MDEwOlJlcG9zaXRvcnkzODM3OTgzMg==","name":"datadog-trace-agent","full_name":"DataDog/datadog-trace-agent","private":false,"owner":{"login":"DataDog","id":365230,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NTIzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/365230?v=4","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/DataDog/datadog-trace-agent","description":"Datadog APM agent.","fork":false,"url":"https://api.github.com/repos/DataDog/datadog-trace-agent","forks_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/forks","keys_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/teams","hooks_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/hooks","issue_events_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/issues/events{/number}","events_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/events","assignees_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/assignees{/user}","branches_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/branches{/branch}","tags_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/tags","blobs_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/statuses/{sha}","languages_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/languages","stargazers_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/stargazers","contributors_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/contributors","subscribers_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/subscribers","subscription_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/subscription","commits_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/contents/{+path}","compare_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/merges","archive_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/downloads","issues_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/issues{/number}","pulls_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls{/number}","milestones_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/milestones{/number}","notifications_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/labels{/name}","releases_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/releases{/id}","deployments_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/deployments","created_at":"2015-07-01T15:45:17Z","updated_at":"2018-10-22T13:53:12Z","pushed_at":"2018-10-23T09:06:08Z","git_url":"git://github.com/DataDog/datadog-trace-agent.git","ssh_url":"git@github.com:DataDog/datadog-trace-agent.git","clone_url":"https://github.com/DataDog/datadog-trace-agent.git","svn_url":"https://github.com/DataDog/datadog-trace-agent","homepage":"http://www.datadog.com","size":5448,"stargazers_count":65,"watchers_count":65,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":25,"mirror_url":null,"archived":false,"open_issues_count":24,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":25,"open_issues":24,"watchers":65,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/494"},"html":{"href":"https://github.com/DataDog/datadog-trace-agent/pull/494"},"issue":{"href":"https://api.github.com/repos/DataDog/datadog-trace-agent/issues/494"},"comments":{"href":"https://api.github.com/repos/DataDog/datadog-trace-agent/issues/494/comments"},"review_comments":{"href":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/494/comments"},"review_comment":{"href":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/494/commits"},"statuses":{"href":"https://api.github.com/repos/DataDog/datadog-trace-agent/statuses/b83d6e800157cb4bbd584680e3e1ea1041fed015"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"furmmon"}}