Skip to content
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
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -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

Expand Down
28 changes: 14 additions & 14 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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: _*)
Expand Down
7 changes: 3 additions & 4 deletions publish.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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 := (
<url>https://github.com/waylayio/influxdb-scala</url>
pomExtra := (<url>https://github.com/waylayio/influxdb-scala</url>
<licenses>
<license>
<name>MIT License</name>
Expand Down Expand Up @@ -44,4 +43,4 @@ pomExtra := (
<name>Gabriel Reid</name>
<url>https://github.com/gabrielreid</url>
</developer>
</developers>)
</developers>)
2 changes: 1 addition & 1 deletion sonatype.sbt
Original file line number Diff line number Diff line change
@@ -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
} yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", username, password)).toSeq
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions src/it/scala/io/waylay/influxdb/IntegrationSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
28 changes: 13 additions & 15 deletions src/main/scala/io/waylay/influxdb/WriteProtocol.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

/**
Expand Down