diff --git a/.scalafmt.conf b/.scalafmt.conf index 34f855d..4b3a76f 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,7 +1,7 @@ # initial version taken over from alpakka # https://akka.io/blog/2019/09/09/akka-family-builds -version = 2.1.0 +version = 2.7.5 style = defaultWithAlign diff --git a/build.sbt b/build.sbt index 644a97b..54f8975 100644 --- a/build.sbt +++ b/build.sbt @@ -43,20 +43,20 @@ lazy val root = (project in file(".")) .settings( name := "influxdb-scala", libraryDependencies ++= Seq( - "com.typesafe.play" %% "play-json" % playJsonVersion, - "com.typesafe.play" %% "play-ws-standalone" % playWsVersion, - "com.typesafe.play" %% "play-ws-standalone-json" % playWsVersion, - //"com.typesafe.scala-logging" %% "scala-logging" % "3.1.0", - "org.slf4j" % "slf4j-api" % slf4jVersion, - "org.slf4j" % "jcl-over-slf4j" % slf4jVersion, - // TEST - "ch.qos.logback" % "logback-classic" % logbackVersion % TestAndIntegrationTest, - "org.specs2" %% "specs2-core" % specs2Version % TestAndIntegrationTest, - "org.specs2" %% "specs2-junit" % specs2Version % TestAndIntegrationTest, - //"com.typesafe.play" %% "play-ahc-ws" % playVersion % TestAndIntegrationTest, // neede for play-mockws - "com.typesafe.play" %% "play-ahc-ws-standalone" % playWsVersion % TestAndIntegrationTest, - "com.whisk" %% "docker-testkit-core" % dockerTestkitVersion % TestAndIntegrationTest excludeAll (nettyExclusions: _*) - ).map(_.excludeAll(libraryExclusions: _*)) + "com.typesafe.play" %% "play-json" % playJsonVersion, + "com.typesafe.play" %% "play-ws-standalone" % playWsVersion, + "com.typesafe.play" %% "play-ws-standalone-json" % playWsVersion, + //"com.typesafe.scala-logging" %% "scala-logging" % "3.1.0", + "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.slf4j" % "jcl-over-slf4j" % slf4jVersion, + // TEST + "ch.qos.logback" % "logback-classic" % logbackVersion % TestAndIntegrationTest, + "org.specs2" %% "specs2-core" % specs2Version % TestAndIntegrationTest, + "org.specs2" %% "specs2-junit" % specs2Version % TestAndIntegrationTest, + //"com.typesafe.play" %% "play-ahc-ws" % playVersion % TestAndIntegrationTest, // neede for play-mockws + "com.typesafe.play" %% "play-ahc-ws-standalone" % playWsVersion % TestAndIntegrationTest, + "com.whisk" %% "docker-testkit-core" % dockerTestkitVersion % TestAndIntegrationTest excludeAll (nettyExclusions: _*) + ).map(_.excludeAll(libraryExclusions: _*)) ) .configs(IntegrationTest) .settings(Defaults.itSettings: _*) diff --git a/publish.sbt b/publish.sbt index d23cb34..c2b75d1 100644 --- a/publish.sbt +++ b/publish.sbt @@ -9,13 +9,12 @@ publishTo := { if (isSnapshot.value) Some("snapshots" at nexus + "content/repositories/snapshots") else - Some("releases" at nexus + "service/local/staging/deploy/maven2") + Some("releases" at nexus + "service/local/staging/deploy/maven2") } updateOptions := updateOptions.value.withGigahorse(false) -pomExtra := ( - https://github.com/waylayio/influxdb-scala +pomExtra := (https://github.com/waylayio/influxdb-scala MIT License @@ -44,4 +43,4 @@ pomExtra := ( Gabriel Reid https://github.com/gabrielreid - ) \ No newline at end of file + ) diff --git a/sonatype.sbt b/sonatype.sbt index f7895ae..735385f 100644 --- a/sonatype.sbt +++ b/sonatype.sbt @@ -1,4 +1,4 @@ credentials ++= (for { username <- Option(System.getenv().get("SONATYPE_USERNAME")) password <- Option(System.getenv().get("SONATYPE_PASSWORD")) -} yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", username, password)).toSeq \ No newline at end of file +} yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", username, password)).toSeq diff --git a/src/it/scala/io/waylay/influxdb/BeforeAfterAllStopOnError.scala b/src/it/scala/io/waylay/influxdb/BeforeAfterAllStopOnError.scala index 18de670..b7f4346 100644 --- a/src/it/scala/io/waylay/influxdb/BeforeAfterAllStopOnError.scala +++ b/src/it/scala/io/waylay/influxdb/BeforeAfterAllStopOnError.scala @@ -3,9 +3,7 @@ package io.waylay.influxdb import org.specs2.specification.core.{Fragments, SpecificationStructure} import org.specs2.specification.create.FragmentsFactory -trait BeforeAfterAllStopOnError - extends SpecificationStructure - with FragmentsFactory { +trait BeforeAfterAllStopOnError extends SpecificationStructure with FragmentsFactory { def beforeAll(): Unit def afterAll(): Unit diff --git a/src/it/scala/io/waylay/influxdb/IntegrationSpec.scala b/src/it/scala/io/waylay/influxdb/IntegrationSpec.scala index 0fe0db1..022e804 100644 --- a/src/it/scala/io/waylay/influxdb/IntegrationSpec.scala +++ b/src/it/scala/io/waylay/influxdb/IntegrationSpec.scala @@ -65,9 +65,8 @@ trait IntegrationSpec extends BeforeAfterAllStopOnError { wsClient.close() materializer.shutdown() actorSystem.terminate() - try { - containerManager.stop() - } catch { + try containerManager.stop() + catch { case e: Throwable => log.error(e.getMessage, e) } diff --git a/src/main/scala/io/waylay/influxdb/WriteProtocol.scala b/src/main/scala/io/waylay/influxdb/WriteProtocol.scala index 443a517..692532d 100644 --- a/src/main/scala/io/waylay/influxdb/WriteProtocol.scala +++ b/src/main/scala/io/waylay/influxdb/WriteProtocol.scala @@ -32,24 +32,22 @@ private[influxdb] object WriteProtocol extends SharedProtocol { val lines = points.map { point => val measurementName = escapeTag(point.measurementName) val tags = point.tags - .map { - case (key, value) => - "," + escapeTag(key) + "=" + escapeTag(value) + .map { case (key, value) => + "," + escapeTag(key) + "=" + escapeTag(value) } .mkString("") val fields = point.fields - .map { - case (key, fieldValue) => - val stringValue = fieldValue match { - case IInteger(value) => value.toString + "i" - case IFloat(value) => - //"%g" format value - // df.format(value) - value.toString.replace('E', 'e') - case IBoolean(value) => value.toString - case IString(value) => escapeValue(value) - } - escapeTag(key) + "=" + stringValue + .map { case (key, fieldValue) => + val stringValue = fieldValue match { + case IInteger(value) => value.toString + "i" + case IFloat(value) => + //"%g" format value + // df.format(value) + value.toString.replace('E', 'e') + case IBoolean(value) => value.toString + case IString(value) => escapeValue(value) + } + escapeTag(key) + "=" + stringValue } .mkString(",") val timestamp = applyPrecision(point.timestamp) diff --git a/src/main/scala/io/waylay/influxdb/query/InfluxQueryBuilder.scala b/src/main/scala/io/waylay/influxdb/query/InfluxQueryBuilder.scala index 9df4959..ed7a769 100644 --- a/src/main/scala/io/waylay/influxdb/query/InfluxQueryBuilder.scala +++ b/src/main/scala/io/waylay/influxdb/query/InfluxQueryBuilder.scala @@ -97,8 +97,8 @@ object InfluxQueryBuilder extends SharedProtocol { s""" |DELETE |WHERE ${escapeValue(tagSelector._1)}=${escapeStringLiteral(tagSelector._2)} - |""".stripMargin.trim + from.fold("")(i => s" AND time >= ${i.toEpochMilli}ms") + until.fold("")( - i => s" AND time <= ${i.toEpochMilli}ms" + |""".stripMargin.trim + from.fold("")(i => s" AND time >= ${i.toEpochMilli}ms") + until.fold("")(i => + s" AND time <= ${i.toEpochMilli}ms" ) /**