diff --git a/README.md b/README.md index c14e86f..ba943a2 100644 --- a/README.md +++ b/README.md @@ -160,7 +160,7 @@ The available command line options may be seen by passing `-h`/`--help`: Record the cumulative time taken to run each collector and export the results. --exclude-keyspaces= - + Exclude keyspaces matching the specified regex pattern. -e, --exclude=EXCLUSION... Exclude a metric family or MBean from exposition. EXCLUSION may be the full name of a metric family diff --git a/common/src/main/java/com/zegelin/cassandra/exporter/FactoriesSupplier.java b/common/src/main/java/com/zegelin/cassandra/exporter/FactoriesSupplier.java index 2d88503..2f369bd 100644 --- a/common/src/main/java/com/zegelin/cassandra/exporter/FactoriesSupplier.java +++ b/common/src/main/java/com/zegelin/cassandra/exporter/FactoriesSupplier.java @@ -370,7 +370,7 @@ private Iterator tableMetricFactory(final Set tableMe final String keyspaceName = keyPropertyList.get("keyspace"); - if (excludedKeyspaces.contains(keyspaceName)) { + if (excludedKeyspaces.stream().anyMatch(p -> keyspaceName.matches(p))) { return false; } diff --git a/common/src/main/java/com/zegelin/cassandra/exporter/cli/HarvesterOptions.java b/common/src/main/java/com/zegelin/cassandra/exporter/cli/HarvesterOptions.java index dea9e82..1623b50 100644 --- a/common/src/main/java/com/zegelin/cassandra/exporter/cli/HarvesterOptions.java +++ b/common/src/main/java/com/zegelin/cassandra/exporter/cli/HarvesterOptions.java @@ -140,7 +140,8 @@ public void setNoFastFloat(final boolean noFastFloat) { public boolean collectorTimingEnabled; - @Option(names = "--exclude-keyspaces") + @Option(names = "--exclude-keyspaces", + description = "Exclude keyspaces matching the specified regex pattern.") public Set excludedKeyspaces = new HashSet<>(); @Option(names = "--exclude-system-tables", diff --git a/common/src/main/java/com/zegelin/cassandra/exporter/collector/StorageServiceMBeanMetricFamilyCollector.java b/common/src/main/java/com/zegelin/cassandra/exporter/collector/StorageServiceMBeanMetricFamilyCollector.java index f7cc897..cd80c45 100644 --- a/common/src/main/java/com/zegelin/cassandra/exporter/collector/StorageServiceMBeanMetricFamilyCollector.java +++ b/common/src/main/java/com/zegelin/cassandra/exporter/collector/StorageServiceMBeanMetricFamilyCollector.java @@ -93,7 +93,7 @@ public Stream collect() { { final Stream ownershipMetricStream = metadataFactory.keyspaces().stream() - .filter(keyspace -> !excludedKeyspaces.contains(keyspace)) + .filter(keyspace -> !excludedKeyspaces.stream().anyMatch(p -> keyspace.matches(p))) .flatMap(keyspace -> { try { return storageServiceMBean.effectiveOwnership(keyspace).entrySet().stream() diff --git a/install-ccm.sh b/install-ccm.sh index a86c7fc..7f01612 100755 --- a/install-ccm.sh +++ b/install-ccm.sh @@ -1,5 +1,9 @@ #!/usr/bin/env bash +HERE="$(dirname "$(readlink -f "$0")")" + +AGENT="$HERE/agent/target/cassandra-exporter-agent-0.9.11-SNAPSHOT.jar" + find . -path '*/node*/conf/cassandra-env.sh' | while read file; do echo "Processing $file" @@ -7,6 +11,8 @@ find . -path '*/node*/conf/cassandra-env.sh' | while read file; do sed -i -e "/cassandra-exporter/d" "${file}" - echo "JVM_OPTS=\"\$JVM_OPTS -javaagent:/home/adam/Projects/cassandra-exporter/agent/target/cassandra-exporter-agent-0.9.4-SNAPSHOT.jar=--listen=:${port},--cache=true,--enable-collector-timing\"" >> \ - "${file}" -done; \ No newline at end of file + cat <> "${file}" +JVM_OPTS="\$JVM_OPTS -javaagent:$AGENT=--listen=:${port},--enable-collector-timing" +EOF + +done;