Skip to content

Commit

Permalink
Log cats-effect warning at debug level
Browse files Browse the repository at this point in the history
  • Loading branch information
spenes committed Feb 26, 2024
1 parent 3d24905 commit 51661ae
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,20 @@
*/
package com.snowplowanalytics.snowplow.collector.core

import scala.concurrent.duration._

import cats.effect.{ExitCode, IO}
import cats.effect.kernel.Resource
import cats.effect.metrics.CpuStarvationWarningMetrics

import com.monovore.decline.effect.CommandIOApp
import com.monovore.decline.Opts

import io.circe.Decoder

import org.typelevel.log4cats.Logger
import org.typelevel.log4cats.slf4j.Slf4jLogger

import com.snowplowanalytics.snowplow.scalatracker.emitters.http4s.ceTracking

import com.snowplowanalytics.snowplow.collector.core.model.Sinks
Expand All @@ -29,6 +35,14 @@ abstract class App[SinkConfig: Decoder](appInfo: AppInfo)
version = appInfo.version
) {

private implicit val logger: Logger[IO] = Slf4jLogger.getLogger[IO]

override def runtimeConfig =
super.runtimeConfig.copy(cpuStarvationCheckInterval = 10.seconds)

override def onCpuStarvationWarn(metrics: CpuStarvationWarningMetrics): IO[Unit] =
Logger[IO].debug(s"Cats Effect measured responsiveness in excess of ${metrics.starvationInterval * metrics.starvationThreshold}")

def mkSinks(config: Config.Streams[SinkConfig]): Resource[IO, Sinks[IO]]

def telemetryInfo(config: Config.Streams[SinkConfig]): IO[Telemetry.TelemetryInfo]
Expand Down

0 comments on commit 51661ae

Please sign in to comment.