{"action":"closed","number":446,"pull_request":{"url":"https://api.github.com/repos/DataDog/dd-trace-rb/pulls/446","id":193315702,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkzMzE1NzAy","html_url":"https://github.com/DataDog/dd-trace-rb/pull/446","diff_url":"https://github.com/DataDog/dd-trace-rb/pull/446.diff","patch_url":"https://github.com/DataDog/dd-trace-rb/pull/446.patch","issue_url":"https://api.github.com/repos/DataDog/dd-trace-rb/issues/446","number":446,"state":"closed","locked":false,"title":"Reduce memory footprint and GC pressure","user":{"login":"pawelchcki","id":812891,"node_id":"MDQ6VXNlcjgxMjg5MQ==","avatar_url":"https://avatars2.githubusercontent.com/u/812891?v=4","gravatar_id":"","url":"https://api.github.com/users/pawelchcki","html_url":"https://github.com/pawelchcki","followers_url":"https://api.github.com/users/pawelchcki/followers","following_url":"https://api.github.com/users/pawelchcki/following{/other_user}","gists_url":"https://api.github.com/users/pawelchcki/gists{/gist_id}","starred_url":"https://api.github.com/users/pawelchcki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pawelchcki/subscriptions","organizations_url":"https://api.github.com/users/pawelchcki/orgs","repos_url":"https://api.github.com/users/pawelchcki/repos","events_url":"https://api.github.com/users/pawelchcki/events{/privacy}","received_events_url":"https://api.github.com/users/pawelchcki/received_events","type":"User","site_admin":false},"body":"This PR tries to optimize memory used by enabled integrations.\r\n\r\nEach traced operation creates a span to store the data about it. Each created span has associated cost, both related to creation time and memory footprint of Span object.\r\n\r\nInspecting code and looking at measurements produced by `derailed` gem helped identify spots of unnecessary temporary object creation.\r\n\r\nThis PR reduces the incidence of temporary object creation and by switching storing of timestamps to much smaller `Floats` (before they were full Time objects, with some temporary objects created in between. \r\n\r\nIt reduces the maximum memory used by test application by up to 50%. \r\n\r\nExamples of changes:\r\n- each configuration access triggered creation of temporary `Proxy` objects, now they are cached\r\n- quite a few strings were allocated with every span creation, `.freeze`-ing those solved that problem (at least for rubies 2.2+)\r\n- `Utils.truncate` was used to truncate Strings, however it did so by creating around 3 temporary strings each with a copy of truncated string. New `#truncate!` method uses the fact that all those Strings can be safely modified to truncate the object without any temporary object creation.\r\n- `Time.now.utc` requires 2 Time objects to be created. `Process.clock_gettime(Process::CLOCK_REALTIME)` only creates one Float which has much negligible footprint compared to Time. \r\n\r\n","created_at":"2018-06-07T13:10:03Z","updated_at":"2018-06-11T19:35:06Z","closed_at":"2018-06-11T19:35:06Z","merged_at":"2018-06-11T19:35:06Z","merge_commit_sha":"6c12ab02de147dabd1c546ab231fed1abd386a00","assignee":{"login":"delner","id":3237131,"node_id":"MDQ6VXNlcjMyMzcxMzE=","avatar_url":"https://avatars1.githubusercontent.com/u/3237131?v=4","gravatar_id":"","url":"https://api.github.com/users/delner","html_url":"https://github.com/delner","followers_url":"https://api.github.com/users/delner/followers","following_url":"https://api.github.com/users/delner/following{/other_user}","gists_url":"https://api.github.com/users/delner/gists{/gist_id}","starred_url":"https://api.github.com/users/delner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delner/subscriptions","organizations_url":"https://api.github.com/users/delner/orgs","repos_url":"https://api.github.com/users/delner/repos","events_url":"https://api.github.com/users/delner/events{/privacy}","received_events_url":"https://api.github.com/users/delner/received_events","type":"User","site_admin":false},"assignees":[{"login":"delner","id":3237131,"node_id":"MDQ6VXNlcjMyMzcxMzE=","avatar_url":"https://avatars1.githubusercontent.com/u/3237131?v=4","gravatar_id":"","url":"https://api.github.com/users/delner","html_url":"https://github.com/delner","followers_url":"https://api.github.com/users/delner/followers","following_url":"https://api.github.com/users/delner/following{/other_user}","gists_url":"https://api.github.com/users/delner/gists{/gist_id}","starred_url":"https://api.github.com/users/delner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delner/subscriptions","organizations_url":"https://api.github.com/users/delner/orgs","repos_url":"https://api.github.com/users/delner/repos","events_url":"https://api.github.com/users/delner/events{/privacy}","received_events_url":"https://api.github.com/users/delner/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":430451605,"node_id":"MDU6TGFiZWw0MzA0NTE2MDU=","url":"https://api.github.com/repos/DataDog/dd-trace-rb/labels/bug","name":"bug","color":"ee0701","default":true},{"id":454754024,"node_id":"MDU6TGFiZWw0NTQ3NTQwMjQ=","url":"https://api.github.com/repos/DataDog/dd-trace-rb/labels/core","name":"core","color":"e39551","default":false}],"milestone":{"url":"https://api.github.com/repos/DataDog/dd-trace-rb/milestones/24","html_url":"https://github.com/DataDog/dd-trace-rb/milestone/24","labels_url":"https://api.github.com/repos/DataDog/dd-trace-rb/milestones/24/labels","id":3336311,"node_id":"MDk6TWlsZXN0b25lMzMzNjMxMQ==","number":24,"title":"0.12.1","description":"Patch release for the 0.12.x branch.","creator":{"login":"delner","id":3237131,"node_id":"MDQ6VXNlcjMyMzcxMzE=","avatar_url":"https://avatars1.githubusercontent.com/u/3237131?v=4","gravatar_id":"","url":"https://api.github.com/users/delner","html_url":"https://github.com/delner","followers_url":"https://api.github.com/users/delner/followers","following_url":"https://api.github.com/users/delner/following{/other_user}","gists_url":"https://api.github.com/users/delner/gists{/gist_id}","starred_url":"https://api.github.com/users/delner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delner/subscriptions","organizations_url":"https://api.github.com/users/delner/orgs","repos_url":"https://api.github.com/users/delner/repos","events_url":"https://api.github.com/users/delner/events{/privacy}","received_events_url":"https://api.github.com/users/delner/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":9,"state":"open","created_at":"2018-05-10T15:31:38Z","updated_at":"2018-06-11T19:35:06Z","due_on":"2018-06-12T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/DataDog/dd-trace-rb/pulls/446/commits","review_comments_url":"https://api.github.com/repos/DataDog/dd-trace-rb/pulls/446/comments","review_comment_url":"https://api.github.com/repos/DataDog/dd-trace-rb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DataDog/dd-trace-rb/issues/446/comments","statuses_url":"https://api.github.com/repos/DataDog/dd-trace-rb/statuses/2161915d18fdf2fde5e88d86aedcf10c36156394","head":{"label":"DataDog:bugfix/reduce_memory_footprint_and_gc_pressure","ref":"bugfix/reduce_memory_footprint_and_gc_pressure","sha":"2161915d18fdf2fde5e88d86aedcf10c36156394","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":66497320,"node_id":"MDEwOlJlcG9zaXRvcnk2NjQ5NzMyMA==","name":"dd-trace-rb","full_name":"DataDog/dd-trace-rb","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},"private":false,"html_url":"https://github.com/DataDog/dd-trace-rb","description":"Datadog Tracing Ruby Client","fork":false,"url":"https://api.github.com/repos/DataDog/dd-trace-rb","forks_url":"https://api.github.com/repos/DataDog/dd-trace-rb/forks","keys_url":"https://api.github.com/repos/DataDog/dd-trace-rb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataDog/dd-trace-rb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataDog/dd-trace-rb/teams","hooks_url":"https://api.github.com/repos/DataDog/dd-trace-rb/hooks","issue_events_url":"https://api.github.com/repos/DataDog/dd-trace-rb/issues/events{/number}","events_url":"https://api.github.com/repos/DataDog/dd-trace-rb/events","assignees_url":"https://api.github.com/repos/DataDog/dd-trace-rb/assignees{/user}","branches_url":"https://api.github.com/repos/DataDog/dd-trace-rb/branches{/branch}","tags_url":"https://api.github.com/repos/DataDog/dd-trace-rb/tags","blobs_url":"https://api.github.com/repos/DataDog/dd-trace-rb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataDog/dd-trace-rb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataDog/dd-trace-rb/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataDog/dd-trace-rb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataDog/dd-trace-rb/statuses/{sha}","languages_url":"https://api.github.com/repos/DataDog/dd-trace-rb/languages","stargazers_url":"https://api.github.com/repos/DataDog/dd-trace-rb/stargazers","contributors_url":"https://api.github.com/repos/DataDog/dd-trace-rb/contributors","subscribers_url":"https://api.github.com/repos/DataDog/dd-trace-rb/subscribers","subscription_url":"https://api.github.com/repos/DataDog/dd-trace-rb/subscription","commits_url":"https://api.github.com/repos/DataDog/dd-trace-rb/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataDog/dd-trace-rb/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataDog/dd-trace-rb/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataDog/dd-trace-rb/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataDog/dd-trace-rb/contents/{+path}","compare_url":"https://api.github.com/repos/DataDog/dd-trace-rb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataDog/dd-trace-rb/merges","archive_url":"https://api.github.com/repos/DataDog/dd-trace-rb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataDog/dd-trace-rb/downloads","issues_url":"https://api.github.com/repos/DataDog/dd-trace-rb/issues{/number}","pulls_url":"https://api.github.com/repos/DataDog/dd-trace-rb/pulls{/number}","milestones_url":"https://api.github.com/repos/DataDog/dd-trace-rb/milestones{/number}","notifications_url":"https://api.github.com/repos/DataDog/dd-trace-rb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataDog/dd-trace-rb/labels{/name}","releases_url":"https://api.github.com/repos/DataDog/dd-trace-rb/releases{/id}","deployments_url":"https://api.github.com/repos/DataDog/dd-trace-rb/deployments","created_at":"2016-08-24T20:30:56Z","updated_at":"2018-06-11T13:56:30Z","pushed_at":"2018-06-11T19:35:06Z","git_url":"git://github.com/DataDog/dd-trace-rb.git","ssh_url":"git@github.com:DataDog/dd-trace-rb.git","clone_url":"https://github.com/DataDog/dd-trace-rb.git","svn_url":"https://github.com/DataDog/dd-trace-rb","homepage":"https://docs.datadoghq.com/tracing/","size":2027,"stargazers_count":35,"watchers_count":35,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":72,"mirror_url":null,"archived":false,"open_issues_count":38,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":72,"open_issues":38,"watchers":35,"default_branch":"master"}},"base":{"label":"DataDog:master","ref":"master","sha":"b27cc3f26e3234f199cf92c6f5c2a0708bc29c43","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":66497320,"node_id":"MDEwOlJlcG9zaXRvcnk2NjQ5NzMyMA==","name":"dd-trace-rb","full_name":"DataDog/dd-trace-rb","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},"private":false,"html_url":"https://github.com/DataDog/dd-trace-rb","description":"Datadog Tracing Ruby Client","fork":false,"url":"https://api.github.com/repos/DataDog/dd-trace-rb","forks_url":"https://api.github.com/repos/DataDog/dd-trace-rb/forks","keys_url":"https://api.github.com/repos/DataDog/dd-trace-rb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataDog/dd-trace-rb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataDog/dd-trace-rb/teams","hooks_url":"https://api.github.com/repos/DataDog/dd-trace-rb/hooks","issue_events_url":"https://api.github.com/repos/DataDog/dd-trace-rb/issues/events{/number}","events_url":"https://api.github.com/repos/DataDog/dd-trace-rb/events","assignees_url":"https://api.github.com/repos/DataDog/dd-trace-rb/assignees{/user}","branches_url":"https://api.github.com/repos/DataDog/dd-trace-rb/branches{/branch}","tags_url":"https://api.github.com/repos/DataDog/dd-trace-rb/tags","blobs_url":"https://api.github.com/repos/DataDog/dd-trace-rb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataDog/dd-trace-rb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataDog/dd-trace-rb/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataDog/dd-trace-rb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataDog/dd-trace-rb/statuses/{sha}","languages_url":"https://api.github.com/repos/DataDog/dd-trace-rb/languages","stargazers_url":"https://api.github.com/repos/DataDog/dd-trace-rb/stargazers","contributors_url":"https://api.github.com/repos/DataDog/dd-trace-rb/contributors","subscribers_url":"https://api.github.com/repos/DataDog/dd-trace-rb/subscribers","subscription_url":"https://api.github.com/repos/DataDog/dd-trace-rb/subscription","commits_url":"https://api.github.com/repos/DataDog/dd-trace-rb/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataDog/dd-trace-rb/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataDog/dd-trace-rb/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataDog/dd-trace-rb/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataDog/dd-trace-rb/contents/{+path}","compare_url":"https://api.github.com/repos/DataDog/dd-trace-rb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataDog/dd-trace-rb/merges","archive_url":"https://api.github.com/repos/DataDog/dd-trace-rb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataDog/dd-trace-rb/downloads","issues_url":"https://api.github.com/repos/DataDog/dd-trace-rb/issues{/number}","pulls_url":"https://api.github.com/repos/DataDog/dd-trace-rb/pulls{/number}","milestones_url":"https://api.github.com/repos/DataDog/dd-trace-rb/milestones{/number}","notifications_url":"https://api.github.com/repos/DataDog/dd-trace-rb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataDog/dd-trace-rb/labels{/name}","releases_url":"https://api.github.com/repos/DataDog/dd-trace-rb/releases{/id}","deployments_url":"https://api.github.com/repos/DataDog/dd-trace-rb/deployments","created_at":"2016-08-24T20:30:56Z","updated_at":"2018-06-11T13:56:30Z","pushed_at":"2018-06-11T19:35:06Z","git_url":"git://github.com/DataDog/dd-trace-rb.git","ssh_url":"git@github.com:DataDog/dd-trace-rb.git","clone_url":"https://github.com/DataDog/dd-trace-rb.git","svn_url":"https://github.com/DataDog/dd-trace-rb","homepage":"https://docs.datadoghq.com/tracing/","size":2027,"stargazers_count":35,"watchers_count":35,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":72,"mirror_url":null,"archived":false,"open_issues_count":38,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":72,"open_issues":38,"watchers":35,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DataDog/dd-trace-rb/pulls/446"},"html":{"href":"https://github.com/DataDog/dd-trace-rb/pull/446"},"issue":{"href":"https://api.github.com/repos/DataDog/dd-trace-rb/issues/446"},"comments":{"href":"https://api.github.com/repos/DataDog/dd-trace-rb/issues/446/comments"},"review_comments":{"href":"https://api.github.com/repos/DataDog/dd-trace-rb/pulls/446/comments"},"review_comment":{"href":"https://api.github.com/repos/DataDog/dd-trace-rb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DataDog/dd-trace-rb/pulls/446/commits"},"statuses":{"href":"https://api.github.com/repos/DataDog/dd-trace-rb/statuses/2161915d18fdf2fde5e88d86aedcf10c36156394"}},"author_association":"CONTRIBUTOR","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"delner","id":3237131,"node_id":"MDQ6VXNlcjMyMzcxMzE=","avatar_url":"https://avatars1.githubusercontent.com/u/3237131?v=4","gravatar_id":"","url":"https://api.github.com/users/delner","html_url":"https://github.com/delner","followers_url":"https://api.github.com/users/delner/followers","following_url":"https://api.github.com/users/delner/following{/other_user}","gists_url":"https://api.github.com/users/delner/gists{/gist_id}","starred_url":"https://api.github.com/users/delner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delner/subscriptions","organizations_url":"https://api.github.com/users/delner/orgs","repos_url":"https://api.github.com/users/delner/repos","events_url":"https://api.github.com/users/delner/events{/privacy}","received_events_url":"https://api.github.com/users/delner/received_events","type":"User","site_admin":false},"comments":3,"review_comments":0,"maintainer_can_modify":false,"commits":12,"additions":35,"deletions":23,"changed_files":5}}
{"actor":{"display_login":"delner"}}