in app/com/gu/contentapi/sanity/support/CloudWatchReportingSupport.scala [43:59]
def apply(config: Configuration): CloudWatchReporter = {
def cfg(key: String) = config.getOptional[String](s"content-api-sanity-tests.cloudwatch-$key")
val reporter = for {
namespace <- cfg("namespace")
testRunsMetric <- cfg("test-runs-metric")
successfulTestsMetric <- cfg("successful-tests-metric")
failedTestsMetric <- cfg("failed-tests-metric")
} yield {
logger.info(s"Will report metrics to CloudWatch. namespace=$namespace, metrics=($testRunsMetric, $successfulTestsMetric, $failedTestsMetric)")
new RealCloudWatchReporter(namespace, testRunsMetric, successfulTestsMetric, failedTestsMetric)
}
reporter getOrElse {
logger.info("Will not report any metrics to CloudWatch")
DoNothingCloudWatchReporter
}
}