{"action":"created","issue":{"url":"https://api.github.com/repos/jmxtrans/jmxtrans/issues/531","repository_url":"https://api.github.com/repos/jmxtrans/jmxtrans","labels_url":"https://api.github.com/repos/jmxtrans/jmxtrans/issues/531/labels{/name}","comments_url":"https://api.github.com/repos/jmxtrans/jmxtrans/issues/531/comments","events_url":"https://api.github.com/repos/jmxtrans/jmxtrans/issues/531/events","html_url":"https://github.com/jmxtrans/jmxtrans/pull/531","id":195662694,"number":531,"title":"Handle MBean TabularData in statsd writer","user":{"login":"itzg","id":988985,"avatar_url":"https://avatars.githubusercontent.com/u/988985?v=3","gravatar_id":"","url":"https://api.github.com/users/itzg","html_url":"https://github.com/itzg","followers_url":"https://api.github.com/users/itzg/followers","following_url":"https://api.github.com/users/itzg/following{/other_user}","gists_url":"https://api.github.com/users/itzg/gists{/gist_id}","starred_url":"https://api.github.com/users/itzg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itzg/subscriptions","organizations_url":"https://api.github.com/users/itzg/orgs","repos_url":"https://api.github.com/users/itzg/repos","events_url":"https://api.github.com/users/itzg/events{/privacy}","received_events_url":"https://api.github.com/users/itzg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-12-14T22:21:34Z","updated_at":"2016-12-15T14:33:19Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jmxtrans/jmxtrans/pulls/531","html_url":"https://github.com/jmxtrans/jmxtrans/pull/531","diff_url":"https://github.com/jmxtrans/jmxtrans/pull/531.diff","patch_url":"https://github.com/jmxtrans/jmxtrans/pull/531.patch"},"body":"Using the following query results in a BufferOverflowException due to an attempt to write [a very long line](https://gist.github.com/itzg/7bd028867c5df5cbc6839386d9278baa#file-example-of-very-long-tabulardata-statsdwriter2-line-txt) to the statsd channel.\r\n\r\n```\r\n{\r\n  \"obj\": \"java.lang:type=GarbageCollector,name=G1 Young Generation\",\r\n  \"resultAlias\": \"java.lang.type-GarbageCollector.name-G1_Young_Generation\",\r\n  \"attr\": [\r\n    \"LastGcInfo\"\r\n  ],\r\n  \"outputWriters\": [\r\n    {\r\n      \"@class\": \"com.googlecode.jmxtrans.model.output.StatsDWriterFactory\",\r\n      \"bucketType\": \"g\",\r\n      \"host\": \"localhost\",\r\n      \"port\": 8125,\r\n      \"rootPrefix\": \"cassandra.jmx\",\r\n      \"stringValuesAsKey\": true\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\nI narrowed the root cause of that exception to the line rendered [here](https://github.com/jmxtrans/jmxtrans/blob/757e06a32fa218a7711814f4fd92fca90f4b10ce/jmxtrans-output/jmxtrans-output-core/src/main/java/com/googlecode/jmxtrans/model/output/StatsDWriter2.java#L87) due to the inclusion of the `TabularDataSupport` object in the results values [here](https://github.com/jmxtrans/jmxtrans/blob/757e06a32fa218a7711814f4fd92fca90f4b10ce/jmxtrans-core/src/main/java/com/googlecode/jmxtrans/model/JmxResultProcessor.java#L139).\r\n\r\nSince `stringValuesAsKey` is set to `true`, [this logic](https://github.com/jmxtrans/jmxtrans/blob/757e06a32fa218a7711814f4fd92fca90f4b10ce/jmxtrans-output/jmxtrans-output-core/src/main/java/com/googlecode/jmxtrans/model/output/StatsDWriter2.java#L93) allows the TabularData object to be considered \"numeric\" or a \"string value\".\r\n\r\nThis PR proposes a solution which is to further tighten down the `isNotValidValue` logic in `StatsDWriter2`. A new unit test has been introduced to approximate the results of the query declaration above where primitive values need to pass, but the tabular data excluded."},"comment":{"url":"https://api.github.com/repos/jmxtrans/jmxtrans/issues/comments/267341541","html_url":"https://github.com/jmxtrans/jmxtrans/pull/531#issuecomment-267341541","issue_url":"https://api.github.com/repos/jmxtrans/jmxtrans/issues/531","id":267341541,"user":{"login":"gehel","id":1415765,"avatar_url":"https://avatars.githubusercontent.com/u/1415765?v=3","gravatar_id":"","url":"https://api.github.com/users/gehel","html_url":"https://github.com/gehel","followers_url":"https://api.github.com/users/gehel/followers","following_url":"https://api.github.com/users/gehel/following{/other_user}","gists_url":"https://api.github.com/users/gehel/gists{/gist_id}","starred_url":"https://api.github.com/users/gehel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gehel/subscriptions","organizations_url":"https://api.github.com/users/gehel/orgs","repos_url":"https://api.github.com/users/gehel/repos","events_url":"https://api.github.com/users/gehel/events{/privacy}","received_events_url":"https://api.github.com/users/gehel/received_events","type":"User","site_admin":false},"created_at":"2016-12-15T14:33:19Z","updated_at":"2016-12-15T14:33:19Z","body":"It looks to me that removing [JmxResultProcessor:139](https://github.com/jmxtrans/jmxtrans/blob/757e06a32fa218a7711814f4fd92fca90f4b10ce/jmxtrans-core/src/main/java/com/googlecode/jmxtrans/model/JmxResultProcessor.java#L139) is a better / cleaner solution. I'm pretty sure that we don't have any OutputWriter trying to do smart things with tabular data... nor should they.\r\n\r\nAs a side note, [Result.values](https://github.com/jmxtrans/jmxtrans/blob/757e06a32fa218a7711814f4fd92fca90f4b10ce/jmxtrans-core/src/main/java/com/googlecode/jmxtrans/model/Result.java#L54) should have a much stricter type than `Object`. The OutputWriters themselves should not have to deal with the complexity of JMX..."}}
{"actor":{"display_login":"gehel"}}