{"action":"created","issue":{"url":"https://api.github.com/repos/influxdata/telegraf/issues/4348","repository_url":"https://api.github.com/repos/influxdata/telegraf","labels_url":"https://api.github.com/repos/influxdata/telegraf/issues/4348/labels{/name}","comments_url":"https://api.github.com/repos/influxdata/telegraf/issues/4348/comments","events_url":"https://api.github.com/repos/influxdata/telegraf/issues/4348/events","html_url":"https://github.com/influxdata/telegraf/issues/4348","id":335996122,"node_id":"MDU6SXNzdWUzMzU5OTYxMjI=","number":4348,"title":"Losing data when using two input plugins for the same measurement name?","user":{"login":"pcman312","id":72365,"node_id":"MDQ6VXNlcjcyMzY1","avatar_url":"https://avatars2.githubusercontent.com/u/72365?v=4","gravatar_id":"","url":"https://api.github.com/users/pcman312","html_url":"https://github.com/pcman312","followers_url":"https://api.github.com/users/pcman312/followers","following_url":"https://api.github.com/users/pcman312/following{/other_user}","gists_url":"https://api.github.com/users/pcman312/gists{/gist_id}","starred_url":"https://api.github.com/users/pcman312/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pcman312/subscriptions","organizations_url":"https://api.github.com/users/pcman312/orgs","repos_url":"https://api.github.com/users/pcman312/repos","events_url":"https://api.github.com/users/pcman312/events{/privacy}","received_events_url":"https://api.github.com/users/pcman312/received_events","type":"User","site_admin":false},"labels":[{"id":978440956,"node_id":"MDU6TGFiZWw5Nzg0NDA5NTY=","url":"https://api.github.com/repos/influxdata/telegraf/labels/area/statsd","name":"area/statsd","color":"f48d38","default":false},{"id":194687826,"node_id":"MDU6TGFiZWwxOTQ2ODc4MjY=","url":"https://api.github.com/repos/influxdata/telegraf/labels/bug","name":"bug","color":"ff8564","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-06-26T21:24:00Z","updated_at":"2018-07-27T18:16:37Z","closed_at":"2018-07-27T18:16:37Z","author_association":"NONE","body":"### Relevant telegraf.conf:\r\n```\r\n[[inputs.socket_listener]]\r\n    service_address = \"udp://:8094\"\r\n    data_format = \"influx\"\r\n[[inputs.statsd]]\r\n    protocol = \"udp\"\r\n    service_address = \":8125\"\r\n    metric_separator = \".\" \r\n```\r\n\r\n### System info:\r\nOS: `Centos 7`\r\nTelegraf version: `1.7.0`\r\nInfluxDB version: `1.3.1` (also happens on `1.5.4` after an upgrade)\r\n\r\n### Steps to reproduce:\r\n1. Setup statsd input plugins with config referenced above (I suspect the specific details don't matter, just as long as there are two input plugins - though I don't have any evidence to support this)\r\n2. Send a metric to one of the input plugins (it doesn't appear to matter which one goes first)\r\n3. Send a different metric with the same measurement name to the other input plugin\r\n\r\n### Expected behavior:\r\nBoth metrics are recorded\r\n\r\n### Actual behavior:\r\nSecond metric is lost\r\n\r\n### Additional info:\r\n```\r\n# Send to socket_listener plugin\r\n$ echo \"multi.test.udp value=241 1530054953000000000\" | nc -u -w1 127.0.0.1 8094\r\n$ influx -ssl -unsafeSsl -database tac_monitor -execute \"SELECT value FROM \\\"multi.test.udp\\\" WHERE time > now() - 1h\" \r\nname: multi.test.udp\r\ntime                value\r\n----                -----\r\n1530054953000000000 241 \r\n\r\n# Send to statsd plugin\r\n$ echo \"multi.test.udp:200|c\" | nc -u -w1 127.0.0.1 8125\r\n$ influx -ssl -unsafeSsl -database tac_monitor -execute \"SELECT value FROM \\\"multi.test.udp\\\" WHERE time > now() - 1h\" \r\nname: multi.test.udp\r\ntime                value\r\n----                -----\r\n1530054953000000000 241 \r\n```\r\n\r\nThe exact same behavior happens when I reverse the order.\r\nIf I drop the entire measurement and then try again, the behavior resets. For instance: If I send via the `socket_listener` then via `statsd` then the `statsd` metric is lost. If I then drop the measurement and reverse the order (`statsd` then `socket_listener`) the `statsd` metric is retained and the `socket_listener` is lost.\r\nRestarting telegraf and/or influxdb did not seem to make any difference.\r\n\r\n## Original Bug Report (incorrect assumptions, but leaving it here for posterity)\r\nThis appears to be unrelated to using periods as my original bug report claims. My first response comment describes an odd behavior if you try to write to the same measurement name with two input plugins.\r\n\r\n### Relevant telegraf.conf:\r\n```\r\n[[inputs.statsd]]\r\n    protocol = \"udp\"\r\n    service_address = \":8125\"\r\n    metric_separator = \".\"\r\n```\r\n\r\n### System info:\r\nOS: `Centos 7`\r\nTelegraf version: `1.7.0`\r\nInfluxDB version: `1.3.1`\r\n\r\n### Steps to reproduce:\r\n1. Setup statsd input plugin with config referenced above\r\n2. Send metrics with `.` in them to statsd endpoint (such as `messages.received`)\r\n\r\n### Expected behavior:\r\nEither:\r\n- Telegraf uses `.` as its separators\r\nOr:\r\n- Telegraf errors on startup because `.` isn't supported on the statsd plugin\r\n\r\n### Actual behavior:\r\nTelegraf starts up without issue\r\nNo data for that metric is received by influx\r\n\r\n### Additional info:\r\nSpecifying these other separators work as expected: `-`, `--`, `_` (default), `\\\\.`\r\nHowever, specifying `\\.` causes telegraf to fail on startup\r\n\r\nClearly periods are in some way supported (as evidenced by the fact that I can use `\\\\.` and the metric shows up as `messages\\.received`). However, plain periods somehow break the plugin in a subtle enough way that it doesn't error. The plugin should either explicitly disallow `.` as the separator (preferably with a descriptive error message), or allows plain periods through to the output plugins."},"comment":{"url":"https://api.github.com/repos/influxdata/telegraf/issues/comments/408498952","html_url":"https://github.com/influxdata/telegraf/issues/4348#issuecomment-408498952","issue_url":"https://api.github.com/repos/influxdata/telegraf/issues/4348","id":408498952,"node_id":"MDEyOklzc3VlQ29tbWVudDQwODQ5ODk1Mg==","user":{"login":"danielnelson","id":1048079,"node_id":"MDQ6VXNlcjEwNDgwNzk=","avatar_url":"https://avatars3.githubusercontent.com/u/1048079?v=4","gravatar_id":"","url":"https://api.github.com/users/danielnelson","html_url":"https://github.com/danielnelson","followers_url":"https://api.github.com/users/danielnelson/followers","following_url":"https://api.github.com/users/danielnelson/following{/other_user}","gists_url":"https://api.github.com/users/danielnelson/gists{/gist_id}","starred_url":"https://api.github.com/users/danielnelson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielnelson/subscriptions","organizations_url":"https://api.github.com/users/danielnelson/orgs","repos_url":"https://api.github.com/users/danielnelson/repos","events_url":"https://api.github.com/users/danielnelson/events{/privacy}","received_events_url":"https://api.github.com/users/danielnelson/received_events","type":"User","site_admin":false},"created_at":"2018-07-27T18:16:37Z","updated_at":"2018-07-27T18:16:37Z","author_association":"CONTRIBUTOR","body":"It seems like there are two issues:\r\n\r\nIn order to use the same measurement/field name, you will need both pieces of data to have the same type.  When you send data in over the socket_listener perhaps you can switch to sending integers (add a trailing `i` char after the value):\r\n```\r\nmulti.test.udp value=241i 1530054953000000000\r\n```\r\n\r\nThe second problem is more complicated.  Recall that for any series, InfluxDB stores one value for each field at a timestamp.  This means that if you send a value to both inputs for the same timestamp, one of the values, whichever is written secondly, will overwrite the first one.  It is undefined what the ordering of the metrics will be in this case.  I would have to understand more about your actual metrics to make an informed recommendation, but why not just send all the data to the statsd input?\r\n\r\nI'm going to close this issue as I don't think there is anything that should be changed in Telegraf, but we can continue discussing here if you have more questions."}}
{"actor":{"display_login":"danielnelson"}}