{"action":"created","issue":{"url":"https://api.github.com/repos/influxdata/telegraf/issues/959","repository_url":"https://api.github.com/repos/influxdata/telegraf","labels_url":"https://api.github.com/repos/influxdata/telegraf/issues/959/labels{/name}","comments_url":"https://api.github.com/repos/influxdata/telegraf/issues/959/comments","events_url":"https://api.github.com/repos/influxdata/telegraf/issues/959/events","html_url":"https://github.com/influxdata/telegraf/pull/959","id":145642036,"number":959,"title":"Use timeout smaller than 10 seconds","user":{"login":"PierreF","id":359833,"avatar_url":"https://avatars.githubusercontent.com/u/359833?v=3","gravatar_id":"","url":"https://api.github.com/users/PierreF","html_url":"https://github.com/PierreF","followers_url":"https://api.github.com/users/PierreF/followers","following_url":"https://api.github.com/users/PierreF/following{/other_user}","gists_url":"https://api.github.com/users/PierreF/gists{/gist_id}","starred_url":"https://api.github.com/users/PierreF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PierreF/subscriptions","organizations_url":"https://api.github.com/users/PierreF/orgs","repos_url":"https://api.github.com/users/PierreF/repos","events_url":"https://api.github.com/users/PierreF/events{/privacy}","received_events_url":"https://api.github.com/users/PierreF/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-04T10:18:28Z","updated_at":"2016-04-04T12:36:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/influxdata/telegraf/pulls/959","html_url":"https://github.com/influxdata/telegraf/pull/959","diff_url":"https://github.com/influxdata/telegraf/pull/959.diff","patch_url":"https://github.com/influxdata/telegraf/pull/959.patch"},"body":"Mongo and Prometheus use timeout of 10 seconds. At least with Mongo, 10 seconds timeout raise strange behavior, probably because metrics collection took more time than the metric collection interval (10 second - default config):\r\n\r\nData wrote by telegraf are no longer \"rounded\" to 10 seconds and create hole if you round them using group by time(10s)\r\nsecond:\r\n```\r\n> select usage_idle from cpu where cpu='cpu-total' and time >= '2016-04-04T09:56:37Z' and time <= '2016-04-04T09:57:23Z'\r\nname: cpu\r\n---------\r\ntime                    usage_idle\r\n2016-04-04T09:56:37Z     88.7699366396944\r\n2016-04-04T09:56:49Z     84.20123565754106\r\n2016-04-04T09:57:00Z     86.28820960698596\r\n2016-04-04T09:57:12Z     85.76434515993311\r\n2016-04-04T09:57:23Z     82.51209854815667\r\n\r\n> select mean(usage_idle) from cpu where cpu='cpu-total' and time >= '2016-04-04T09:56:37Z' and time <= '2016-04-04T09:57:23Z'  group by time(10s)\r\nname: cpu\r\n---------\r\ntime                    mean\r\n2016-04-04T09:56:30Z     88.7699366396944\r\n2016-04-04T09:56:40Z     84.20123565754106\r\n2016-04-04T09:56:50Z\r\n2016-04-04T09:57:00Z     86.28820960698596\r\n2016-04-04T09:57:10Z     85.76434515993311\r\n2016-04-04T09:57:20Z     82.51209854815667\r\n```\r\n\r\nTelegraf logs:\r\n```\r\n2016/04/04 11:55:31 Starting Telegraf (version 0.11.1-75-g357849c)\r\n[...]\r\n2016/04/04 11:56:40 Wrote 35 metrics to output influxdb in 5.402099ms\r\nerror dialing over ssl, no reachable servers\r\n2016/04/04 11:56:49 Error in input [mongodb]: Unable to connect to MongoDB, no reachable servers\r\n2016/04/04 11:56:49 Gathered metrics, (10s interval), from 11 inputs in 11.507262321s\r\n2016/04/04 11:56:50 Wrote 35 metrics to output influxdb in 4.578914ms\r\nerror dialing over ssl, no reachable servers\r\n2016/04/04 11:57:00 Error in input [mongodb]: Unable to connect to MongoDB, no reachable servers\r\n2016/04/04 11:57:00 Gathered metrics, (10s interval), from 11 inputs in 11.513853869s\r\n[NOTE: no data wrote at 11:57:00]\r\n2016/04/04 11:57:10 Wrote 35 metrics to output influxdb in 4.51493ms\r\n```\r\n\r\nThis PR use a slightly smaller timeout (8 seconds) which make Telegraf behave as usual: datapoint sent every 10 second and rounded to tenth of seconds (0, 10, 20, ...).\r\n"},"comment":{"url":"https://api.github.com/repos/influxdata/telegraf/issues/comments/205279178","html_url":"https://github.com/influxdata/telegraf/pull/959#issuecomment-205279178","issue_url":"https://api.github.com/repos/influxdata/telegraf/issues/959","id":205279178,"user":{"login":"PierreF","id":359833,"avatar_url":"https://avatars.githubusercontent.com/u/359833?v=3","gravatar_id":"","url":"https://api.github.com/users/PierreF","html_url":"https://github.com/PierreF","followers_url":"https://api.github.com/users/PierreF/followers","following_url":"https://api.github.com/users/PierreF/following{/other_user}","gists_url":"https://api.github.com/users/PierreF/gists{/gist_id}","starred_url":"https://api.github.com/users/PierreF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PierreF/subscriptions","organizations_url":"https://api.github.com/users/PierreF/orgs","repos_url":"https://api.github.com/users/PierreF/repos","events_url":"https://api.github.com/users/PierreF/events{/privacy}","received_events_url":"https://api.github.com/users/PierreF/received_events","type":"User","site_admin":false},"created_at":"2016-04-04T12:36:49Z","updated_at":"2016-04-04T12:36:49Z","body":"I don't know which option in [agent] section you are referring.\r\n\r\nThe timeout of Mongo and Prometheus (and all other timeout) are hard-coded value in .go file. My issue is that when timeout of metric gathering is the same as metric interval, I have the strange behavior described above.\r\n\r\nI do not want to increase metric interval, I want to keep the default of 10 seconds."}}