Skip to content

Commit

Permalink
Upgrades to zio 1.0 (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebver authored Aug 5, 2020
1 parent d6bd17f commit 9f42e57
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
6 changes: 3 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ fork in Test := true
fork in run := true

val http4sVersion = "0.21.6"
val zioVersion = "1.0.0-RC21-2"
val interopVersion = "2.1.4.0-RC17"
val zioNIOVersion = "1.0.0-RC8"
val zioVersion = "1.0.0"
val interopVersion = "2.1.4.0"
val zioNIOVersion = "1.0.0-RC9"
val prometheusVersion = "0.9.0"
val dropwizardVersion = "4.1.10.1"
val circeVersion = "0.13.0"
Expand Down
15 changes: 8 additions & 7 deletions statsd/src/main/scala/zio/metrics/Client.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ import java.util.concurrent.ThreadLocalRandom

import zio._
import zio.clock.Clock
import zio.duration.Duration
import zio.duration.Duration.Finite
import zio.metrics.encoders._
import zio.stream.ZStream

class Client(val bufferSize: Long, val timeout: Long, host: Option[String], port: Option[Int])(
class Client(val bufferSize: Int, val timeout: Long, host: Option[String], port: Option[Int])(
private val queue: Queue[Metric]
) {

type UDPQueue = ZQueue[Nothing, Any, Encoder, Throwable, Nothing, Metric]

private val duration: Finite = Finite(timeout)
private val duration: Duration = Finite(timeout)

private val udpClient: ZManaged[Any, Throwable, UDPClient] = (host, port) match {
case (None, None) => UDPClient()
Expand Down Expand Up @@ -52,7 +53,7 @@ class Client(val bufferSize: Long, val timeout: Long, host: Option[String], port
ZStream
.fromQueue[Encoder, Throwable, Metric](queue)
.groupedWithin(bufferSize, duration)
.mapM(l => f(l))
.mapM(l => f(l.toList))
.runDrain
.fork

Expand All @@ -77,14 +78,14 @@ object Client {

def apply(): ZManaged[ClientEnv, Throwable, Client] = apply(5, 5000, 100, None, None)

def apply(bufferSize: Long, timeout: Long): ZManaged[ClientEnv, Throwable, Client] =
def apply(bufferSize: Int, timeout: Long): ZManaged[ClientEnv, Throwable, Client] =
apply(bufferSize, timeout, 100, None, None)

def apply(bufferSize: Long, timeout: Long, queueCapacity: Int): ZManaged[ClientEnv, Throwable, Client] =
def apply(bufferSize: Int, timeout: Long, queueCapacity: Int): ZManaged[ClientEnv, Throwable, Client] =
apply(bufferSize, timeout, queueCapacity, None, None)

def apply(
bufferSize: Long,
bufferSize: Int,
timeout: Long,
queueCapacity: Int,
host: Option[String],
Expand All @@ -103,7 +104,7 @@ object Client {
withListener(5, 5000, 100, None, None)(listener)

def withListener[F[_], A](
bufferSize: Long,
bufferSize: Int,
timeout: Long,
queueCapacity: Int,
host: Option[String],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ object DogStatsDClient {

def apply(): ZManaged[ClientEnv, Throwable, DogStatsDClient] = apply(5, 5000, 100, None, None)

def apply(bufferSize: Long, timeout: Long): ZManaged[ClientEnv, Throwable, DogStatsDClient] =
def apply(bufferSize: Int, timeout: Long): ZManaged[ClientEnv, Throwable, DogStatsDClient] =
apply(bufferSize, timeout, 100, None, None)

def apply(bufferSize: Long, timeout: Long, queueCapacity: Int): ZManaged[ClientEnv, Throwable, DogStatsDClient] =
def apply(bufferSize: Int, timeout: Long, queueCapacity: Int): ZManaged[ClientEnv, Throwable, DogStatsDClient] =
apply(bufferSize, timeout, queueCapacity, None, None)

def apply(
bufferSize: Long,
bufferSize: Int,
timeout: Long,
queueCapacity: Int,
host: Option[String],
Expand Down
6 changes: 3 additions & 3 deletions statsd/src/main/scala/zio/metrics/statsd/StatsDClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ class StatsDClient(client: Client) {
object StatsDClient {
def apply(): ZManaged[ClientEnv, Throwable, StatsDClient] = apply(5, 5000, 100, None, None)

def apply(bufferSize: Long, timeout: Long): ZManaged[ClientEnv, Throwable, StatsDClient] =
def apply(bufferSize: Int, timeout: Long): ZManaged[ClientEnv, Throwable, StatsDClient] =
apply(bufferSize, timeout, 100, None, None)

def apply(bufferSize: Long, timeout: Long, queueCapacity: Int): ZManaged[ClientEnv, Throwable, StatsDClient] =
def apply(bufferSize: Int, timeout: Long, queueCapacity: Int): ZManaged[ClientEnv, Throwable, StatsDClient] =
apply(bufferSize, timeout, queueCapacity, None, None)

def apply(
bufferSize: Long,
bufferSize: Int,
timeout: Long,
queueCapacity: Int,
host: Option[String],
Expand Down

0 comments on commit 9f42e57

Please sign in to comment.