{"action":"created","comment":{"url":"https://api.github.com/repos/DataDog/dd-agent/pulls/comments/134216828","pull_request_review_id":57482030,"id":134216828,"diff_hunk":"@@ -175,8 +175,7 @@ def check(self, agentConfig, move_end=True):\n             self._events = []\n \n             # Build our tail -f\n-            if self._gen is None:\n-                self._gen = TailFile(self.logger, self.log_path, self._line_parser).tail(line_by_line=False, move_end=move_end)\n+            self._gen = TailFile(self.logger, self.log_path, self._line_parser).tail(line_by_line=False, move_end=move_end)","path":"checks/datadog.py","position":6,"original_position":6,"commit_id":"f6d935ca67c1d68ef85f1a8217f5ec144a38c0fd","original_commit_id":"f6d935ca67c1d68ef85f1a8217f5ec144a38c0fd","user":{"login":"truthbk","id":448216,"avatar_url":"https://avatars0.githubusercontent.com/u/448216?v=4","gravatar_id":"","url":"https://api.github.com/users/truthbk","html_url":"https://github.com/truthbk","followers_url":"https://api.github.com/users/truthbk/followers","following_url":"https://api.github.com/users/truthbk/following{/other_user}","gists_url":"https://api.github.com/users/truthbk/gists{/gist_id}","starred_url":"https://api.github.com/users/truthbk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/truthbk/subscriptions","organizations_url":"https://api.github.com/users/truthbk/orgs","repos_url":"https://api.github.com/users/truthbk/repos","events_url":"https://api.github.com/users/truthbk/events{/privacy}","received_events_url":"https://api.github.com/users/truthbk/received_events","type":"User","site_admin":false},"body":"I don't think we need to create a TailFile object every iteration, probably just make sure we call `tail()`.... Can we look into doing that properly? The way I see it maybe that should just be in the constructor.... Let me know if you see problems with that approach.","created_at":"2017-08-21T12:14:32Z","updated_at":"2017-08-21T12:14:49Z","html_url":"https://github.com/DataDog/dd-agent/pull/3480#discussion_r134216828","pull_request_url":"https://api.github.com/repos/DataDog/dd-agent/pulls/3480","_links":{"self":{"href":"https://api.github.com/repos/DataDog/dd-agent/pulls/comments/134216828"},"html":{"href":"https://github.com/DataDog/dd-agent/pull/3480#discussion_r134216828"},"pull_request":{"href":"https://api.github.com/repos/DataDog/dd-agent/pulls/3480"}}},"pull_request":{"url":"https://api.github.com/repos/DataDog/dd-agent/pulls/3480","id":136630124,"html_url":"https://github.com/DataDog/dd-agent/pull/3480","diff_url":"https://github.com/DataDog/dd-agent/pull/3480.diff","patch_url":"https://github.com/DataDog/dd-agent/pull/3480.patch","issue_url":"https://api.github.com/repos/DataDog/dd-agent/issues/3480","number":3480,"state":"open","locked":false,"title":"Dogstreams check for log file on each iteration","user":{"login":"nmuesch","id":8941884,"avatar_url":"https://avatars0.githubusercontent.com/u/8941884?v=4","gravatar_id":"","url":"https://api.github.com/users/nmuesch","html_url":"https://github.com/nmuesch","followers_url":"https://api.github.com/users/nmuesch/followers","following_url":"https://api.github.com/users/nmuesch/following{/other_user}","gists_url":"https://api.github.com/users/nmuesch/gists{/gist_id}","starred_url":"https://api.github.com/users/nmuesch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nmuesch/subscriptions","organizations_url":"https://api.github.com/users/nmuesch/orgs","repos_url":"https://api.github.com/users/nmuesch/repos","events_url":"https://api.github.com/users/nmuesch/events{/privacy}","received_events_url":"https://api.github.com/users/nmuesch/received_events","type":"User","site_admin":false},"body":"Re-open file on each check of dogstreams\r\n\r\n*Note: Please remember to review the Datadog [Contribution Guidelines](https://github.com/DataDog/dd-agent/blob/master/CONTRIBUTING.md)\r\nif you have not yet done so.*\r\n\r\n### What does this PR do?\r\n\r\nRemoves the check to see if the tail object is None. Ensures that we build the tailFile object each time the check is run. That way the file can be created after the Agent starts. Before this, the file dogstreams it tailing needed to be created prior to the Agent starting up, or else it needed to be restarted after file creation. \r\n\r\n### Motivation\r\n\r\nCustomer Requested\r\n\r\n### Testing Guidelines\r\n\r\nAn overview on [testing](https://github.com/DataDog/dd-agent/blob/master/tests/README.md)\r\nis available in our contribution guidelines.\r\n\r\n### Additional Notes\r\n\r\nIt looks like the file is closed if already open in the TailFile class, and I've looked on a test machine and there doesn't seem to be any fd leak for the ddagent process. But perhaps we should explicitly close this elsewhere? Before we only were calling that tail function (which opens the specified log file) once, now we call it at each check iteration.","created_at":"2017-08-20T04:13:04Z","updated_at":"2017-08-21T12:14:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a13b319131544cf1d6d1d1fb2c7127da87b8574c","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/DataDog/dd-agent/pulls/3480/commits","review_comments_url":"https://api.github.com/repos/DataDog/dd-agent/pulls/3480/comments","review_comment_url":"https://api.github.com/repos/DataDog/dd-agent/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DataDog/dd-agent/issues/3480/comments","statuses_url":"https://api.github.com/repos/DataDog/dd-agent/statuses/f6d935ca67c1d68ef85f1a8217f5ec144a38c0fd","head":{"label":"DataDog:nick/dogstreams_check_file_each_iteration","ref":"nick/dogstreams_check_file_each_iteration","sha":"f6d935ca67c1d68ef85f1a8217f5ec144a38c0fd","user":{"login":"DataDog","id":365230,"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":1210071,"name":"dd-agent","full_name":"DataDog/dd-agent","owner":{"login":"DataDog","id":365230,"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-agent","description":"Datadog Agent","fork":false,"url":"https://api.github.com/repos/DataDog/dd-agent","forks_url":"https://api.github.com/repos/DataDog/dd-agent/forks","keys_url":"https://api.github.com/repos/DataDog/dd-agent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataDog/dd-agent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataDog/dd-agent/teams","hooks_url":"https://api.github.com/repos/DataDog/dd-agent/hooks","issue_events_url":"https://api.github.com/repos/DataDog/dd-agent/issues/events{/number}","events_url":"https://api.github.com/repos/DataDog/dd-agent/events","assignees_url":"https://api.github.com/repos/DataDog/dd-agent/assignees{/user}","branches_url":"https://api.github.com/repos/DataDog/dd-agent/branches{/branch}","tags_url":"https://api.github.com/repos/DataDog/dd-agent/tags","blobs_url":"https://api.github.com/repos/DataDog/dd-agent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataDog/dd-agent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataDog/dd-agent/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataDog/dd-agent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataDog/dd-agent/statuses/{sha}","languages_url":"https://api.github.com/repos/DataDog/dd-agent/languages","stargazers_url":"https://api.github.com/repos/DataDog/dd-agent/stargazers","contributors_url":"https://api.github.com/repos/DataDog/dd-agent/contributors","subscribers_url":"https://api.github.com/repos/DataDog/dd-agent/subscribers","subscription_url":"https://api.github.com/repos/DataDog/dd-agent/subscription","commits_url":"https://api.github.com/repos/DataDog/dd-agent/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataDog/dd-agent/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataDog/dd-agent/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataDog/dd-agent/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataDog/dd-agent/contents/{+path}","compare_url":"https://api.github.com/repos/DataDog/dd-agent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataDog/dd-agent/merges","archive_url":"https://api.github.com/repos/DataDog/dd-agent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataDog/dd-agent/downloads","issues_url":"https://api.github.com/repos/DataDog/dd-agent/issues{/number}","pulls_url":"https://api.github.com/repos/DataDog/dd-agent/pulls{/number}","milestones_url":"https://api.github.com/repos/DataDog/dd-agent/milestones{/number}","notifications_url":"https://api.github.com/repos/DataDog/dd-agent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataDog/dd-agent/labels{/name}","releases_url":"https://api.github.com/repos/DataDog/dd-agent/releases{/id}","deployments_url":"https://api.github.com/repos/DataDog/dd-agent/deployments","created_at":"2010-12-31T03:02:47Z","updated_at":"2017-08-17T20:11:56Z","pushed_at":"2017-08-21T12:06:01Z","git_url":"git://github.com/DataDog/dd-agent.git","ssh_url":"git@github.com:DataDog/dd-agent.git","clone_url":"https://github.com/DataDog/dd-agent.git","svn_url":"https://github.com/DataDog/dd-agent","homepage":"https://docs.datadoghq.com/","size":42902,"stargazers_count":885,"watchers_count":885,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":true,"has_pages":true,"forks_count":752,"mirror_url":null,"open_issues_count":210,"forks":752,"open_issues":210,"watchers":885,"default_branch":"master"}},"base":{"label":"DataDog:master","ref":"master","sha":"e1edf23d727b3f466489a7f4b6775c9063e05bc7","user":{"login":"DataDog","id":365230,"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":1210071,"name":"dd-agent","full_name":"DataDog/dd-agent","owner":{"login":"DataDog","id":365230,"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-agent","description":"Datadog Agent","fork":false,"url":"https://api.github.com/repos/DataDog/dd-agent","forks_url":"https://api.github.com/repos/DataDog/dd-agent/forks","keys_url":"https://api.github.com/repos/DataDog/dd-agent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataDog/dd-agent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataDog/dd-agent/teams","hooks_url":"https://api.github.com/repos/DataDog/dd-agent/hooks","issue_events_url":"https://api.github.com/repos/DataDog/dd-agent/issues/events{/number}","events_url":"https://api.github.com/repos/DataDog/dd-agent/events","assignees_url":"https://api.github.com/repos/DataDog/dd-agent/assignees{/user}","branches_url":"https://api.github.com/repos/DataDog/dd-agent/branches{/branch}","tags_url":"https://api.github.com/repos/DataDog/dd-agent/tags","blobs_url":"https://api.github.com/repos/DataDog/dd-agent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataDog/dd-agent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataDog/dd-agent/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataDog/dd-agent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataDog/dd-agent/statuses/{sha}","languages_url":"https://api.github.com/repos/DataDog/dd-agent/languages","stargazers_url":"https://api.github.com/repos/DataDog/dd-agent/stargazers","contributors_url":"https://api.github.com/repos/DataDog/dd-agent/contributors","subscribers_url":"https://api.github.com/repos/DataDog/dd-agent/subscribers","subscription_url":"https://api.github.com/repos/DataDog/dd-agent/subscription","commits_url":"https://api.github.com/repos/DataDog/dd-agent/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataDog/dd-agent/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataDog/dd-agent/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataDog/dd-agent/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataDog/dd-agent/contents/{+path}","compare_url":"https://api.github.com/repos/DataDog/dd-agent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataDog/dd-agent/merges","archive_url":"https://api.github.com/repos/DataDog/dd-agent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataDog/dd-agent/downloads","issues_url":"https://api.github.com/repos/DataDog/dd-agent/issues{/number}","pulls_url":"https://api.github.com/repos/DataDog/dd-agent/pulls{/number}","milestones_url":"https://api.github.com/repos/DataDog/dd-agent/milestones{/number}","notifications_url":"https://api.github.com/repos/DataDog/dd-agent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataDog/dd-agent/labels{/name}","releases_url":"https://api.github.com/repos/DataDog/dd-agent/releases{/id}","deployments_url":"https://api.github.com/repos/DataDog/dd-agent/deployments","created_at":"2010-12-31T03:02:47Z","updated_at":"2017-08-17T20:11:56Z","pushed_at":"2017-08-21T12:06:01Z","git_url":"git://github.com/DataDog/dd-agent.git","ssh_url":"git@github.com:DataDog/dd-agent.git","clone_url":"https://github.com/DataDog/dd-agent.git","svn_url":"https://github.com/DataDog/dd-agent","homepage":"https://docs.datadoghq.com/","size":42902,"stargazers_count":885,"watchers_count":885,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":true,"has_pages":true,"forks_count":752,"mirror_url":null,"open_issues_count":210,"forks":752,"open_issues":210,"watchers":885,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DataDog/dd-agent/pulls/3480"},"html":{"href":"https://github.com/DataDog/dd-agent/pull/3480"},"issue":{"href":"https://api.github.com/repos/DataDog/dd-agent/issues/3480"},"comments":{"href":"https://api.github.com/repos/DataDog/dd-agent/issues/3480/comments"},"review_comments":{"href":"https://api.github.com/repos/DataDog/dd-agent/pulls/3480/comments"},"review_comment":{"href":"https://api.github.com/repos/DataDog/dd-agent/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DataDog/dd-agent/pulls/3480/commits"},"statuses":{"href":"https://api.github.com/repos/DataDog/dd-agent/statuses/f6d935ca67c1d68ef85f1a8217f5ec144a38c0fd"}}}}
{"actor":{"display_login":"truthbk"}}