Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump smetrics, cats-helper, deprecate legacy MeasureDuration usages #241

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import com.evolutiongaming.akkaeffect.util.Terminated
import com.evolutiongaming.akkaeffect.{ActorRefOf, Ask}
import com.evolutiongaming.catshelper.CatsHelper._
import com.evolutiongaming.catshelper._
import com.evolutiongaming.smetrics.MeasureDuration
import com.evolutiongaming.smetrics

import scala.concurrent.duration._

Expand Down Expand Up @@ -138,15 +138,33 @@ object ClusterSharding {

implicit class ClusterShardingOps[F[_]](val self: ClusterSharding[F]) extends AnyVal {

@deprecated("Use `withLogging1` instead", "2.1.0")
def withLogging(implicit
F: BracketThrowable[F],
measureDuration: smetrics.MeasureDuration[F],
logOf: LogOf[F]
): F[ClusterSharding[F]] = {
withLogging1(F, measureDuration.toCatsHelper, logOf)
}

def withLogging1(implicit
F: BracketThrowable[F],
measureDuration: MeasureDuration[F],
logOf: LogOf[F]
): F[ClusterSharding[F]] = {
logOf(ClusterSharding.getClass).map { log => withLogging(log) }
logOf(ClusterSharding.getClass).map { log => withLogging1(log) }
}

@deprecated("Use `withLogging1` instead", "2.1.0")
def withLogging(
log: Log[F])(implicit
F: BracketThrowable[F],
measureDuration: smetrics.MeasureDuration[F]
): ClusterSharding[F] = {
withLogging1(log)(F, measureDuration.toCatsHelper)
}

def withLogging1(
log: Log[F])(implicit
F: BracketThrowable[F],
measureDuration: MeasureDuration[F]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ClusterShardingTest extends AsyncFunSuite with ActorSuite with Matchers {
logOf <- LogOf.slf4j[IO].toResource
log <- logOf(classOf[ClusterShardingTest]).toResource
clusterSharding <- ClusterSharding.of[IO](actorSystem)
clusterSharding <- clusterSharding.withLogging(log).pure[Resource[IO, *]]
clusterSharding <- clusterSharding.withLogging1(log).pure[Resource[IO, *]]
clusterShardingSettings <- IO { ClusterShardingSettings(actorSystem) }.toResource
actorRefOf = ActorRefOf.fromActorRefFactory[IO](actorSystem)
probe <- Probe.of[IO](actorRefOf)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import cats.syntax.all._
import cats.{Applicative, FlatMap, Functor, ~>}
import com.evolutiongaming.akkaeffect.persistence
import com.evolutiongaming.akkaeffect.persistence.SeqNr
import com.evolutiongaming.catshelper.Log
import com.evolutiongaming.smetrics.MeasureDuration
import com.evolutiongaming.catshelper.{Log, MeasureDuration}
import com.evolutiongaming.smetrics


trait Journaller[F[_]] {
Expand Down Expand Up @@ -35,8 +35,16 @@ object Journaller {
(seqNr: SeqNr) => f(self.deleteTo(seqNr)).map(a => f(a))
}


@deprecated("Use `withLogging1` instead", "2.1.0")
def withLogging(
log: Log[F])(implicit
F: FlatMap[F],
measureDuration: smetrics.MeasureDuration[F]
): Journaller[F] = {
withLogging1(log)(F, measureDuration.toCatsHelper)
}

def withLogging1(
log: Log[F])(implicit
F: FlatMap[F],
measureDuration: MeasureDuration[F]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import cats.{Applicative, FlatMap, Monad, ~>}
import com.evolutiongaming.akkaeffect.util.AtomicRef
import com.evolutiongaming.akkaeffect.{Act, Fail}
import com.evolutiongaming.catshelper.CatsHelper._
import com.evolutiongaming.catshelper.{Log, MonadThrowable, ToFuture}
import com.evolutiongaming.smetrics.MeasureDuration
import com.evolutiongaming.catshelper.{Log, MeasureDuration, MonadThrowable, ToFuture}
import com.evolutiongaming.smetrics

import scala.collection.immutable.Queue

Expand Down Expand Up @@ -144,8 +144,16 @@ object Append {

def narrow[B <: A]: Append[F, B] = events => self(events)


@deprecated("Use `withLogging1` instead", "2.1.0")
def withLogging(
log: Log[F])(implicit
F: FlatMap[F],
measureDuration: smetrics.MeasureDuration[F]
): Append[F, A] = {
withLogging1(log)(F, measureDuration.toCatsHelper)
}

def withLogging1(
log: Log[F])(implicit
F: FlatMap[F],
measureDuration: MeasureDuration[F]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import cats.effect.{Resource, Sync}
import cats.syntax.all._
import cats.{Applicative, FlatMap, ~>}
import com.evolutiongaming.akkaeffect.Fail
import com.evolutiongaming.catshelper.{FromFuture, Log, MonadThrowable}
import com.evolutiongaming.smetrics.MeasureDuration
import com.evolutiongaming.catshelper.{FromFuture, Log, MeasureDuration, MonadThrowable}
import com.evolutiongaming.smetrics

import scala.concurrent.duration.FiniteDuration

Expand Down Expand Up @@ -56,7 +56,16 @@ object DeleteEventsTo {
}
}

@deprecated("Use `withLogging1` instead", "2.1.0")
def withLogging(
log: Log[F])(implicit
F: FlatMap[F],
measureDuration: smetrics.MeasureDuration[F]
): DeleteEventsTo[F] = {
withLogging1(log)(F, measureDuration.toCatsHelper)
}

def withLogging1(
log: Log[F])(implicit
F: FlatMap[F],
measureDuration: MeasureDuration[F]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package com.evolutiongaming.akkaeffect.persistence

import cats.{Applicative, FlatMap, Monad, ~>}
import com.evolutiongaming.akkaeffect.Fail
import com.evolutiongaming.catshelper.{Log, MonadThrowable}
import com.evolutiongaming.smetrics.MeasureDuration
import com.evolutiongaming.catshelper.{Log, MeasureDuration, MonadThrowable}
import com.evolutiongaming.smetrics


/**
Expand Down Expand Up @@ -31,7 +31,7 @@ object Journaller {
def empty[F[_]: Applicative, A]: Journaller[F, A] = {
Journaller(Append.empty[F, A], DeleteEventsTo.empty[F])
}


def apply[F[_], A](
append: Append[F, A],
Expand Down Expand Up @@ -90,15 +90,23 @@ object Journaller {
}
}


@deprecated("Use `withLogging1` instead", "2.1.0")
def withLogging(
log: Log[F])(implicit
F: FlatMap[F],
measureDuration: smetrics.MeasureDuration[F]
): Journaller[F, A] = {
withLogging1(log)(F, measureDuration.toCatsHelper)
}

def withLogging1(
log: Log[F])(implicit
F: FlatMap[F],
measureDuration: MeasureDuration[F]
): Journaller[F, A] = {
Journaller(
self.append.withLogging(log),
self.deleteTo.withLogging(log))
self.append.withLogging1(log),
self.deleteTo.withLogging1(log))
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.evolutiongaming.akkaeffect.persistence

import java.time.Instant

import akka.persistence.{SnapshotSelectionCriteria, Snapshotter => _, _}
import cats.effect.Sync
import cats.syntax.all._
import cats.{Applicative, FlatMap, ~>}
import com.evolutiongaming.akkaeffect.Fail
import com.evolutiongaming.catshelper.{FromFuture, Log, MonadThrowable}
import com.evolutiongaming.smetrics.MeasureDuration
import com.evolutiongaming.catshelper.{FromFuture, Log, MeasureDuration, MonadThrowable}
import com.evolutiongaming.smetrics

import scala.concurrent.duration.FiniteDuration

Expand Down Expand Up @@ -95,8 +94,16 @@ object Snapshotter {
}
}


@deprecated("Use `withLogging1` instead", "2.1.0")
def withLogging(
log: Log[F])(implicit
F: FlatMap[F],
measureDuration: smetrics.MeasureDuration[F]
): Snapshotter[F, A] = {
withLogging1(log)(F, measureDuration.toCatsHelper)
}

def withLogging1(
log: Log[F])(implicit
F: FlatMap[F],
measureDuration: MeasureDuration[F]
Expand Down
4 changes: 2 additions & 2 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import sbt._
object Dependencies {

val scalatest = "org.scalatest" %% "scalatest" % "3.2.15"
val `cats-helper` = "com.evolutiongaming" %% "cats-helper" % "3.4.0"
val `cats-helper` = "com.evolutiongaming" %% "cats-helper" % "3.6.0"
val `executor-tools` = "com.evolutiongaming" %% "executor-tools" % "1.0.4"
val retry = "com.evolutiongaming" %% "retry" % "3.0.1"
val `akka-persistence-inmemory` = "com.github.dnvriend" %% "akka-persistence-inmemory" % "2.5.15.2"
val `kind-projector` = "org.typelevel" % "kind-projector" % "0.13.2"
val pureconfig = "com.github.pureconfig" %% "pureconfig" % "0.17.3"
val smetrics = "com.evolutiongaming" %% "smetrics" % "1.0.6"
val smetrics = "com.evolutiongaming" %% "smetrics" % "1.3.0"

object Cats {
private val version = "2.9.0"
Expand Down
2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ThisBuild / version := "2.0.1-SNAPSHOT"
ThisBuild / version := "2.1.0-SNAPSHOT"