{"action":"created","comment":{"url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/comments/92001461","pull_request_review_id":12511010,"id":92001461,"diff_hunk":"@@ -22,8 +23,81 @@ public interface IFunctionInstanceBaseEntry\n         string FunctionName { get; }\n \n         /// <summary>\n+        /// If present, this is the UTC expiration time for the heartbeat. \n+        /// If this is greater than the current time, then assume the function was abandoned (NeverFinished), \n+        /// else assume the function is still running. \n+        /// </summary>\n+        DateTime? FunctionInstanceHeartbeatExpiry { get; }\n+\n+        /// <summary>UTC time that the function started executing.</summary>\n+        DateTime StartTime { get; }\n+\n+        /// <summary>If set, the time the function completed (either successfully or failure). </summary>\n+        DateTime? EndTime { get;  }\n+\n+        /// <summary>\n+        /// Function completed with error. \n+        /// </summary>\n+        bool HasError { get; }\n+    }\n+\n+    /// <summary>\n+    /// </summary>\n+    public static class IFunctionInstanceBaseEntryExtensions\n+    {\n+        /// <summary>\n         /// Current status of this instance. \n+        /// We specifically infer the status from the other fields rather than explicitly include status \n+        /// so that we don't duplicate state. \n         /// </summary>\n-        FunctionInstanceStatus Status { get; }\n-    } \n+        public static FunctionInstanceStatus GetStatus(this IFunctionInstanceBaseEntry item)\n+        {\n+            if (item.IsCompleted())","path":"src/Microsoft.Azure.WebJobs.Logging/IFunctionInstanceBaseEntry.cs","position":45,"original_position":45,"commit_id":"4095a260e0476e40c9692e1a53febcb9367e9e2b","original_commit_id":"4095a260e0476e40c9692e1a53febcb9367e9e2b","user":{"login":"MikeStall","id":1538900,"avatar_url":"https://avatars.githubusercontent.com/u/1538900?v=3","gravatar_id":"","url":"https://api.github.com/users/MikeStall","html_url":"https://github.com/MikeStall","followers_url":"https://api.github.com/users/MikeStall/followers","following_url":"https://api.github.com/users/MikeStall/following{/other_user}","gists_url":"https://api.github.com/users/MikeStall/gists{/gist_id}","starred_url":"https://api.github.com/users/MikeStall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MikeStall/subscriptions","organizations_url":"https://api.github.com/users/MikeStall/orgs","repos_url":"https://api.github.com/users/MikeStall/repos","events_url":"https://api.github.com/users/MikeStall/events{/privacy}","received_events_url":"https://api.github.com/users/MikeStall/received_events","type":"User","site_admin":false},"body":"Yes. See LoggerTests.cs StatusTest. \r\n\r\n---\r\nIn reply to: [91567469](https://github.com/Azure/azure-webjobs-sdk/pull/928#discussion_r91567469) [](ancestors = 91567469)","created_at":"2016-12-12T17:54:03Z","updated_at":"2016-12-12T17:54:03Z","html_url":"https://github.com/Azure/azure-webjobs-sdk/pull/928#discussion_r92001461","pull_request_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/928","_links":{"self":{"href":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/comments/92001461"},"html":{"href":"https://github.com/Azure/azure-webjobs-sdk/pull/928#discussion_r92001461"},"pull_request":{"href":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/928"}}},"pull_request":{"url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/928","id":95955962,"html_url":"https://github.com/Azure/azure-webjobs-sdk/pull/928","diff_url":"https://github.com/Azure/azure-webjobs-sdk/pull/928.diff","patch_url":"https://github.com/Azure/azure-webjobs-sdk/pull/928.patch","issue_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues/928","number":928,"state":"open","locked":false,"title":"Fix https://github.com/Azure/azure-webjobs-sdk/issues/916","user":{"login":"MikeStall","id":1538900,"avatar_url":"https://avatars.githubusercontent.com/u/1538900?v=3","gravatar_id":"","url":"https://api.github.com/users/MikeStall","html_url":"https://github.com/MikeStall","followers_url":"https://api.github.com/users/MikeStall/followers","following_url":"https://api.github.com/users/MikeStall/following{/other_user}","gists_url":"https://api.github.com/users/MikeStall/gists{/gist_id}","starred_url":"https://api.github.com/users/MikeStall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MikeStall/subscriptions","organizations_url":"https://api.github.com/users/MikeStall/orgs","repos_url":"https://api.github.com/users/MikeStall/repos","events_url":"https://api.github.com/users/MikeStall/events{/privacy}","received_events_url":"https://api.github.com/users/MikeStall/received_events","type":"User","site_admin":false},"body":"If a function is terminated, don't leave the function status orphaned as \"Running\".\r\nAdd Heartbeat, and then we can tell the difference between \"IsRunning\" and \"NeverFinished\"\r\n\r\nHeartbeat is written on the same thread that writes to the existing entities. This avoids a category of evil race conditions where multiple threads update the same entity.\r\n\r\nGive FunctionInstanceLogItem a  Refresh() that gets called for heart beats. That hook could also be used to do live parameter updates.\r\n\r\nWe need to plumb this through both the Function instance and Recent instance index.\r\nAlso expose plumb through to expose in existing portal UI.\r\n\r\nSwitch from DateTimeOffset to UTC DateTime. (These serialize the same way in Azure tables, so not a breaking change)\r\n\r\nDon't serialize Status anymore. Instead, compute status based on other properties.\r\n1. This avoids redundancy (Where status and other props were inconsistent),\r\n2. It's more condusive to changing status.\r\n\r\nMake some more types non-public. They were only public for unit testing, and the tests are now internalsVisibleTo\r\n\r\nSignificant improvement in unit test.","created_at":"2016-11-30T19:21:01Z","updated_at":"2016-12-12T17:54:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"00aadd0a1e0437547ae7d234593504871d2587a1","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/928/commits","review_comments_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/928/comments","review_comment_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues/928/comments","statuses_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/statuses/4095a260e0476e40c9692e1a53febcb9367e9e2b","head":{"label":"Azure:heartbeat","ref":"heartbeat","sha":"4095a260e0476e40c9692e1a53febcb9367e9e2b","user":{"login":"Azure","id":6844498,"avatar_url":"https://avatars.githubusercontent.com/u/6844498?v=3","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"repo":{"id":21712185,"name":"azure-webjobs-sdk","full_name":"Azure/azure-webjobs-sdk","owner":{"login":"Azure","id":6844498,"avatar_url":"https://avatars.githubusercontent.com/u/6844498?v=3","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Azure/azure-webjobs-sdk","description":"Azure WebJobs SDK","fork":false,"url":"https://api.github.com/repos/Azure/azure-webjobs-sdk","forks_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/forks","keys_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/teams","hooks_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/hooks","issue_events_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/events","assignees_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/tags","blobs_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/languages","stargazers_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/stargazers","contributors_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/contributors","subscribers_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/subscribers","subscription_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/subscription","commits_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/merges","archive_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/downloads","issues_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/labels{/name}","releases_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/deployments","created_at":"2014-07-10T22:15:31Z","updated_at":"2016-12-05T10:15:57Z","pushed_at":"2016-12-09T18:59:19Z","git_url":"git://github.com/Azure/azure-webjobs-sdk.git","ssh_url":"git@github.com:Azure/azure-webjobs-sdk.git","clone_url":"https://github.com/Azure/azure-webjobs-sdk.git","svn_url":"https://github.com/Azure/azure-webjobs-sdk","homepage":"","size":12571,"stargazers_count":159,"watchers_count":159,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":75,"mirror_url":null,"open_issues_count":212,"forks":75,"open_issues":212,"watchers":159,"default_branch":"dev"}},"base":{"label":"Azure:dev","ref":"dev","sha":"9a9956ba94adea8c29681562cf410a951f1e703b","user":{"login":"Azure","id":6844498,"avatar_url":"https://avatars.githubusercontent.com/u/6844498?v=3","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"repo":{"id":21712185,"name":"azure-webjobs-sdk","full_name":"Azure/azure-webjobs-sdk","owner":{"login":"Azure","id":6844498,"avatar_url":"https://avatars.githubusercontent.com/u/6844498?v=3","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Azure/azure-webjobs-sdk","description":"Azure WebJobs SDK","fork":false,"url":"https://api.github.com/repos/Azure/azure-webjobs-sdk","forks_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/forks","keys_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/teams","hooks_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/hooks","issue_events_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/events","assignees_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/tags","blobs_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/languages","stargazers_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/stargazers","contributors_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/contributors","subscribers_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/subscribers","subscription_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/subscription","commits_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/merges","archive_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/downloads","issues_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/labels{/name}","releases_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/deployments","created_at":"2014-07-10T22:15:31Z","updated_at":"2016-12-05T10:15:57Z","pushed_at":"2016-12-09T18:59:19Z","git_url":"git://github.com/Azure/azure-webjobs-sdk.git","ssh_url":"git@github.com:Azure/azure-webjobs-sdk.git","clone_url":"https://github.com/Azure/azure-webjobs-sdk.git","svn_url":"https://github.com/Azure/azure-webjobs-sdk","homepage":"","size":12571,"stargazers_count":159,"watchers_count":159,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":75,"mirror_url":null,"open_issues_count":212,"forks":75,"open_issues":212,"watchers":159,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/928"},"html":{"href":"https://github.com/Azure/azure-webjobs-sdk/pull/928"},"issue":{"href":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues/928"},"comments":{"href":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues/928/comments"},"review_comments":{"href":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/928/comments"},"review_comment":{"href":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/928/commits"},"statuses":{"href":"https://api.github.com/repos/Azure/azure-webjobs-sdk/statuses/4095a260e0476e40c9692e1a53febcb9367e9e2b"}}}}
{"actor":{"display_login":"MikeStall"}}