aboutsummaryrefslogtreecommitdiff
path: root/kamon-core/src/main/scala/kamon/metric/Entity.scala
diff options
context:
space:
mode:
Diffstat (limited to 'kamon-core/src/main/scala/kamon/metric/Entity.scala')
-rw-r--r--kamon-core/src/main/scala/kamon/metric/Entity.scala9
1 files changed, 8 insertions, 1 deletions
diff --git a/kamon-core/src/main/scala/kamon/metric/Entity.scala b/kamon-core/src/main/scala/kamon/metric/Entity.scala
index 91249af0..17b728fd 100644
--- a/kamon-core/src/main/scala/kamon/metric/Entity.scala
+++ b/kamon-core/src/main/scala/kamon/metric/Entity.scala
@@ -16,6 +16,8 @@
package kamon.metric
+import org.slf4j.LoggerFactory
+
/**
* Identify a `thing` that is being monitored by Kamon. A [[kamon.metric.Entity]] is used to identify tracked `things`
* in both the metrics recording and reporting sides. Only the name and category fields are used with determining
@@ -23,9 +25,14 @@ package kamon.metric
*
* // TODO: Find a better word for `thing`.
*/
-case class Entity(name: String, category: String, tags: Map[String, String])
+case class Entity(name: String, category: String, tags: Map[String, String]) {
+ if(name == null) Entity.log.warn("Entity with name=null created (category: {}), your monitoring will not work as expected!", category)
+}
object Entity {
+
+ private lazy val log = LoggerFactory.getLogger(classOf[Entity])
+
def apply(name: String, category: String): Entity =
apply(name, category, Map.empty)