Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cassandra input plugin - wrong measurements when using wildcards and Cassandra 2.x #1427

Closed
zdravec opened this issue Jun 29, 2016 · 1 comment · Fixed by #1509
Closed

Cassandra input plugin - wrong measurements when using wildcards and Cassandra 2.x #1427

zdravec opened this issue Jun 29, 2016 · 1 comment · Fixed by #1509
Labels
bug unexpected problem or unintended behavior

Comments

@zdravec
Copy link

zdravec commented Jun 29, 2016

Bug report

I'm usinng cassandra 2.x and telegraf to collect metrics and send them to riemann. I want to read _WriteTotalLatency_ for all tables and I'm using wildcards, see telegraf.conf. Jolokia returns a list of all metrics, but to riemann is send only one, combining the whole jolokia response.

Relevant telegraf.conf:

[[inputs.cassandra]]
  context = "/jolokia/read"
  servers = [":8778"]
  metrics  = [
"/org.apache.cassandra.metrics:type=ColumnFamily,keyspace=*,scope=*,name=WriteTotalLatency"
    ]

System info:

Telegraf - version 1.0.0-beta1

Steps to reproduce:

telegraf -test -config telegraf.conf

Expected behavior:

Plugin: cassandra, Collection 1
host  url http://:8778/jolokia/read/org.apache.cassandra.metrics:type=ColumnFamily,keyspace=*,scope=*,name=WriteTotalLatency
\> cassandraColumnFamily,host=cassandra-0,keyspace=system,mname=WriteTotalLatency,scope=size_estimates WriteTotalLatency_Count=381517 1467200344000000000
\> cassandraColumnFamily,host=cassandra-0,keyspace=system,mname=WriteTotalLatency,scope=schema_triggers WriteTotalLatency_Count=329 1467200344000000000
\> cassandraColumnFamily,host=cassandra-0,keyspace=system,mname=WriteTotalLatency,scope=schema_aggregates WriteTotalLatency_Count=474 1467200344000000000

Actual behavior:

Plugin: cassandra, Collection 1
host  url http://:8778/jolokia/read/org.apache.cassandra.metrics:type=ColumnFamily,keyspace=*,scope=*,name=WriteTotalLatency
\> cassandraColumnFamily,host=cassandra-0,keyspace=*,mname=WriteTotalLatency,scope=* WriteTotalLatency_org.apache.cassandra.metrics:keyspace\=system\,name\=WriteTotalLatency\,scope\=IndexInfo\,type\=ColumnFamily="map[Count:0]",WriteTotalLatency_org.apache.cassandra.metrics:keyspace\=system\,name\=WriteTotalLatency\,scope\=available_ranges\,type\=ColumnFamily="map[Count:0]",WriteTotalLatency_org.apache.cassandra.metrics:keyspace\=system\,name\=WriteTotalLatency\,scope\=batchlog\,type\=ColumnFamily="map[Count:0]"" 1467202491424240892

Additional info:

The current solution only works for Cassandra 3.x, but not for Cassandra 2.0, because of the metric type. It is "ColumnFamily" in Cassandra 2.x and "Table" in Cassandra 3.x
Copy from plugins/inputs/cassandra/cassandra.go, it only checks for metric type "Table":
if tokens["type"] == "Table" && (tokens["keyspace"] == "*" || tokens["scope"] == "*")

@sparrc
Copy link
Contributor

sparrc commented Jul 10, 2016

thanks for the report, if you could submit a PR to fix it would be greatly appreciated.

@sparrc sparrc added the bug unexpected problem or unintended behavior label Jul 10, 2016
sparrc pushed a commit that referenced this issue Jul 18, 2016
sparrc pushed a commit that referenced this issue Jul 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants