{"action":"created","issue":{"url":"https://api.github.com/repos/prometheus/client_golang/issues/509","repository_url":"https://api.github.com/repos/prometheus/client_golang","labels_url":"https://api.github.com/repos/prometheus/client_golang/issues/509/labels{/name}","comments_url":"https://api.github.com/repos/prometheus/client_golang/issues/509/comments","events_url":"https://api.github.com/repos/prometheus/client_golang/issues/509/events","html_url":"https://github.com/prometheus/client_golang/issues/509","id":384114556,"node_id":"MDU6SXNzdWUzODQxMTQ1NTY=","number":509,"title":"Timer.ObserveDuration should returned the observed duration","user":{"login":"eklitzke","id":2734,"node_id":"MDQ6VXNlcjI3MzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/2734?v=4","gravatar_id":"","url":"https://api.github.com/users/eklitzke","html_url":"https://github.com/eklitzke","followers_url":"https://api.github.com/users/eklitzke/followers","following_url":"https://api.github.com/users/eklitzke/following{/other_user}","gists_url":"https://api.github.com/users/eklitzke/gists{/gist_id}","starred_url":"https://api.github.com/users/eklitzke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eklitzke/subscriptions","organizations_url":"https://api.github.com/users/eklitzke/orgs","repos_url":"https://api.github.com/users/eklitzke/repos","events_url":"https://api.github.com/users/eklitzke/events{/privacy}","received_events_url":"https://api.github.com/users/eklitzke/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-25T20:21:57Z","updated_at":"2018-11-26T12:32:31Z","closed_at":null,"author_association":"NONE","body":"The following usage example is given in the docs:\r\n```go\r\nfunc TimeMe() {\r\n    timer := NewTimer(myHistogram)\r\n    defer timer.ObserveDuration()\r\n    // Do actual work.\r\n}\r\n```\r\n\r\nI find that I typically want to also emit durations in log statements. Therefore it would be useful if `ObserveDuration()` returned the observed duration (probably as a `time.Duration`, but I could see a case being made for the value as a `float64`), which would allow code like the following:\r\n\r\n```go\r\nfunc TimeMe() {\r\n    timer := NewTimer(myHistogram)\r\n    defer func() { log.Printf(\"finished in %f seconds\", timer.ObserveDuration().Seconds()) }()\r\n    // Do actual work.\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/prometheus/client_golang/issues/comments/441623053","html_url":"https://github.com/prometheus/client_golang/issues/509#issuecomment-441623053","issue_url":"https://api.github.com/repos/prometheus/client_golang/issues/509","id":441623053,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MTYyMzA1Mw==","user":{"login":"beorn7","id":5609886,"node_id":"MDQ6VXNlcjU2MDk4ODY=","avatar_url":"https://avatars3.githubusercontent.com/u/5609886?v=4","gravatar_id":"","url":"https://api.github.com/users/beorn7","html_url":"https://github.com/beorn7","followers_url":"https://api.github.com/users/beorn7/followers","following_url":"https://api.github.com/users/beorn7/following{/other_user}","gists_url":"https://api.github.com/users/beorn7/gists{/gist_id}","starred_url":"https://api.github.com/users/beorn7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beorn7/subscriptions","organizations_url":"https://api.github.com/users/beorn7/orgs","repos_url":"https://api.github.com/users/beorn7/repos","events_url":"https://api.github.com/users/beorn7/events{/privacy}","received_events_url":"https://api.github.com/users/beorn7/received_events","type":"User","site_admin":false},"created_at":"2018-11-26T12:32:31Z","updated_at":"2018-11-26T12:32:31Z","author_association":"MEMBER","body":"Sounds like a convenient and reasonable thing to do. And easy to implement. :o)"}}
{"actor":{"display_login":"beorn7"}}