From c4c9de25bb19306feb1d278ec67e2bb5ca01efc4 Mon Sep 17 00:00:00 2001 From: Tim Evdokimov Date: Sun, 11 Apr 2021 11:05:23 +0200 Subject: [PATCH] Bump (#62) * push * dashboards fixed * v8 * bump build versions * cache bump * scoverage disabled for 2.12 Co-authored-by: timure --- README.md | 4 +- azure-build.yaml | 10 +++-- azure-release.yaml | 4 +- build.sbt | 5 ++- .../app/src/main/resources/application.conf | 18 +++----- .../main/scala/nl/pragmasoft/app/Main.scala | 4 +- examples/observability/docker-compose.yml | 2 +- .../dashboards/cassandra.json | 8 ++-- .../dashboards/dispatchers.json | 14 +++---- .../dashboards/jvm.json | 42 +++++++++---------- .../observability/prometheus/prometheus.yml | 2 +- project/Dependencies.scala | 14 +++---- project/build.properties | 2 +- project/plugins.sbt | 8 ++-- ...InstrumentedCassandraSessionProvider.scala | 28 ------------- version.sbt | 2 +- 16 files changed, 68 insertions(+), 99 deletions(-) diff --git a/README.md b/README.md index 32b55ca..c81b2a2 100644 --- a/README.md +++ b/README.md @@ -106,8 +106,8 @@ Sensors' bundled dashboards will be imported. ``` libraryDependencies ++= Seq( - "nl.pragmasoft.sensors" %% "sensors-core" % "0.1.0", - "nl.pragmasoft.sensors" %% "sensors-cassandra" % "0.1.0" + "nl.pragmasoft.sensors" %% "sensors-core" % "0.1.1", + "nl.pragmasoft.sensors" %% "sensors-cassandra" % "0.1.1" ) ``` diff --git a/azure-build.yaml b/azure-build.yaml index e3067ad..d77c4b1 100644 --- a/azure-build.yaml +++ b/azure-build.yaml @@ -15,7 +15,7 @@ variables: - name: IVY_HOME value: $(Pipeline.Workspace)/.ivy2 - name: CACHE_RUN_ID - value: "201009" + value: "210411" steps: @@ -33,7 +33,7 @@ steps: - task: JavaToolInstaller@0 inputs: - versionSpec: '11' + versionSpec: '8' jdkArchitectureOption: 'x64' jdkSourceOption: 'PreInstalled' cleanDestinationDirectory: false @@ -43,7 +43,9 @@ steps: inputs: targetType: 'inline' script: | - sbt -Divy.home=${IVY_HOME} -Dsbt.ivy.home=${IVY_HOME} "++2.12.12; coverage; test; coverageReport" && bash <(curl -s https://codecov.io/bash) + # coverage disabled due to https://github.com/scoverage/sbt-scoverage/issues/319 + # sbt -Divy.home=${IVY_HOME} -Dsbt.ivy.home=${IVY_HOME} "++2.12.13; coverage; test; coverageReport" && bash <(curl -s https://codecov.io/bash) + sbt -Divy.home=${IVY_HOME} -Dsbt.ivy.home=${IVY_HOME} "++2.12.13; test; " failOnStderr: false - task: Bash@3 @@ -51,5 +53,5 @@ steps: inputs: targetType: 'inline' script: | - sbt -Divy.home=${IVY_HOME} -Dsbt.ivy.home=${IVY_HOME} "++2.13.4; coverage; test; coverageReport" && bash <(curl -s https://codecov.io/bash) + sbt -Divy.home=${IVY_HOME} -Dsbt.ivy.home=${IVY_HOME} "++2.13.5; clean; coverage; test; coverageReport" && bash <(curl -s https://codecov.io/bash) failOnStderr: false diff --git a/azure-release.yaml b/azure-release.yaml index 6a75d84..aa5949d 100644 --- a/azure-release.yaml +++ b/azure-release.yaml @@ -36,8 +36,8 @@ steps: git config --global user.email "tim@@pragmasoft.nl" git config --global user.name "Azure Devops release pipeline" - sbt -Divy.home=${IVY_HOME} -Dsbt.ivy.home=${IVY_HOME} "++2.12.12; test" - sbt -Divy.home=${IVY_HOME} -Dsbt.ivy.home=${IVY_HOME} "++2.13.4; test" + sbt -Divy.home=${IVY_HOME} -Dsbt.ivy.home=${IVY_HOME} "++2.12.13; test" + sbt -Divy.home=${IVY_HOME} -Dsbt.ivy.home=${IVY_HOME} "++2.13.5; test" sbt -Divy.home=${IVY_HOME} -Dsbt.ivy.home=${IVY_HOME} "release with-defaults" rm -rf $(secring.secureFilePath) diff --git a/build.sbt b/build.sbt index 9b3450e..66af53c 100644 --- a/build.sbt +++ b/build.sbt @@ -4,8 +4,8 @@ import sbt.file val commonSettings = Defaults.coreDefaultSettings ++ Seq( organization := "nl.pragmasoft.sensors", - crossScalaVersions := Seq("2.13.4", "2.12.13"), - scalaVersion := "2.13.4", + crossScalaVersions := Seq("2.13.5", "2.12.13"), + scalaVersion := "2.13.5", testOptions += Tests.Argument(TestFrameworks.JUnit, "-v"), parallelExecution in Test := false, Test / fork := true, @@ -82,3 +82,4 @@ lazy val `app` = project.in(file("examples/app")) lazy val `root` = project.in(file(".")) .aggregate(app, `sensors-core`, `sensors-cassandra`) .settings(commonSettings ++ noPublishSettings) + .settings(name := "Akka Sensors") diff --git a/examples/app/src/main/resources/application.conf b/examples/app/src/main/resources/application.conf index 3d8b787..b8cd509 100644 --- a/examples/app/src/main/resources/application.conf +++ b/examples/app/src/main/resources/application.conf @@ -78,7 +78,6 @@ akka { cassandra { session-provider = "akka.sensors.cassandra.InstrumentedCassandraSessionProvider" - session-provider-config = "sensors-cassandra-session-provider" session-dispatcher = "akka.persistence.cassandra.default-dispatcher" datastax-java-driver-config = "datastax-java-driver" @@ -158,18 +157,13 @@ akka { } } -sensors-cassandra-session-provider { - profile = "akka-persistence-cassandra-profile" - username = "admin" - password = "admin" - local-datacenter = "datacenter1" - contact-points = "localhost" - port = 9042 -} - - datastax-java-driver { - load-balancing-policy.local-datacenter = "datacenter1" + basic { + username = "admin" + password = "admin" + contact-points = ["localhost"] + load-balancing-policy.local-datacenter = "datacenter1" + } advanced.metrics { session.enabled = [ connected-nodes, cql-requests, bytes-sent, bytes-received, cql-client-timeouts ] } diff --git a/examples/app/src/main/scala/nl/pragmasoft/app/Main.scala b/examples/app/src/main/scala/nl/pragmasoft/app/Main.scala index 4c1834f..83a958c 100644 --- a/examples/app/src/main/scala/nl/pragmasoft/app/Main.scala +++ b/examples/app/src/main/scala/nl/pragmasoft/app/Main.scala @@ -22,14 +22,14 @@ object Main extends IOApp with LazyLogging { val mainResource: Resource[IO, Server[IO]] = for { - _ <- Resource.liftF(IO.async[Unit] { callback => + _ <- Resource.eval(IO.async[Unit] { callback => Cluster(system).registerOnMemberUp { logger.info("Akka cluster is now up") callback(Right(())) } }) _ <- MetricService.resource( - InetSocketAddress.createUnresolved("0.0.0.0", 8081) + InetSocketAddress.createUnresolved("0.0.0.0", 9095) ) apiService <- ApiService.resource( InetSocketAddress.createUnresolved("0.0.0.0", 8080), diff --git a/examples/observability/docker-compose.yml b/examples/observability/docker-compose.yml index 87f3f4b..e482656 100644 --- a/examples/observability/docker-compose.yml +++ b/examples/observability/docker-compose.yml @@ -3,7 +3,7 @@ version: "3" services: app: image: app:latest - ports: ["8080:8080", "8081:8081"] + ports: ["8080:8080", "9095:9095"] networks: [observability] prometheus: diff --git a/examples/observability/grafana/plugins/sensors-prometheus-app/dashboards/cassandra.json b/examples/observability/grafana/plugins/sensors-prometheus-app/dashboards/cassandra.json index 198aae1..777ec4e 100644 --- a/examples/observability/grafana/plugins/sensors-prometheus-app/dashboards/cassandra.json +++ b/examples/observability/grafana/plugins/sensors-prometheus-app/dashboards/cassandra.json @@ -24,7 +24,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "description": "", "editable": true, "error": false, @@ -128,7 +128,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "description": "", "editable": true, "error": false, @@ -237,7 +237,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "description": "", "editable": true, "error": false, @@ -349,7 +349,7 @@ "text": "Sensors", "value": "Sensors" }, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "definition": "label_values(jvm_info,job)", "error": null, "hide": 0, diff --git a/examples/observability/grafana/plugins/sensors-prometheus-app/dashboards/dispatchers.json b/examples/observability/grafana/plugins/sensors-prometheus-app/dashboards/dispatchers.json index c3b9120..56a3f43 100644 --- a/examples/observability/grafana/plugins/sensors-prometheus-app/dashboards/dispatchers.json +++ b/examples/observability/grafana/plugins/sensors-prometheus-app/dashboards/dispatchers.json @@ -24,7 +24,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "description": "", "editable": true, "error": false, @@ -127,7 +127,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "description": "", "editable": true, "error": false, @@ -230,7 +230,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "description": "", "editable": true, "error": false, @@ -333,7 +333,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "description": "", "editable": true, "error": false, @@ -449,7 +449,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "description": "", "editable": true, "error": false, @@ -553,7 +553,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "description": "", "editable": true, "error": false, @@ -673,7 +673,7 @@ "text": "Sensors", "value": "Sensors" }, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "definition": "label_values(jvm_info,job)", "error": null, "hide": 0, diff --git a/examples/observability/grafana/plugins/sensors-prometheus-app/dashboards/jvm.json b/examples/observability/grafana/plugins/sensors-prometheus-app/dashboards/jvm.json index e8e5640..2b72dbe 100644 --- a/examples/observability/grafana/plugins/sensors-prometheus-app/dashboards/jvm.json +++ b/examples/observability/grafana/plugins/sensors-prometheus-app/dashboards/jvm.json @@ -22,7 +22,7 @@ "panels": [ { "collapsed": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "gridPos": { "h": 1, "w": 24, @@ -43,7 +43,7 @@ "#e24d42", "#299c46" ], - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "fieldConfig": { "defaults": { "custom": {} @@ -145,7 +145,7 @@ "#e24d42", "#73BF69" ], - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "fieldConfig": { "defaults": { "custom": {} @@ -234,7 +234,7 @@ "rgba(237, 129, 40, 0.89)", "#d44a3a" ], - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "decimals": 0, "fieldConfig": { "defaults": { @@ -324,7 +324,7 @@ "rgba(237, 129, 40, 0.89)", "#d44a3a" ], - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "decimals": null, "fieldConfig": { "defaults": { @@ -414,7 +414,7 @@ "rgba(237, 129, 40, 0.89)", "#d44a3a" ], - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "decimals": 0, "fieldConfig": { "defaults": { @@ -500,7 +500,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "decimals": 0, "fieldConfig": { "defaults": { @@ -610,7 +610,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "decimals": 0, "fieldConfig": { "defaults": { @@ -727,7 +727,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "decimals": 0, "fieldConfig": { "defaults": { @@ -857,7 +857,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "decimals": 0, "fieldConfig": { "defaults": { @@ -978,7 +978,7 @@ }, { "collapsed": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "gridPos": { "h": 1, "w": 24, @@ -995,7 +995,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "decimals": 0, "fieldConfig": { "defaults": { @@ -1105,7 +1105,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "decimals": 0, "fieldConfig": { "defaults": { @@ -1206,7 +1206,7 @@ }, { "collapsed": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "gridPos": { "h": 1, "w": 24, @@ -1224,7 +1224,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "description": "", "fieldConfig": { "defaults": { @@ -1390,7 +1390,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "description": "", "fieldConfig": { "defaults": { @@ -1557,7 +1557,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "description": "", "fieldConfig": { "defaults": { @@ -1724,7 +1724,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "description": "", "fieldConfig": { "defaults": { @@ -1891,7 +1891,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "description": "", "fieldConfig": { "defaults": { @@ -2067,7 +2067,7 @@ "text": "Sensors", "value": "Sensors" }, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "definition": "label_values(up,job)", "error": null, "hide": 0, @@ -2107,7 +2107,7 @@ "PS Survivor Space" ] }, - "datasource": "Prometheus-local", + "datasource": "Prometheus-Local", "definition": "label_values(jvm_memory_pool_bytes_max,pool)", "error": null, "hide": 2, diff --git a/examples/observability/prometheus/prometheus.yml b/examples/observability/prometheus/prometheus.yml index f4bbf61..dad568a 100644 --- a/examples/observability/prometheus/prometheus.yml +++ b/examples/observability/prometheus/prometheus.yml @@ -2,4 +2,4 @@ scrape_configs: - job_name: 'Sensors' scrape_interval: 10s static_configs: - - targets: ['app:8081'] + - targets: ['app:9095'] diff --git a/project/Dependencies.scala b/project/Dependencies.scala index c68353d..d65ba58 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -13,14 +13,14 @@ object Dependencies { object Logging { val slf4jversion = "1.7.30" val slf4jApi = "org.slf4j" % "slf4j-api" % slf4jversion - val scalaLogging = "com.typesafe.scala-logging" %% "scala-logging" % "3.9.2" + val scalaLogging = "com.typesafe.scala-logging" %% "scala-logging" % "3.9.3" val deps = Seq(slf4jApi, scalaLogging) } object Akka { - val akkaVersion = "2.6.12" + val akkaVersion = "2.6.14" val akkaManagementVersion = "1.0.9" - val akkaPersistenceCassandraVersion = "1.0.4" + val akkaPersistenceCassandraVersion = "1.0.5" val akkaHttpVersion = "10.2.1" @@ -44,7 +44,7 @@ object Dependencies { } object App { - val http4sVersion = "0.21.19" + val http4sVersion = "0.21.22" val circeVersion = "0.13.0" val http4s = "org.http4s" %% "http4s-core" % http4sVersion val http4sDsl = "org.http4s" %% "http4s-dsl" % http4sVersion @@ -63,11 +63,11 @@ object Dependencies { object Cassandra { val akkaPersistenceCassandraVersion = "1.0.4" - val cassandraDriverVersion = "4.10.0" + val cassandraDriverVersion = "4.11.0" val cassandraDriverCore = "com.datastax.oss" % "java-driver-core" % cassandraDriverVersion val cassandraDriverQueryBuilder = "com.datastax.oss" % "java-driver-query-builder" % cassandraDriverVersion - val cassandraDriverMetrics = "io.dropwizard.metrics" % "metrics-jmx" % "4.1.17" + val cassandraDriverMetrics = "io.dropwizard.metrics" % "metrics-jmx" % "4.1.19" val akkaPersistenceCassandra = "com.typesafe.akka" %% "akka-persistence-cassandra" % akkaPersistenceCassandraVersion val cassandraUnit = "org.cassandraunit" % "cassandra-unit" % "4.3.1.0" @@ -76,7 +76,7 @@ object Dependencies { object TestTools { val log = "ch.qos.logback" % "logback-classic" % "1.2.3" - val scalaTest = "org.scalatest" %% "scalatest" % "3.2.3" + val scalaTest = "org.scalatest" %% "scalatest" % "3.2.7" val deps = Logging.deps ++ testDeps(scalaTest, akkaInmemoryJournal, log) } diff --git a/project/build.properties b/project/build.properties index f9b06db..25c5cb0 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1,2 +1,2 @@ -sbt.version=1.4.7 +sbt.version=1.4.9 diff --git a/project/plugins.sbt b/project/plugins.sbt index 67f38ed..1ac7e9d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,13 +1,13 @@ import sbt.addSbtPlugin addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0") addSbtPlugin("no.arktekk.sbt" % "aether-deploy" % "0.26.0") -addSbtPlugin("com.twilio" % "sbt-guardrail" % "0.62.2") +addSbtPlugin("com.twilio" % "sbt-guardrail" % "0.63.0") addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.4.13") addSbtPlugin("net.vonbuchholtz" % "sbt-dependency-check" % "3.1.1") -addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.0") -addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.5.1") +addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1") +addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.5.2") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2") -addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.5") +addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.1.1") // 2.1.2 is released but unavailable?? addSbtPlugin("no.arktekk.sbt" % "aether-deploy" % "0.26.0") addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13") diff --git a/sensors-cassandra/src/main/scala-2.13/akka/sensors/cassandra/InstrumentedCassandraSessionProvider.scala b/sensors-cassandra/src/main/scala-2.13/akka/sensors/cassandra/InstrumentedCassandraSessionProvider.scala index e4acd7d..5e18769 100644 --- a/sensors-cassandra/src/main/scala-2.13/akka/sensors/cassandra/InstrumentedCassandraSessionProvider.scala +++ b/sensors-cassandra/src/main/scala-2.13/akka/sensors/cassandra/InstrumentedCassandraSessionProvider.scala @@ -16,34 +16,9 @@ import scala.compat.java8.FutureConverters.toScala import scala.concurrent.{ExecutionContext, Future} import scala.jdk.CollectionConverters._ -case class Settings( - contactPoints: List[String], - port: Int, - username: String, - password: String, - profile: String, - localDatacenter: String, -) - -object Settings { - def apply(config: Config) = - new Settings( - contactPoints = config.getString("contact-points").split(",").map(_.trim).toList, - port = config.getInt("port"), - username = config.getString("username"), - password = config.getString("password"), - profile = config.getString("profile"), - localDatacenter = config.getString("local-datacenter") - ) - -} class InstrumentedCassandraSessionProvider(system: ActorSystem, config: Config) extends DefaultSessionProvider(system, config) with LazyLogging { - private val settings = Settings( - system.classicSystem.settings.config.getConfig(config.getString("session-provider-config")) - ) - private val instanceId = UUID.randomUUID() private val metricRegistry = { @@ -81,9 +56,6 @@ class InstrumentedCassandraSessionProvider(system: ActorSystem, config: Config) .builder() .withMetricRegistry(metricRegistry) .withConfigLoader(driverConfigLoader) - .withAuthCredentials(settings.username, settings.password) - .addContactPoints(settings.contactPoints.map(InetSocketAddress.createUnresolved(_, settings.port)).asJavaCollection) - .withLocalDatacenter(settings.localDatacenter) .withClientId(instanceId) .withNodeStateListener(nodeStateListener) .buildAsync()) diff --git a/version.sbt b/version.sbt index e765444..e4149a8 100644 --- a/version.sbt +++ b/version.sbt @@ -1 +1 @@ -version in ThisBuild := "0.1.0" +version in ThisBuild := "0.1.1"