Skip to content

Commit

Permalink
Merge branch 'main' into update/scala3-library-3.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilquist committed Jun 30, 2023
2 parents b5993dc + dc689b1 commit 3115625
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.10]
scala: [2.13.11]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.7.3"
version = "3.7.5"

style = default

Expand Down
22 changes: 11 additions & 11 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import com.typesafe.tools.mima.core._

ThisBuild / tlBaseVersion := "0.3"

val scala212Version = "2.12.17"
val scala213Version = "2.13.10"
val scala212Version = "2.12.18"
val scala213Version = "2.13.11"
val scala30Version = "3.3.0"

val collectionCompatVersion = "2.10.0"
val collectionCompatVersion = "2.11.0"

val catsVersion = "2.9.0"
val catsEffectVersion = "3.4.11"
Expand Down Expand Up @@ -179,7 +179,7 @@ lazy val lightstepGrpc = project
description := "Lightstep gRPC bindings for Natchez.",
libraryDependencies ++= Seq(
"com.lightstep.tracer" % "tracer-grpc" % "0.32.0",
"io.grpc" % "grpc-netty" % "1.55.1",
"io.grpc" % "grpc-netty" % "1.56.0",
"io.netty" % "netty-tcnative-boringssl-static" % "2.0.61.Final"
),
mimaPreviousArtifacts := Set()
Expand Down Expand Up @@ -223,7 +223,7 @@ lazy val opentelemetry = project
description := "Base OpenTelemetry Utilities for Natchez",
tlVersionIntroduced := List("2.12", "2.13", "3").map(_ -> "0.1.7").toMap,
libraryDependencies ++= Seq(
"io.opentelemetry" % "opentelemetry-sdk" % "1.26.0"
"io.opentelemetry" % "opentelemetry-sdk" % "1.27.0"
)
)

Expand All @@ -236,8 +236,8 @@ lazy val datadog = project
name := "natchez-datadog",
description := "Datadog bindings for Natchez.",
libraryDependencies ++= Seq(
"com.datadoghq" % "dd-trace-ot" % "1.14.0",
"com.datadoghq" % "dd-trace-api" % "1.14.0"
"com.datadoghq" % "dd-trace-ot" % "1.17.0",
"com.datadoghq" % "dd-trace-api" % "1.17.0"
)
)

Expand Down Expand Up @@ -363,10 +363,10 @@ lazy val examples = project
libraryDependencies ++= Seq(
"org.typelevel" %% "log4cats-slf4j" % "2.6.0",
"org.slf4j" % "slf4j-simple" % "2.0.7",
"eu.timepit" %% "refined" % "0.10.3",
"eu.timepit" %% "refined" % "0.11.0",
"is.cir" %% "ciris" % "3.1.0",
"io.opentelemetry" % "opentelemetry-exporter-otlp" % "1.26.0",
"io.grpc" % "grpc-okhttp" % "1.55.1" // required for the OpenTelemetry exporter
"io.opentelemetry" % "opentelemetry-exporter-otlp" % "1.27.0",
"io.grpc" % "grpc-okhttp" % "1.56.0" // required for the OpenTelemetry exporter
)
)

Expand Down Expand Up @@ -435,7 +435,7 @@ lazy val docs = project
"org.http4s" %% "http4s-client" % "0.23.15",
"org.typelevel" %% "log4cats-slf4j" % "2.4.0",
"org.slf4j" % "slf4j-simple" % "2.0.7",
"io.opentelemetry" % "opentelemetry-exporter-otlp" % "1.26.0" // for the opentelemetry example
"io.opentelemetry" % "opentelemetry-exporter-otlp" % "1.27.0" // for the opentelemetry example
),
excludeDependencies += "org.scala-lang.modules" % "scala-collection-compat_3" // pray this does more good than harm
)
55 changes: 55 additions & 0 deletions modules/core/shared/src/main/scala/Trace.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ trait Trace[F[_]] {
*/
def traceId: F[Option[String]]

/** A unique ID for this span, if available. This can be useful to include in error messages for
* example, so you can quickly find the associated trace.
*/
def spanId(implicit F: Applicative[F]): F[Option[String]] = F.pure(None)

/** A unique URI for this trace, if available. This can be useful to include in error messages for
* example, so you can quickly find the associated trace.
*/
Expand Down Expand Up @@ -99,6 +104,9 @@ object Trace {
override def traceId: IO[Option[String]] =
local.get.flatMap(_.traceId)

override def spanId(implicit F: Applicative[IO]): IO[Option[String]] =
local.get.flatMap(_.spanId)

override def traceUri: IO[Option[URI]] =
local.get.flatMap(_.traceUri)
}
Expand Down Expand Up @@ -126,6 +134,8 @@ object Trace {
Resource.pure(FunctionK.id)
override def span[A](name: String, options: Span.Options)(k: F[A]): F[A] = k
override def traceId: F[Option[String]] = none.pure[F]
override def spanId(implicit A: Applicative[F]): F[Option[String]] =
A.pure(None)
override def traceUri: F[Option[URI]] = none.pure[F]
}
}
Expand Down Expand Up @@ -226,13 +236,23 @@ object Trace {
override def traceId: Kleisli[F, E, Option[String]] =
Kleisli(e => f(e).traceId)

override def spanId(implicit
F: Applicative[Kleisli[F, E, *]]
): Kleisli[F, E, Option[String]] =
Kleisli(e => f(e).spanId)

override def traceUri: Kleisli[F, E, Option[URI]] =
Kleisli(e => f(e).traceUri)
}

override def traceId: Kleisli[F, Span[F], Option[String]] =
Kleisli(_.traceId)

override def spanId(implicit
F: Applicative[Kleisli[F, Span[F], *]]
): Kleisli[F, Span[F], Option[String]] =
Kleisli(_.spanId)

override def traceUri: Kleisli[F, Span[F], Option[URI]] =
Kleisli(_.traceUri)
}
Expand Down Expand Up @@ -278,6 +298,11 @@ object Trace {
override def traceId: Kleisli[F, E, Option[String]] =
Kleisli.liftF(trace.traceId)

override def spanId(implicit
F: Applicative[Kleisli[F, E, *]]
): Kleisli[F, E, Option[String]] =
Kleisli.liftF(trace.spanId)

override def traceUri: Kleisli[F, E, Option[URI]] =
Kleisli.liftF(trace.traceUri)
}
Expand Down Expand Up @@ -325,6 +350,11 @@ object Trace {
override def traceId: StateT[F, S, Option[String]] =
StateT.liftF(trace.traceId)

override def spanId(implicit
F: Applicative[StateT[F, S, *]]
): StateT[F, S, Option[String]] =
StateT.liftF(trace.spanId)

override def traceUri: StateT[F, S, Option[URI]] =
StateT.liftF(trace.traceUri)
}
Expand Down Expand Up @@ -373,6 +403,11 @@ object Trace {
override def traceId: EitherT[F, E, Option[String]] =
EitherT.liftF(trace.traceId)

override def spanId(implicit
F: Applicative[EitherT[F, E, *]]
): EitherT[F, E, Option[String]] =
EitherT.liftF(trace.spanId)

override def traceUri: EitherT[F, E, Option[URI]] =
EitherT.liftF(trace.traceUri)
}
Expand Down Expand Up @@ -417,6 +452,11 @@ object Trace {
override def traceId: OptionT[F, Option[String]] =
OptionT.liftF(trace.traceId)

override def spanId(implicit
F: Applicative[OptionT[F, *]]
): OptionT[F, Option[String]] =
OptionT.liftF(trace.spanId)

override def traceUri: OptionT[F, Option[URI]] =
OptionT.liftF(trace.traceUri)
}
Expand Down Expand Up @@ -468,6 +508,11 @@ object Trace {
override def traceId: Nested[F, G, Option[String]] =
trace.traceId.map(_.pure[G]).nested

override def spanId(implicit
F: Applicative[Nested[F, G, *]]
): Nested[F, G, Option[String]] =
trace.spanId.map(_.pure[G]).nested

override def traceUri: Nested[F, G, Option[URI]] =
trace.traceUri.map(_.pure[G]).nested
}
Expand Down Expand Up @@ -517,6 +562,11 @@ object Trace {
override def traceId: Resource[F, Option[String]] =
Resource.eval(trace.traceId)

override def spanId(implicit
F: Applicative[Resource[F, *]]
): Resource[F, Option[String]] =
Resource.eval(trace.spanId)

override def traceUri: Resource[F, Option[URI]] =
Resource.eval(trace.traceUri)
}
Expand Down Expand Up @@ -560,6 +610,11 @@ object Trace {
override def traceId: Stream[F, Option[String]] =
Stream.eval(trace.traceId)

override def spanId(implicit
F: Applicative[Stream[F, *]]
): Stream[F, Option[String]] =
Stream.eval(trace.spanId)

override def traceUri: Stream[F, Option[URI]] =
Stream.eval(trace.traceUri)
}
Expand Down
4 changes: 4 additions & 0 deletions modules/mtl/shared/src/main/scala/LocalTrace.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import cats.effect.MonadCancel
import cats.effect.Resource
import cats.syntax.all._
import java.net.URI
import cats.Applicative

private[mtl] class LocalTrace[F[_]](local: Local[F, Span[F]])(implicit
ev: MonadCancel[F, Throwable]
Expand Down Expand Up @@ -54,6 +55,9 @@ private[mtl] class LocalTrace[F[_]](local: Local[F, Span[F]])(implicit
override def traceId: F[Option[String]] =
local.ask.flatMap(_.traceId)

override def spanId(implicit F: Applicative[F]): F[Option[String]] =
local.ask.flatMap(_.spanId)

override def traceUri: F[Option[URI]] =
local.ask.flatMap(_.traceUri)
}
7 changes: 5 additions & 2 deletions modules/noop/shared/src/main/scala/NoopTrace.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ final case class NoopTrace[F[_]: Applicative]() extends Trace[F] {
override def span[A](name: String, options: Span.Options)(k: F[A]): F[A] =
k

def traceId: F[Option[String]] =
override def traceId: F[Option[String]] =
none.pure[F]

def traceUri: F[Option[URI]] =
override def spanId(implicit A: Applicative[F]): F[Option[String]] =
A.pure(None)

override def traceUri: F[Option[URI]] =
none.pure[F]
}
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.8.3
sbt.version=1.9.1
8 changes: 4 additions & 4 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.4.21")
addSbtPlugin("org.typelevel" % "sbt-typelevel-mergify" % "0.4.21")
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.4.22")
addSbtPlugin("org.typelevel" % "sbt-typelevel-mergify" % "0.4.22")
addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.10.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.4")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.1")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.12")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.2")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.14")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.1")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.7")

0 comments on commit 3115625

Please sign in to comment.