def postCachedContentsAsMetrics()

in hq/app/services/MetricService.scala [46:65]


  def postCachedContentsAsMetrics(): Unit = {
    val allExposedKeys = cacheService.getAllExposedKeys
    val allPublicBuckets = cacheService.getAllPublicBuckets
    val allCredentials = cacheService.getAllCredentials

    val failures = collectFailures(
      List(allExposedKeys, allPublicBuckets, allCredentials)
    )

    if (failures.nonEmpty) {
      logger.warn(
        s"Skipping cloudwatch metrics update as some data is missing from the cache: $failures"
      )
    } else {
      logger.info("Posting new metrics to cloudwatch")
      Cloudwatch.logAsMetric(allExposedKeys, Cloudwatch.DataType.iamKeysTotal)
      Cloudwatch.logAsMetric(allPublicBuckets, Cloudwatch.DataType.s3Total)
      Cloudwatch.logMetricsForCredentialsReport(allCredentials)
    }
  }