{"action":"created","comment":{"url":"https://api.github.com/repos/salemove/jaeger-client-ruby/pulls/comments/245091297","pull_request_review_id":189129912,"id":245091297,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0NTA5MTI5Nw==","diff_hunk":"@@ -29,17 +29,34 @@ def initialize(service_name:)\n         end\n \n         def encode(spans)\n-          Jaeger::Thrift::Batch.new(\n-            'process' => Jaeger::Thrift::Process.new(\n-              'serviceName' => @service_name,\n-              'tags' => @tags\n-            ),\n-            'spans' => spans.map(&method(:encode_span))\n-          )\n+          encode_batch(spans.map(&method(:encode_span)))\n+        end\n+\n+        def encode_limited_size(spans, protocol_class, max_message_length)\n+          batches = []\n+          current_batch = []\n+          current_batch_size = 0\n+          spans.each do |span|\n+            encoded_span = encode_span(span)\n+            encoded_span_size = span_byte_length(encoded_span, protocol_class)\n+            if encoded_span_size + current_batch_size > max_message_length && !current_batch.empty?\n+              batches << encode_batch(current_batch)\n+              current_batch = []\n+              current_batch_size = 0\n+            end\n+            current_batch << encoded_span\n+            current_batch_size += encoded_span_size\n+          end\n+          batches << encode_batch(current_batch) unless current_batch.empty?\n+          batches\n         end\n \n         private\n \n+        def encode_batch(encoded_spans)\n+          Jaeger::Thrift::Batch.new('process' => Jaeger::Thrift::Process.new('serviceName' => @service_name, 'tags' => @tags), 'spans' => encoded_spans)","path":"lib/jaeger/client/encoders/thrift_encoder.rb","position":36,"original_position":36,"commit_id":"07bc86bbb588f50643c3761b364535f083be80c6","original_commit_id":"07bc86bbb588f50643c3761b364535f083be80c6","user":{"login":"indrekj","id":3438,"node_id":"MDQ6VXNlcjM0Mzg=","avatar_url":"https://avatars2.githubusercontent.com/u/3438?v=4","gravatar_id":"","url":"https://api.github.com/users/indrekj","html_url":"https://github.com/indrekj","followers_url":"https://api.github.com/users/indrekj/followers","following_url":"https://api.github.com/users/indrekj/following{/other_user}","gists_url":"https://api.github.com/users/indrekj/gists{/gist_id}","starred_url":"https://api.github.com/users/indrekj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indrekj/subscriptions","organizations_url":"https://api.github.com/users/indrekj/orgs","repos_url":"https://api.github.com/users/indrekj/repos","events_url":"https://api.github.com/users/indrekj/events{/privacy}","received_events_url":"https://api.github.com/users/indrekj/received_events","type":"User","site_admin":false},"body":"I think it is.","created_at":"2019-01-03T18:33:28Z","updated_at":"2019-01-03T18:33:28Z","html_url":"https://github.com/salemove/jaeger-client-ruby/pull/22#discussion_r245091297","pull_request_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/pulls/22","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/salemove/jaeger-client-ruby/pulls/comments/245091297"},"html":{"href":"https://github.com/salemove/jaeger-client-ruby/pull/22#discussion_r245091297"},"pull_request":{"href":"https://api.github.com/repos/salemove/jaeger-client-ruby/pulls/22"}},"in_reply_to_id":244917392},"pull_request":{"url":"https://api.github.com/repos/salemove/jaeger-client-ruby/pulls/22","id":241815458,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQxODE1NDU4","html_url":"https://github.com/salemove/jaeger-client-ruby/pull/22","diff_url":"https://github.com/salemove/jaeger-client-ruby/pull/22.diff","patch_url":"https://github.com/salemove/jaeger-client-ruby/pull/22.patch","issue_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/issues/22","number":22,"state":"open","locked":false,"title":"Add mechanism to limit UDP message batch size","user":{"login":"zindorsky","id":23085399,"node_id":"MDQ6VXNlcjIzMDg1Mzk5","avatar_url":"https://avatars2.githubusercontent.com/u/23085399?v=4","gravatar_id":"","url":"https://api.github.com/users/zindorsky","html_url":"https://github.com/zindorsky","followers_url":"https://api.github.com/users/zindorsky/followers","following_url":"https://api.github.com/users/zindorsky/following{/other_user}","gists_url":"https://api.github.com/users/zindorsky/gists{/gist_id}","starred_url":"https://api.github.com/users/zindorsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zindorsky/subscriptions","organizations_url":"https://api.github.com/users/zindorsky/orgs","repos_url":"https://api.github.com/users/zindorsky/repos","events_url":"https://api.github.com/users/zindorsky/events{/privacy}","received_events_url":"https://api.github.com/users/zindorsky/received_events","type":"User","site_admin":false},"body":"Currently, if a batch can end up being larger than the UDP message size limit, causing its transmission to fail.\r\n\r\nThis MR would add a mechanism to check the size of batches and break them up, creating a \"batch of batches\" so to speak.","created_at":"2019-01-02T18:32:38Z","updated_at":"2019-01-03T18:33:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/pulls/22/commits","review_comments_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/pulls/22/comments","review_comment_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/pulls/comments{/number}","comments_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/issues/22/comments","statuses_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/statuses/07bc86bbb588f50643c3761b364535f083be80c6","head":{"label":"zindorsky:master","ref":"master","sha":"07bc86bbb588f50643c3761b364535f083be80c6","user":{"login":"zindorsky","id":23085399,"node_id":"MDQ6VXNlcjIzMDg1Mzk5","avatar_url":"https://avatars2.githubusercontent.com/u/23085399?v=4","gravatar_id":"","url":"https://api.github.com/users/zindorsky","html_url":"https://github.com/zindorsky","followers_url":"https://api.github.com/users/zindorsky/followers","following_url":"https://api.github.com/users/zindorsky/following{/other_user}","gists_url":"https://api.github.com/users/zindorsky/gists{/gist_id}","starred_url":"https://api.github.com/users/zindorsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zindorsky/subscriptions","organizations_url":"https://api.github.com/users/zindorsky/orgs","repos_url":"https://api.github.com/users/zindorsky/repos","events_url":"https://api.github.com/users/zindorsky/events{/privacy}","received_events_url":"https://api.github.com/users/zindorsky/received_events","type":"User","site_admin":false},"repo":{"id":162318915,"node_id":"MDEwOlJlcG9zaXRvcnkxNjIzMTg5MTU=","name":"jaeger-client-ruby","full_name":"zindorsky/jaeger-client-ruby","private":false,"owner":{"login":"zindorsky","id":23085399,"node_id":"MDQ6VXNlcjIzMDg1Mzk5","avatar_url":"https://avatars2.githubusercontent.com/u/23085399?v=4","gravatar_id":"","url":"https://api.github.com/users/zindorsky","html_url":"https://github.com/zindorsky","followers_url":"https://api.github.com/users/zindorsky/followers","following_url":"https://api.github.com/users/zindorsky/following{/other_user}","gists_url":"https://api.github.com/users/zindorsky/gists{/gist_id}","starred_url":"https://api.github.com/users/zindorsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zindorsky/subscriptions","organizations_url":"https://api.github.com/users/zindorsky/orgs","repos_url":"https://api.github.com/users/zindorsky/repos","events_url":"https://api.github.com/users/zindorsky/events{/privacy}","received_events_url":"https://api.github.com/users/zindorsky/received_events","type":"User","site_admin":false},"html_url":"https://github.com/zindorsky/jaeger-client-ruby","description":"OpenTracing Tracer implementation for Jaeger in Ruby","fork":true,"url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby","forks_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/forks","keys_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/teams","hooks_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/hooks","issue_events_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/events","assignees_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/tags","blobs_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/languages","stargazers_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/stargazers","contributors_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/contributors","subscribers_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/subscribers","subscription_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/subscription","commits_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/merges","archive_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/downloads","issues_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/labels{/name}","releases_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/releases{/id}","deployments_url":"https://api.github.com/repos/zindorsky/jaeger-client-ruby/deployments","created_at":"2018-12-18T16:49:50Z","updated_at":"2018-12-18T17:06:21Z","pushed_at":"2018-12-18T17:06:20Z","git_url":"git://github.com/zindorsky/jaeger-client-ruby.git","ssh_url":"git@github.com:zindorsky/jaeger-client-ruby.git","clone_url":"https://github.com/zindorsky/jaeger-client-ruby.git","svn_url":"https://github.com/zindorsky/jaeger-client-ruby","homepage":"","size":107,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"salemove:master","ref":"master","sha":"d357d4b3e76a8a317009bbf1459415dfa8e554fb","user":{"login":"salemove","id":5281619,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyODE2MTk=","avatar_url":"https://avatars0.githubusercontent.com/u/5281619?v=4","gravatar_id":"","url":"https://api.github.com/users/salemove","html_url":"https://github.com/salemove","followers_url":"https://api.github.com/users/salemove/followers","following_url":"https://api.github.com/users/salemove/following{/other_user}","gists_url":"https://api.github.com/users/salemove/gists{/gist_id}","starred_url":"https://api.github.com/users/salemove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/salemove/subscriptions","organizations_url":"https://api.github.com/users/salemove/orgs","repos_url":"https://api.github.com/users/salemove/repos","events_url":"https://api.github.com/users/salemove/events{/privacy}","received_events_url":"https://api.github.com/users/salemove/received_events","type":"Organization","site_admin":false},"repo":{"id":89075062,"node_id":"MDEwOlJlcG9zaXRvcnk4OTA3NTA2Mg==","name":"jaeger-client-ruby","full_name":"salemove/jaeger-client-ruby","private":false,"owner":{"login":"salemove","id":5281619,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyODE2MTk=","avatar_url":"https://avatars0.githubusercontent.com/u/5281619?v=4","gravatar_id":"","url":"https://api.github.com/users/salemove","html_url":"https://github.com/salemove","followers_url":"https://api.github.com/users/salemove/followers","following_url":"https://api.github.com/users/salemove/following{/other_user}","gists_url":"https://api.github.com/users/salemove/gists{/gist_id}","starred_url":"https://api.github.com/users/salemove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/salemove/subscriptions","organizations_url":"https://api.github.com/users/salemove/orgs","repos_url":"https://api.github.com/users/salemove/repos","events_url":"https://api.github.com/users/salemove/events{/privacy}","received_events_url":"https://api.github.com/users/salemove/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/salemove/jaeger-client-ruby","description":"OpenTracing Tracer implementation for Jaeger in Ruby","fork":false,"url":"https://api.github.com/repos/salemove/jaeger-client-ruby","forks_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/forks","keys_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/teams","hooks_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/hooks","issue_events_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/events","assignees_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/tags","blobs_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/languages","stargazers_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/stargazers","contributors_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/contributors","subscribers_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/subscribers","subscription_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/subscription","commits_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/merges","archive_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/downloads","issues_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/labels{/name}","releases_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/releases{/id}","deployments_url":"https://api.github.com/repos/salemove/jaeger-client-ruby/deployments","created_at":"2017-04-22T14:19:01Z","updated_at":"2019-01-01T20:48:18Z","pushed_at":"2019-01-03T17:38:15Z","git_url":"git://github.com/salemove/jaeger-client-ruby.git","ssh_url":"git@github.com:salemove/jaeger-client-ruby.git","clone_url":"https://github.com/salemove/jaeger-client-ruby.git","svn_url":"https://github.com/salemove/jaeger-client-ruby","homepage":"","size":201,"stargazers_count":34,"watchers_count":34,"language":"Ruby","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":20,"open_issues":3,"watchers":34,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/salemove/jaeger-client-ruby/pulls/22"},"html":{"href":"https://github.com/salemove/jaeger-client-ruby/pull/22"},"issue":{"href":"https://api.github.com/repos/salemove/jaeger-client-ruby/issues/22"},"comments":{"href":"https://api.github.com/repos/salemove/jaeger-client-ruby/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/salemove/jaeger-client-ruby/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/salemove/jaeger-client-ruby/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/salemove/jaeger-client-ruby/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/salemove/jaeger-client-ruby/statuses/07bc86bbb588f50643c3761b364535f083be80c6"}},"author_association":"NONE"}}
{"actor":{"display_login":"indrekj"}}