-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NU-1954] Add namespace metric to Lite engine
- Loading branch information
Showing
4 changed files
with
76 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...la/pl/touk/nussknacker/engine/lite/metrics/dropwizard/LiteMetricRegistryFactoryTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package pl.touk.nussknacker.engine.lite.metrics.dropwizard | ||
|
||
import org.scalatest.funsuite.AnyFunSuiteLike | ||
import org.scalatest.matchers.should.Matchers | ||
import pl.touk.nussknacker.engine.api.namespaces.Namespace | ||
|
||
import scala.jdk.CollectionConverters._ | ||
|
||
class LiteMetricRegistryFactoryTest extends AnyFunSuiteLike with Matchers { | ||
|
||
import LiteMetricRegistryFactory._ | ||
|
||
private val commonMetricConf = CommonMetricConfig( | ||
prefix = Some("a-prefix"), | ||
instanceId = Some("an-instance"), | ||
environment = "an-env", | ||
additionalTags = Map("custom-tag" -> "custom-value"), | ||
) | ||
|
||
test("should configure metric prefix") { | ||
val metricPrefix = prepareMetricPrefix(commonMetricConf, "default instance", namespace = None) | ||
|
||
metricPrefix.getKey shouldBe "a-prefix" | ||
metricPrefix.getTags.asScala shouldBe Map( | ||
"env" -> "an-env", | ||
"instanceId" -> "an-instance", | ||
"custom-tag" -> "custom-value", | ||
) | ||
} | ||
|
||
test("should add namespace tag") { | ||
val namespace = Namespace(value = "a-tenant", separator = "_") | ||
val metricPrefix = prepareMetricPrefix(commonMetricConf, "default instance", Some(namespace)) | ||
|
||
metricPrefix.getTags.asScala should contain("namespace" -> "a-tenant") | ||
} | ||
|
||
} |