diff --git a/agent/src/main/java/com/zegelin/cassandra/exporter/InternalMetadataFactory.java b/agent/src/main/java/com/zegelin/cassandra/exporter/InternalMetadataFactory.java index 7eb07f2..bde44f7 100644 --- a/agent/src/main/java/com/zegelin/cassandra/exporter/InternalMetadataFactory.java +++ b/agent/src/main/java/com/zegelin/cassandra/exporter/InternalMetadataFactory.java @@ -11,6 +11,7 @@ import java.net.InetAddress; import java.util.Optional; import java.util.Set; +import java.util.stream.Stream; public class InternalMetadataFactory extends MetadataFactory { private static Optional getCFMetaData(final String keyspaceName, final String tableName) { @@ -20,10 +21,13 @@ private static Optional getCFMetaData(final String keyspaceName, fin @Override public Optional indexMetadata(final String keyspaceName, final String tableName, final String indexName) { return getCFMetaData(keyspaceName, tableName) - .flatMap(m -> m.getIndexes().get(indexName)) - .map(m -> { - final IndexMetadata.IndexType indexType = IndexMetadata.IndexType.valueOf(m.kind.toString()); - final Optional className = Optional.ofNullable(m.options.get("class_name")); + .map(Stream::of) + .orElseGet(Stream::empty) + .flatMap(m -> m.allColumns().stream()) + .filter(m -> indexName.equals(m.getIndexName())) + .map(m -> { + final IndexMetadata.IndexType indexType = IndexMetadata.IndexType.valueOf(m.getIndexType().toString()); + final Optional className = Optional.ofNullable(m.getIndexOptions().get("class_name")); return new IndexMetadata() { @Override @@ -36,7 +40,8 @@ public Optional customClassName() { return className; } }; - }); + }) + .findAny(); } @Override @@ -45,12 +50,12 @@ public Optional tableOrViewMetadata(final String keyspaceName, fi .map(m -> new TableMetadata() { @Override public String compactionStrategyClassName() { - return m.params.compaction.klass().getCanonicalName(); + return m.compactionStrategyClass.getCanonicalName(); } @Override public boolean isView() { - return m.isView(); + return false; } }); } diff --git a/common/src/main/java/com/zegelin/jmx/NamedObject.java b/common/src/main/java/com/zegelin/jmx/NamedObject.java index 947aaed..1393012 100644 --- a/common/src/main/java/com/zegelin/jmx/NamedObject.java +++ b/common/src/main/java/com/zegelin/jmx/NamedObject.java @@ -1,6 +1,6 @@ package com.zegelin.jmx; -import com.google.common.base.MoreObjects; +import com.google.common.base.Objects; import com.google.common.base.Preconditions; import javax.management.ObjectName; @@ -36,7 +36,7 @@ public NamedObject map(final BiFunction - 3.11.2 + 2.2.18 2.5.3 3.1.1