blob: 9810428ef524a1f756e253cc9b3ffd944a8957e3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package kamon.util
import java.util.concurrent.TimeUnit
import com.typesafe.config.Config
import scala.concurrent.duration.FiniteDuration
object ConfigTools {
implicit class Syntax(val config: Config) extends AnyVal {
// We are using the deprecated .getNanoseconds option to keep Kamon source code compatible with
// versions of Akka using older typesafe-config versions.
def getFiniteDuration(path: String): FiniteDuration =
FiniteDuration(config.getNanoseconds(path), TimeUnit.NANOSECONDS)
def firstLevelKeys: Set[String] = {
import scala.collection.JavaConverters._
config.entrySet().asScala.map {
case entry ⇒ entry.getKey.takeWhile(_ != '.')
} toSet
}
}
}
|