{"action":"created","issue":{"url":"https://api.github.com/repos/Netflix/servo/issues/227","repository_url":"https://api.github.com/repos/Netflix/servo","labels_url":"https://api.github.com/repos/Netflix/servo/issues/227/labels{/name}","comments_url":"https://api.github.com/repos/Netflix/servo/issues/227/comments","events_url":"https://api.github.com/repos/Netflix/servo/issues/227/events","html_url":"https://github.com/Netflix/servo/issues/227","id":29106786,"number":227,"title":"Min/Max Gauge as part of BucketTimer should be initialized before polling","user":{"login":"DaniHub1","id":6500349,"avatar_url":"https://avatars.githubusercontent.com/u/6500349?v=3","gravatar_id":"","url":"https://api.github.com/users/DaniHub1","html_url":"https://github.com/DaniHub1","followers_url":"https://api.github.com/users/DaniHub1/followers","following_url":"https://api.github.com/users/DaniHub1/following{/other_user}","gists_url":"https://api.github.com/users/DaniHub1/gists{/gist_id}","starred_url":"https://api.github.com/users/DaniHub1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DaniHub1/subscriptions","organizations_url":"https://api.github.com/users/DaniHub1/orgs","repos_url":"https://api.github.com/users/DaniHub1/repos","events_url":"https://api.github.com/users/DaniHub1/events{/privacy}","received_events_url":"https://api.github.com/users/DaniHub1/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2014-03-10T15:56:08Z","updated_at":"2016-05-18T22:53:14Z","closed_at":"2014-03-11T17:16:27Z","body":"Hi,\r\naccording to the 'reademe' document, BucketTimer should behave as follows:\r\n\r\n\"Assuming in the above code that the getRecommendations() method was called 7 times, and the values reported were: 49ms, 40ms, 400ms, 50ms, 500ms, 2000ms, 501ms. The following metrics would be available:\r\nname=getRecommendations statistic=totalTime (49 + 40 + 400 + 50 + 500 + 2000) value=3039\r\nname=getRecommendations statistic=min value=40\r\nname=getRecommendations statistic=max value=2000\"\r\n\r\nIt should be working well when sending raw stats, but when updating stats as Rates, as I figure, the Min/Max gauges should be initialized before every observer update (before every poll). \r\nOtherwise their value does not reflect the min/max time for the last minute, but from the monitor creation date. \r\nCounterToRateMetricTransform handles only Counter type, and its reasonable, but should handle Min/Max gauges as well, as they are updated in a method call, just like Counters.\r\nSo back to the above example. assuming that in the last observer update the Min value was 10, the next call (after the update ) to getRecommendations()  will leave the Min value on 10, even though the Min time that the API last in the last minute(or other polling unit-time) was 40.\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/Netflix/servo/issues/comments/220181775","html_url":"https://github.com/Netflix/servo/issues/227#issuecomment-220181775","issue_url":"https://api.github.com/repos/Netflix/servo/issues/227","id":220181775,"user":{"login":"alexhilman","id":238261,"avatar_url":"https://avatars.githubusercontent.com/u/238261?v=3","gravatar_id":"","url":"https://api.github.com/users/alexhilman","html_url":"https://github.com/alexhilman","followers_url":"https://api.github.com/users/alexhilman/followers","following_url":"https://api.github.com/users/alexhilman/following{/other_user}","gists_url":"https://api.github.com/users/alexhilman/gists{/gist_id}","starred_url":"https://api.github.com/users/alexhilman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexhilman/subscriptions","organizations_url":"https://api.github.com/users/alexhilman/orgs","repos_url":"https://api.github.com/users/alexhilman/repos","events_url":"https://api.github.com/users/alexhilman/events{/privacy}","received_events_url":"https://api.github.com/users/alexhilman/received_events","type":"User","site_admin":false},"created_at":"2016-05-18T22:53:14Z","updated_at":"2016-05-18T22:53:14Z","body":"Hello,\r\n\r\nI am encountering the same seemingly strange (or unexpected values) when publishing metrics.\r\n\r\nThere seems to be a discrepancy (or at least a point of confusion) between the documentation and the results when referring to Timer's statistics of `count` and `totalTime`.\r\n\r\nThe wiki says the following about a `BasicTimer`:\r\n> A `BasicTimer` is a composite monitor that generates four metrics per polling interval:\r\n> ...\r\n> * The total time recorded. `statistic=totalTime`\r\n> * The number of times the event has been recorded. `statistic=count`\r\n\r\nAs it is referring to metrics I assume it means generation of `com.netflix.servo.Metric` objects. Furthermore the listed example on the wiki is stated as such:\r\n> Assuming doSomething() was called twice and the recorded times were 5ms and 15ms the following metrics will be generated:\r\n>\r\n> name=doSomething statistic=totalTime value=20\r\n> name=doSomething statistic=count value=2\r\n\r\nWhen testing these statistics directly on the `BasicTimer` instance the values are as expected (`totalTime` = 20 and `count` = 2). However when gathering the metrics on a polling schedule the metrics are _not_ as expected and they don't line up with the documentation I have found. The values in the `Metric` updates are `totalTime` = 0.333333333 and `count` = 0.033333333.\r\n\r\nJust an FYI - this issue caused some headaches."}}