lerna.management.stats.Metrics.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lerna-management_2.13 Show documentation
Show all versions of lerna-management_2.13 Show documentation
A library that is useful for building applications that run on Lerna Stack.
The newest version!
package lerna.management.stats
import akka.actor.ClassicActorSystemProvider
import kamon.module.MetricReporter
import lerna.log.AppLogging
import lerna.util.tenant.Tenant
import scala.concurrent.Future
/** A trait that provides metric reporting feature for [[kamon]]
*
* ==Overview==
* The trait can be used for [[kamon]] since it extends [[kamon.module.MetricReporter]].
*/
trait Metrics extends MetricReporter with AppLogging {
/** Get the metric value for the `key` optionally
*
* @param key The metric key
* @return An optional value containing the metric value associated with the key, or [[scala.None]] if none exists.
*/
def getMetrics(key: MetricsKey): Future[Option[MetricsValue]]
}
/** An object that provides metrics reporting features for [[kamon]]
*/
object Metrics {
/** Create a default instance of [[Metrics]]
*
* @param system An actor system used in the instance
* @param tenants Set of supporting tenants
* @return The instance of [[Metrics]]
*/
def apply(system: ClassicActorSystemProvider, tenants: Set[Tenant]): Metrics = {
new MetricsImpl(system.classicSystem, tenants)
}
}