Skip to content

Commit

Permalink
Removed dropwizard dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
daravep committed Mar 14, 2024
1 parent 16e70f6 commit 3370e09
Show file tree
Hide file tree
Showing 31 changed files with 34 additions and 1,258 deletions.
5 changes: 0 additions & 5 deletions bazel-java-deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@ def install_java_deps():
"io.circe:circe-generic_{}:{}".format(scala_major_version, circe_version),
"io.circe:circe-parser_{}:{}".format(scala_major_version, circe_version),
"io.circe:circe-yaml_{}:{}".format(scala_major_version, "0.15.0-RC1"),
"io.dropwizard.metrics:metrics-core:{}".format(dropwizard_version),
"io.dropwizard.metrics:metrics-jmx:{}".format(dropwizard_version),
"io.dropwizard.metrics:metrics-jvm:{}".format(dropwizard_version),
# "io.gatling.highcharts:gatling-charts-highcharts:{}".format(gatling_version),
# "io.gatling:gatling-app:{}".format(gatling_version),
# "io.gatling:gatling-charts:{}".format(gatling_version),
Expand Down Expand Up @@ -199,7 +196,6 @@ def install_java_deps():
"io.opentelemetry:opentelemetry-sdk:{}".format(opentelemetry_version),
"io.opentelemetry:opentelemetry-semconv:{}-alpha".format(opentelemetry_version),
"io.prometheus:simpleclient:{}".format(prometheus_version),
"io.prometheus:simpleclient_dropwizard:{}".format(prometheus_version),
"io.prometheus:simpleclient_httpserver:{}".format(prometheus_version),
"io.prometheus:simpleclient_servlet:{}".format(prometheus_version),
"io.reactivex.rxjava2:rxjava:2.2.21",
Expand Down Expand Up @@ -266,7 +262,6 @@ def install_java_deps():
"org.wartremover:wartremover_{}:2.4.21".format(scala_version),
"org.xerial:sqlite-jdbc:3.36.0.1",
maven.artifact("com.github.pureconfig", "pureconfig-macros_2.12", "0.14.0", neverlink = True),
maven.artifact("io.dropwizard.metrics", "metrics-graphite", dropwizard_version, exclusions = ["com.rabbitmq:amqp-client"]),
],
fetch_sources = True,
maven_install_json = "@com_github_digital_asset_daml//:maven_install_{}.json".format(scala_major_version),
Expand Down
2 changes: 0 additions & 2 deletions canton/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ da_scala_library(
"@maven//:com_typesafe_scala_logging_scala_logging_2_13",
"@maven//:commons_codec_commons_codec",
"@maven//:commons_io_commons_io",
"@maven//:io_dropwizard_metrics_metrics_core",
"@maven//:io_grpc_grpc_api",
"@maven//:io_grpc_grpc_netty",
"@maven//:io_grpc_grpc_protobuf",
Expand Down Expand Up @@ -728,7 +727,6 @@ scala_library(
"@maven//:org_apache_pekko_pekko_actor_2_13",
"@maven//:org_apache_pekko_pekko_http_2_13",
"@maven//:org_apache_pekko_pekko_http_core_2_13",
"@maven//:org_parboiled_parboiled_2_13",
"@maven//:org_scala_lang_scala_reflect",
"@maven//:org_scalaz_scalaz_core_2_13",
"@maven//:org_slf4j_slf4j_api",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package com.digitalasset.canton.ledger.runner.common

import com.daml.jwt.JwtTimestampLeeway
import com.daml.lf.data.Ref
import com.daml.metrics.api.reporters.MetricsReporter
import com.daml.ports.Port
import com.digitalasset.canton.ledger.api.tls.TlsVersion.TlsVersion
import com.digitalasset.canton.ledger.api.tls.{SecretsUrl, TlsConfiguration, TlsVersion}
Expand Down Expand Up @@ -63,21 +62,6 @@ class PureConfigReaderWriter(secure: Boolean = true) {
.toRight(CannotConvert(str, Duration.getClass.getName, s"Could not convert $str"))
}

implicit val metricReporterReader: ConfigReader[MetricsReporter] = {
ConfigReader.fromString[MetricsReporter](ConvertHelpers.catchReadError { s =>
MetricsReporter.parseMetricsReporter(s)
})
}
implicit val metricReporterWriter: ConfigWriter[MetricsReporter] =
ConfigWriter.toString {
case MetricsReporter.Console => "console"
case MetricsReporter.Csv(directory) => s"csv://${directory.toAbsolutePath.toString}"
case MetricsReporter.Graphite(address, prefix) =>
s"graphite://${address.getHostName}:${address.getPort}/${prefix.getOrElse("")}"
case MetricsReporter.Prometheus(address) =>
s"prometheus://${address.getHostName}:${address.getPort}"
}

implicit val secretsUrlReader: ConfigReader[SecretsUrl] =
ConfigReader.fromString[SecretsUrl] { url =>
Right(SecretsUrl.fromString(url))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package com.digitalasset.canton.ledger.runner.common

import com.daml.jwt.JwtTimestampLeeway
import com.daml.metrics.api.reporters.MetricsReporter
import com.digitalasset.canton.ledger.api.tls.{SecretsUrl, TlsConfiguration, TlsVersion}
import com.digitalasset.canton.ledger.runner.common
import com.digitalasset.canton.ledger.runner.common.OptConfigValue.{
Expand Down Expand Up @@ -75,7 +74,6 @@ class PureConfigReaderWriterSpec
val readerWriter = new PureConfigReaderWriter(secure)
import readerWriter.*
testReaderWriterIsomorphism(secure, ArbitraryConfig.duration)
testReaderWriterIsomorphism(secure, ArbitraryConfig.metricsReporter)
testReaderWriterIsomorphism(secure, Gen.oneOf(TlsVersion.allVersions))
testReaderWriterIsomorphism(secure, ArbitraryConfig.tlsConfiguration)
testReaderWriterIsomorphism(secure, ArbitraryConfig.port)
Expand Down Expand Up @@ -207,36 +205,6 @@ class PureConfigReaderWriterSpec
.prettyPrint(0) should include("Unknown key")
}

behavior of "MetricsReporter"

it should "read/write against predefined values" in {
def compare(
reporter: MetricsReporter,
expectedString: String,
): Assertion = {
metricReporterWriter.to(reporter) shouldBe fromAnyRef(expectedString)
metricReporterReader.from(fromAnyRef(expectedString)).value shouldBe reporter
}
compare(
MetricsReporter.Prometheus(new InetSocketAddress("localhost", 1234)),
"prometheus://localhost:1234",
)
compare(
MetricsReporter.Graphite(new InetSocketAddress("localhost", 1234)),
"graphite://localhost:1234/",
)
compare(
MetricsReporter.Graphite(new InetSocketAddress("localhost", 1234), Some("test")),
"graphite://localhost:1234/test",
)
val path = Path.of("test").toAbsolutePath
compare(
MetricsReporter.Csv(path),
"csv://" + path.toString,
)
compare(MetricsReporter.Console, "console")
}

behavior of "SecretsUrl"

it should "read/write against predefined values" in {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package com.digitalasset.canton.metrics

import com.daml.metrics.api.MetricDoc.MetricQualification.{Debug, Saturation, Traffic}
import com.daml.metrics.api.MetricHandle.*
import com.daml.metrics.api.dropwizard.DropwizardTimer
import com.daml.metrics.api.{MetricDoc, MetricName}

class ServicesMetrics(
Expand Down Expand Up @@ -224,18 +223,6 @@ class ServicesMetrics(
object write {
val prefix: MetricName = ServicesMetrics.this.prefix :+ "write"

@MetricDoc.Tag(
summary = "The number of submitted transactions by the write service.",
description = """The write service is an internal interface for changing the state through
|the synchronization services. The methods in this interface are all methods
|that are supported uniformly across all ledger implementations. This metric
|exposes the total number of the sumbitted transactions.""",
qualification = Traffic,
)
@SuppressWarnings(Array("org.wartremover.warts.Null"))
val submitOperationForDocs: Timer =
DropwizardTimer(prefix :+ "submit_transaction" :+ "count", null)

@MetricDoc.FanInstanceTag
val submitTransaction: Timer = openTelemetryMetricsFactory.timer(prefix :+ "submit_transaction")
@MetricDoc.FanInstanceTag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import scalaz.\/
import scalaz.syntax.std.option.*

import java.nio.file.Path
import com.daml.metrics.api.reporters.MetricsReporter

final case class HttpServerConfig(
address: String = com.digitalasset.canton.cliopts.Http.defaultAddress,
Expand Down Expand Up @@ -81,12 +80,4 @@ object SharedConfigReaders {
} yield ident
}

implicit val uriCfgReader: ConfigReader[Uri] =
ConfigReader.fromString[Uri](ConvertHelpers.catchReadError(s => Uri(s)))

implicit val metricReporterReader: ConfigReader[MetricsReporter] = {
ConfigReader.fromString[MetricsReporter](ConvertHelpers.catchReadError { s =>
MetricsReporter.parseMetricsReporter(s.toLowerCase())
})
}
}
1 change: 0 additions & 1 deletion daml-script/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,5 @@ da_scala_test_suite(
"//observability/metrics",
"//test-common/canton/it-lib",
"@maven//:com_auth0_java_jwt",
"@maven//:io_dropwizard_metrics_metrics_core",
],
)
29 changes: 0 additions & 29 deletions ledger-service/cli-opts/BUILD.bazel

This file was deleted.

This file was deleted.

60 changes: 0 additions & 60 deletions ledger-service/cli-opts/src/main/scala/cliopts/Http.scala

This file was deleted.

102 changes: 0 additions & 102 deletions ledger-service/cli-opts/src/main/scala/cliopts/Logging.scala

This file was deleted.

Loading

0 comments on commit 3370e09

Please sign in to comment.