Groovy's getStrings() method with string interpolation doesn't do what you think it does

groovy:000> user = "Ron"
    ===> Ron
    groovy:000> "hello ${user}"
    ===> hello Ron
    groovy:000> "hello ${user}".getStrings()
    ===> [hello , ]
    groovy:000> "hello ${user}".toString()
    ===> hello Ron

Fixes #24
This commit is contained in:
R. Tyler Croy 2015-03-20 15:12:26 -07:00
parent 789e7e863c
commit dc33298435
2 changed files with 7 additions and 2 deletions

View File

@ -7,7 +7,7 @@ apply plugin: 'application'
group = "com.github.lookout"
description = "A utility for monitoring the delay of Kafka consumers"
version = '0.1.6'
version = '0.1.7'
mainClassName = 'com.github.lookout.verspaetung.Main'
defaultTasks 'clean', 'check'
sourceCompatibility = '1.7'

View File

@ -8,6 +8,9 @@ import org.coursera.metrics.datadog.Tagged
import com.github.lookout.verspaetung.KafkaConsumer
import com.github.lookout.verspaetung.TopicPartition
import org.slf4j.Logger
import org.slf4j.LoggerFactory
/**
* Dropwizard Metrics Gauge for reporting the value of a given KafkaConsumer
*/
@ -18,6 +21,8 @@ class ConsumerGauge implements Gauge<Integer>, Tagged {
protected AbstractMap<TopicPartition, Long> topics
private TopicPartition topicPartition
private Logger logger = LoggerFactory.getLogger(ConsumerGauge.class)
ConsumerGauge(KafkaConsumer consumer,
AbstractMap<KafkaConsumer, Integer> consumers,
AbstractMap<TopicPartition, Long> topics) {
@ -42,7 +47,7 @@ class ConsumerGauge implements Gauge<Integer>, Tagged {
return ["partition:${this.consumer.partition}",
"topic:${this.consumer.topic}",
"consumer-group:${this.consumer.name}"
].collect { s -> s.strings.join('') }
].collect { s -> s.toString() }
}
/**