diff --git a/daml-script/runner/BUILD.bazel b/daml-script/runner/BUILD.bazel index 43bc4e12ca3..642010e4250 100644 --- a/daml-script/runner/BUILD.bazel +++ b/daml-script/runner/BUILD.bazel @@ -57,6 +57,7 @@ da_scala_library( "//ledger/ledger-api-common", "//libs-scala/auth-utils", "//libs-scala/contextualized-logging", + "//libs-scala/logging-entries", ], ) diff --git a/ledger-service/http-json/BUILD.bazel b/ledger-service/http-json/BUILD.bazel index 314cff68a56..b9ce52c3ec3 100644 --- a/ledger-service/http-json/BUILD.bazel +++ b/ledger-service/http-json/BUILD.bazel @@ -72,6 +72,7 @@ hj_scalacopts = lf_scalacopts + [ "//libs-scala/concurrent", "//libs-scala/contextualized-logging", "//libs-scala/doobie-slf4j", + "//libs-scala/logging-entries", "//libs-scala/ports", "//libs-scala/resources", "//libs-scala/scala-utils", @@ -252,6 +253,9 @@ alias( "@maven//:org_typelevel_cats_core", "@maven//:org_typelevel_cats_effect", ], + versioned_deps = { + "2.12": ["//libs-scala/logging-entries"], + }, visibility = ["//ledger-service:__subpackages__"], deps = [ ":http-json-{}".format(edition), diff --git a/ledger/ledger-api-client/BUILD.bazel b/ledger/ledger-api-client/BUILD.bazel index 75e33656e1b..99b0c4bd934 100644 --- a/ledger/ledger-api-client/BUILD.bazel +++ b/ledger/ledger-api-client/BUILD.bazel @@ -22,7 +22,10 @@ da_scala_library( ], tags = ["maven_coordinates=com.daml:ledger-api-client:__VERSION__"], versioned_deps = { - "2.12": ["//libs-scala/contextualized-logging"], # transient dependency, but 2.12 is confused + "2.12": [ + "//libs-scala/contextualized-logging", + "//libs-scala/logging-entries", + ], }, visibility = [ "//visibility:public", @@ -128,6 +131,7 @@ da_scala_test_suite( "//libs-scala/concurrent", "//libs-scala/contextualized-logging", "//libs-scala/grpc-utils", + "//libs-scala/logging-entries", "//libs-scala/ports", "//libs-scala/resources", "@maven//:ch_qos_logback_logback_classic", diff --git a/ledger/ledger-api-common/BUILD.bazel b/ledger/ledger-api-common/BUILD.bazel index 2587d2a8187..753fd38c5bb 100644 --- a/ledger/ledger-api-common/BUILD.bazel +++ b/ledger/ledger-api-common/BUILD.bazel @@ -21,6 +21,9 @@ da_scala_library( "@maven//:org_scalaz_scalaz_core", ], tags = ["maven_coordinates=com.daml:ledger-api-common:__VERSION__"], + versioned_deps = { + "2.13": ["//libs-scala/logging-entries"], + }, visibility = [ "//visibility:public", ], @@ -71,6 +74,7 @@ da_scala_library( "//ledger/ledger-api-domain", "//libs-scala/concurrent", "//libs-scala/contextualized-logging", + "//libs-scala/logging-entries", "@maven//:io_zipkin_brave_brave", ], ) @@ -118,6 +122,7 @@ da_scala_test_suite( "//libs-scala/concurrent", "//libs-scala/contextualized-logging", "//libs-scala/grpc-utils", + "//libs-scala/logging-entries", "@maven//:ch_qos_logback_logback_classic", "@maven//:ch_qos_logback_logback_core", "@maven//:io_dropwizard_metrics_metrics_core", diff --git a/ledger/ledger-api-domain/BUILD.bazel b/ledger/ledger-api-domain/BUILD.bazel index 571d52dba73..82c0671fbe9 100644 --- a/ledger/ledger-api-domain/BUILD.bazel +++ b/ledger/ledger-api-domain/BUILD.bazel @@ -20,7 +20,7 @@ da_scala_library( "//daml-lf/data", "//daml-lf/transaction", "//ledger/participant-state", - "//libs-scala/contextualized-logging", + "//libs-scala/logging-entries", "@maven//:io_zipkin_brave_brave", ], ) diff --git a/ledger/ledger-api-domain/src/main/scala/com/digitalasset/ledger/api/domain.scala b/ledger/ledger-api-domain/src/main/scala/com/digitalasset/ledger/api/domain.scala index 321f6ddfa7c..bdf1938efd5 100644 --- a/ledger/ledger-api-domain/src/main/scala/com/digitalasset/ledger/api/domain.scala +++ b/ledger/ledger-api-domain/src/main/scala/com/digitalasset/ledger/api/domain.scala @@ -12,8 +12,7 @@ import com.daml.lf.command.{Commands => LfCommands} import com.daml.lf.data.Ref import com.daml.lf.data.Ref.LedgerString.ordering import com.daml.lf.value.{Value => Lf} -import com.daml.logging.LoggingValue -import com.daml.logging.LoggingValue.ToLoggingValue +import com.daml.logging.entries.{LoggingValue, ToLoggingValue} import scalaz.syntax.tag._ import scalaz.{@@, Tag} diff --git a/ledger/participant-integration-api/BUILD.bazel b/ledger/participant-integration-api/BUILD.bazel index 367149f377e..104fbfc7a95 100644 --- a/ledger/participant-integration-api/BUILD.bazel +++ b/ledger/participant-integration-api/BUILD.bazel @@ -42,6 +42,7 @@ compile_deps = [ "//libs-scala/build-info", "//libs-scala/contextualized-logging", "//libs-scala/concurrent", + "//libs-scala/logging-entries", "//libs-scala/ports", "//libs-scala/resources", "//libs-scala/resources-akka", @@ -173,6 +174,7 @@ da_scala_library( "//ledger/participant-state-index", "//ledger/test-common:dar-files-stable-lib", "//libs-scala/contextualized-logging", + "//libs-scala/logging-entries", "//libs-scala/oracle-testing", "//libs-scala/ports", "//libs-scala/postgresql-testing", @@ -259,6 +261,7 @@ da_scala_test_suite( "//libs-scala/concurrent", "//libs-scala/contextualized-logging", "//libs-scala/grpc-utils", + "//libs-scala/logging-entries", "//libs-scala/ports", "//libs-scala/postgresql-testing", "//libs-scala/resources", @@ -324,6 +327,7 @@ da_scala_test_suite( "//ledger/participant-state", "//ledger/participant-state-index", "//libs-scala/contextualized-logging", + "//libs-scala/logging-entries", "//libs-scala/oracle-testing", "//libs-scala/ports", "//libs-scala/resources", diff --git a/ledger/participant-integration-api/src/main/scala/platform/apiserver/services/ApiCommandCompletionService.scala b/ledger/participant-integration-api/src/main/scala/platform/apiserver/services/ApiCommandCompletionService.scala index ce3f863e162..157099c54dc 100644 --- a/ledger/participant-integration-api/src/main/scala/platform/apiserver/services/ApiCommandCompletionService.scala +++ b/ledger/participant-integration-api/src/main/scala/platform/apiserver/services/ApiCommandCompletionService.scala @@ -16,7 +16,8 @@ import com.daml.ledger.api.v1.command_completion_service._ import com.daml.ledger.api.validation.PartyNameChecker import com.daml.ledger.participant.state.index.v2.IndexCompletionsService import com.daml.logging.LoggingContext.withEnrichedLoggingContext -import com.daml.logging.{ContextualizedLogger, LoggingContext, LoggingEntries} +import com.daml.logging.entries.LoggingEntries +import com.daml.logging.{ContextualizedLogger, LoggingContext} import com.daml.metrics.Metrics import com.daml.platform.api.grpc.GrpcApiService import com.daml.platform.server.api.services.domain.CommandCompletionService diff --git a/ledger/participant-integration-api/src/main/scala/platform/apiserver/services/logging/package.scala b/ledger/participant-integration-api/src/main/scala/platform/apiserver/services/logging/package.scala index c78b076adb9..82d881d437d 100644 --- a/ledger/participant-integration-api/src/main/scala/platform/apiserver/services/logging/package.scala +++ b/ledger/participant-integration-api/src/main/scala/platform/apiserver/services/logging/package.scala @@ -16,7 +16,7 @@ import com.daml.ledger.api.domain.{ TransactionId, WorkflowId, } -import com.daml.logging.{LoggingEntries, LoggingEntry, LoggingValue} +import com.daml.logging.entries.{LoggingEntries, LoggingEntry, LoggingValue} import scalaz.syntax.tag.ToTagOps package object logging { diff --git a/ledger/participant-integration-api/src/main/scala/platform/apiserver/services/transaction/ApiTransactionService.scala b/ledger/participant-integration-api/src/main/scala/platform/apiserver/services/transaction/ApiTransactionService.scala index a60f0e071c6..34445a1cdf2 100644 --- a/ledger/participant-integration-api/src/main/scala/platform/apiserver/services/transaction/ApiTransactionService.scala +++ b/ledger/participant-integration-api/src/main/scala/platform/apiserver/services/transaction/ApiTransactionService.scala @@ -20,7 +20,8 @@ import com.daml.ledger.api.validation.PartyNameChecker import com.daml.ledger.participant.state.index.v2.IndexTransactionsService import com.daml.lf.data.Ref.Party import com.daml.logging.LoggingContext.withEnrichedLoggingContext -import com.daml.logging.{ContextualizedLogger, LoggingContext, LoggingEntries} +import com.daml.logging.entries.LoggingEntries +import com.daml.logging.{ContextualizedLogger, LoggingContext} import com.daml.metrics.Metrics import com.daml.platform.apiserver.services.transaction.ApiTransactionService._ import com.daml.platform.apiserver.services.{StreamMetrics, logging} diff --git a/ledger/participant-integration-api/src/main/scala/platform/indexer/ExecuteUpdate.scala b/ledger/participant-integration-api/src/main/scala/platform/indexer/ExecuteUpdate.scala index 64a748df567..7bc29e9dfd9 100644 --- a/ledger/participant-integration-api/src/main/scala/platform/indexer/ExecuteUpdate.scala +++ b/ledger/participant-integration-api/src/main/scala/platform/indexer/ExecuteUpdate.scala @@ -27,7 +27,8 @@ import com.daml.ledger.participant.state.v1.{ import com.daml.ledger.resources.ResourceOwner import com.daml.lf.data.Time.Timestamp import com.daml.logging.LoggingContext.withEnrichedLoggingContextFrom -import com.daml.logging.{ContextualizedLogger, LoggingContext, LoggingEntries, LoggingEntry} +import com.daml.logging.entries.{LoggingEntries, LoggingEntry} +import com.daml.logging.{ContextualizedLogger, LoggingContext} import com.daml.metrics.{Metrics, Timed} import com.daml.platform.indexer.ExecuteUpdate.ExecuteUpdateFlow import com.daml.platform.indexer.OffsetUpdate.PreparedTransactionInsert diff --git a/ledger/participant-integration-api/src/main/scala/platform/indexer/parallel/IndexerLoggingContext.scala b/ledger/participant-integration-api/src/main/scala/platform/indexer/parallel/IndexerLoggingContext.scala index 0fa9ec29f49..c95f9e074a1 100644 --- a/ledger/participant-integration-api/src/main/scala/platform/indexer/parallel/IndexerLoggingContext.scala +++ b/ledger/participant-integration-api/src/main/scala/platform/indexer/parallel/IndexerLoggingContext.scala @@ -27,7 +27,7 @@ import com.daml.ledger.participant.state.v1.{ WorkflowId, } import com.daml.lf.data.Time.Timestamp -import com.daml.logging.{LoggingEntries, LoggingEntry} +import com.daml.logging.entries.{LoggingEntries, LoggingEntry} object IndexerLoggingContext { def loggingEntriesFor( diff --git a/ledger/participant-integration-api/src/main/scala/platform/store/appendonlydao/JdbcLedgerDao.scala b/ledger/participant-integration-api/src/main/scala/platform/store/appendonlydao/JdbcLedgerDao.scala index d6c7a1afd04..5706f936d1c 100644 --- a/ledger/participant-integration-api/src/main/scala/platform/store/appendonlydao/JdbcLedgerDao.scala +++ b/ledger/participant-integration-api/src/main/scala/platform/store/appendonlydao/JdbcLedgerDao.scala @@ -27,7 +27,8 @@ import com.daml.lf.data.{Ref, Time} import com.daml.lf.engine.ValueEnricher import com.daml.lf.transaction.BlindingInfo import com.daml.logging.LoggingContext.withEnrichedLoggingContext -import com.daml.logging.{ContextualizedLogger, LoggingContext, LoggingEntry} +import com.daml.logging.entries.LoggingEntry +import com.daml.logging.{ContextualizedLogger, LoggingContext} import com.daml.metrics.{Metrics, Timed} import com.daml.platform.configuration.ServerRole import com.daml.platform.indexer.{CurrentOffset, IncrementalOffsetStep, OffsetStep} diff --git a/ledger/participant-integration-api/src/main/scala/platform/store/dao/JdbcLedgerDao.scala b/ledger/participant-integration-api/src/main/scala/platform/store/dao/JdbcLedgerDao.scala index 2afdea7b073..464e119fed5 100644 --- a/ledger/participant-integration-api/src/main/scala/platform/store/dao/JdbcLedgerDao.scala +++ b/ledger/participant-integration-api/src/main/scala/platform/store/dao/JdbcLedgerDao.scala @@ -40,7 +40,8 @@ import com.daml.lf.data.Ref.{PackageId, Party} import com.daml.lf.engine.ValueEnricher import com.daml.lf.transaction.BlindingInfo import com.daml.logging.LoggingContext.withEnrichedLoggingContext -import com.daml.logging.{ContextualizedLogger, LoggingContext, LoggingEntry} +import com.daml.logging.entries.LoggingEntry +import com.daml.logging.{ContextualizedLogger, LoggingContext} import com.daml.metrics.{Metrics, Timed} import com.daml.platform.configuration.ServerRole import com.daml.platform.indexer.{CurrentOffset, OffsetStep} @@ -58,13 +59,13 @@ import com.daml.platform.store.entries.{ PartyLedgerEntry, } import scalaz.syntax.tag._ +import spray.json.DefaultJsonProtocol._ +import spray.json._ import scala.concurrent.duration._ import scala.concurrent.{ExecutionContext, Future} import scala.util.Try import scala.util.control.NonFatal -import spray.json._ -import spray.json.DefaultJsonProtocol._ private final case class ParsedPartyData( party: String, diff --git a/ledger/participant-state/BUILD.bazel b/ledger/participant-state/BUILD.bazel index 0ecfaed2350..d8c69f12dbb 100644 --- a/ledger/participant-state/BUILD.bazel +++ b/ledger/participant-state/BUILD.bazel @@ -31,7 +31,7 @@ da_scala_library( "//ledger/ledger-api-health", "//ledger/metrics", "//ledger/participant-state/protobuf:ledger_configuration_proto_java", - "//libs-scala/contextualized-logging", + "//libs-scala/logging-entries", "@maven//:com_google_protobuf_protobuf_java", "@maven//:org_slf4j_slf4j_api", ], diff --git a/ledger/participant-state/kvutils/BUILD.bazel b/ledger/participant-state/kvutils/BUILD.bazel index 95b4ac4dae7..2d2ad0b5a61 100644 --- a/ledger/participant-state/kvutils/BUILD.bazel +++ b/ledger/participant-state/kvutils/BUILD.bazel @@ -59,6 +59,7 @@ da_scala_library( "//ledger/participant-state/protobuf:ledger_configuration_proto_java", "//libs-scala/concurrent", "//libs-scala/contextualized-logging", + "//libs-scala/logging-entries", "//libs-scala/resources", "//libs-scala/resources-akka", "//libs-scala/resources-grpc", @@ -117,6 +118,7 @@ da_scala_library( "//ledger/test-common", "//ledger/test-common:dar-files-stable-lib", "//libs-scala/contextualized-logging", + "//libs-scala/logging-entries", "//libs-scala/resources", "@maven//:com_google_protobuf_protobuf_java", "@maven//:io_dropwizard_metrics_metrics_core", @@ -175,6 +177,7 @@ da_scala_test_suite( "//ledger/test-common", "//ledger/test-common:dar-files-stable-lib", "//libs-scala/contextualized-logging", + "//libs-scala/logging-entries", "@maven//:com_google_guava_guava", "@maven//:com_google_protobuf_protobuf_java", "@maven//:io_dropwizard_metrics_metrics_core", diff --git a/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/committer/Committer.scala b/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/committer/Committer.scala index 526ae883e14..36c749a155b 100644 --- a/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/committer/Committer.scala +++ b/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/committer/Committer.scala @@ -19,7 +19,8 @@ import com.daml.ledger.participant.state.v1.{Configuration, ParticipantId} import com.daml.lf.data.Time import com.daml.lf.data.Time.Timestamp import com.daml.logging.LoggingContext.withEnrichedLoggingContextFrom -import com.daml.logging.{ContextualizedLogger, LoggingContext, LoggingEntries} +import com.daml.logging.entries.LoggingEntries +import com.daml.logging.{ContextualizedLogger, LoggingContext} import com.daml.metrics.Metrics /** A committer either processes or pre-executes a submission, with its inputs into an ordered set of output state and diff --git a/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/committer/ConfigCommitter.scala b/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/committer/ConfigCommitter.scala index 24c8e96a40f..32af1dfc942 100644 --- a/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/committer/ConfigCommitter.scala +++ b/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/committer/ConfigCommitter.scala @@ -12,7 +12,8 @@ import com.daml.ledger.participant.state.kvutils.DamlKvutils._ import com.daml.ledger.participant.state.kvutils.committer.Committer._ import com.daml.ledger.participant.state.v1.Configuration import com.daml.lf.data.Time.Timestamp -import com.daml.logging.{ContextualizedLogger, LoggingContext, LoggingEntries} +import com.daml.logging.entries.LoggingEntries +import com.daml.logging.{ContextualizedLogger, LoggingContext} import com.daml.metrics.Metrics private[kvutils] object ConfigCommitter { diff --git a/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/committer/PackageCommitter.scala b/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/committer/PackageCommitter.scala index ff4739eb34a..7f147ca05ce 100644 --- a/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/committer/PackageCommitter.scala +++ b/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/committer/PackageCommitter.scala @@ -16,7 +16,8 @@ import com.daml.lf.data.Ref.PackageId import com.daml.lf.data.Time.Timestamp import com.daml.lf.engine.Engine import com.daml.lf.language.Ast -import com.daml.logging.{ContextualizedLogger, LoggingContext, LoggingEntries} +import com.daml.logging.entries.LoggingEntries +import com.daml.logging.{ContextualizedLogger, LoggingContext} import com.daml.metrics.Metrics import com.google.protobuf.ByteString diff --git a/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/committer/PartyAllocationCommitter.scala b/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/committer/PartyAllocationCommitter.scala index cb31950968d..dc84fcc38d5 100644 --- a/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/committer/PartyAllocationCommitter.scala +++ b/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/committer/PartyAllocationCommitter.scala @@ -8,7 +8,8 @@ import com.daml.ledger.participant.state.kvutils.DamlKvutils._ import com.daml.ledger.participant.state.kvutils.committer.Committer.buildLogEntryWithOptionalRecordTime import com.daml.lf.data.Ref import com.daml.lf.data.Time.Timestamp -import com.daml.logging.{ContextualizedLogger, LoggingContext, LoggingEntries} +import com.daml.logging.entries.LoggingEntries +import com.daml.logging.{ContextualizedLogger, LoggingContext} import com.daml.metrics.Metrics private[kvutils] object PartyAllocationCommitter { diff --git a/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/committer/transaction/TransactionCommitter.scala b/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/committer/transaction/TransactionCommitter.scala index e9a5b6a3331..85916baf4a8 100644 --- a/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/committer/transaction/TransactionCommitter.scala +++ b/ledger/participant-state/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/committer/transaction/TransactionCommitter.scala @@ -32,7 +32,8 @@ import com.daml.lf.transaction.{ import com.daml.lf.value.Value import com.daml.lf.value.Value.ContractId import com.daml.logging.LoggingContext.withEnrichedLoggingContext -import com.daml.logging.{ContextualizedLogger, LoggingContext, LoggingEntries} +import com.daml.logging.entries.LoggingEntries +import com.daml.logging.{ContextualizedLogger, LoggingContext} import com.daml.metrics.Metrics import com.google.protobuf.{Timestamp => ProtoTimestamp} diff --git a/ledger/participant-state/kvutils/src/test/suite/scala/com/daml/ledger/participant/state/kvutils/committer/CommitterSpec.scala b/ledger/participant-state/kvutils/src/test/suite/scala/com/daml/ledger/participant/state/kvutils/committer/CommitterSpec.scala index bcdfff83493..c9a95b450cc 100644 --- a/ledger/participant-state/kvutils/src/test/suite/scala/com/daml/ledger/participant/state/kvutils/committer/CommitterSpec.scala +++ b/ledger/participant-state/kvutils/src/test/suite/scala/com/daml/ledger/participant/state/kvutils/committer/CommitterSpec.scala @@ -14,7 +14,8 @@ import com.daml.ledger.participant.state.kvutils.{DamlKvutils, Err} import com.daml.ledger.participant.state.protobuf.LedgerConfiguration import com.daml.ledger.participant.state.v1.{Configuration, TimeModel} import com.daml.lf.data.Time.Timestamp -import com.daml.logging.{LoggingContext, LoggingEntries} +import com.daml.logging.LoggingContext +import com.daml.logging.entries.LoggingEntries import com.daml.metrics.Metrics import org.mockito.MockitoSugar import org.scalatest.matchers.should.Matchers diff --git a/ledger/participant-state/src/main/scala/com/daml/ledger/participant/state/v1/Offset.scala b/ledger/participant-state/src/main/scala/com/daml/ledger/participant/state/v1/Offset.scala index 12fd451e43b..1b72264e400 100644 --- a/ledger/participant-state/src/main/scala/com/daml/ledger/participant/state/v1/Offset.scala +++ b/ledger/participant-state/src/main/scala/com/daml/ledger/participant/state/v1/Offset.scala @@ -6,8 +6,7 @@ package com.daml.ledger.participant.state.v1 import java.io.InputStream import com.daml.lf.data.{Bytes, Ref} -import com.daml.logging.LoggingValue -import com.daml.logging.LoggingValue.ToLoggingValue +import com.daml.logging.entries.{LoggingValue, ToLoggingValue} /** Offsets into streams with hierarchical addressing. * @@ -44,6 +43,6 @@ object Offset { implicit object `Offset to LoggingValue` extends ToLoggingValue[Offset] { override def apply(value: Offset): LoggingValue = - new LoggingValue.OfString(value.toHexString) + LoggingValue.OfString(value.toHexString) } } diff --git a/ledger/recovering-indexer-integration-tests/BUILD.bazel b/ledger/recovering-indexer-integration-tests/BUILD.bazel index 5c413b1f046..d363f81150c 100644 --- a/ledger/recovering-indexer-integration-tests/BUILD.bazel +++ b/ledger/recovering-indexer-integration-tests/BUILD.bazel @@ -18,6 +18,11 @@ da_scala_test_suite( "@maven//:org_scalactic_scalactic", "@maven//:org_scalatest_scalatest", ], + versioned_deps = { + "2.12": [ + "//libs-scala/logging-entries", + ], + }, runtime_deps = [ "@maven//:ch_qos_logback_logback_classic", "@maven//:ch_qos_logback_logback_core", diff --git a/ledger/sandbox-classic/BUILD.bazel b/ledger/sandbox-classic/BUILD.bazel index 429ead86449..4a8d0b42ca6 100644 --- a/ledger/sandbox-classic/BUILD.bazel +++ b/ledger/sandbox-classic/BUILD.bazel @@ -82,6 +82,7 @@ alias( "//libs-scala/build-info", "//libs-scala/concurrent", "//libs-scala/contextualized-logging", + "//libs-scala/logging-entries", "//libs-scala/ports", "//libs-scala/resources", "//libs-scala/resources-akka", @@ -217,6 +218,7 @@ test_deps = [ "//libs-scala/contextualized-logging", "//libs-scala/concurrent", "//libs-scala/grpc-utils", + "//libs-scala/logging-entries", "//libs-scala/ports", "//libs-scala/postgresql-testing", "//libs-scala/resources", diff --git a/ledger/sandbox-common/BUILD.bazel b/ledger/sandbox-common/BUILD.bazel index 2c7a71a527f..852137a8471 100644 --- a/ledger/sandbox-common/BUILD.bazel +++ b/ledger/sandbox-common/BUILD.bazel @@ -43,6 +43,7 @@ da_scala_library( "//libs-scala/build-info", "//libs-scala/concurrent", "//libs-scala/contextualized-logging", + "//libs-scala/logging-entries", "//libs-scala/ports", "@maven//:ch_qos_logback_logback_classic", "@maven//:com_auth0_java_jwt", @@ -137,6 +138,7 @@ da_scala_library( "//ledger/test-common", "//ledger/test-common:dar-files-stable-lib", "//libs-scala/contextualized-logging", + "//libs-scala/logging-entries", "//libs-scala/ports", "//libs-scala/postgresql-testing", "//libs-scala/resources", diff --git a/ledger/sandbox-common/src/main/scala/platform/sandbox/logging/package.scala b/ledger/sandbox-common/src/main/scala/platform/sandbox/logging/package.scala index e21e2b99a62..72e2704d265 100644 --- a/ledger/sandbox-common/src/main/scala/platform/sandbox/logging/package.scala +++ b/ledger/sandbox-common/src/main/scala/platform/sandbox/logging/package.scala @@ -4,7 +4,7 @@ package com.daml.platform.sandbox import com.daml.ledger.participant.state.v1.ParticipantId -import com.daml.logging.LoggingEntry +import com.daml.logging.entries.LoggingEntry package object logging { diff --git a/libs-scala/contextualized-logging/BUILD.bazel b/libs-scala/contextualized-logging/BUILD.bazel index 18abaa51fe7..4fef409ea70 100644 --- a/libs-scala/contextualized-logging/BUILD.bazel +++ b/libs-scala/contextualized-logging/BUILD.bazel @@ -24,6 +24,7 @@ da_scala_library( ], deps = [ "//libs-scala/grpc-utils", + "//libs-scala/logging-entries", "@maven//:com_fasterxml_jackson_core_jackson_core", "@maven//:io_grpc_grpc_api", "@maven//:net_logstash_logback_logstash_logback_encoder", @@ -48,6 +49,7 @@ da_scala_test_suite( ], deps = [ ":contextualized-logging", + "//libs-scala/logging-entries", "@maven//:ch_qos_logback_logback_classic", "@maven//:ch_qos_logback_logback_core", "@maven//:com_fasterxml_jackson_core_jackson_core", diff --git a/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingContext.scala b/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingContext.scala index d68b19aeb3e..9ad7218d973 100644 --- a/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingContext.scala +++ b/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingContext.scala @@ -3,6 +3,7 @@ package com.daml.logging +import com.daml.logging.entries._ import net.logstash.logback.argument.StructuredArgument import org.slf4j.Marker @@ -78,7 +79,7 @@ object LoggingContext { final class LoggingContext private (entries: LoggingEntries) { private lazy val forLogging: Marker with StructuredArgument = - entries.loggingMarker + new LoggingMarker(entries.contents) private[logging] def ifEmpty(doThis: => Unit)( ifNot: Marker with StructuredArgument => Unit diff --git a/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingContextOf.scala b/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingContextOf.scala index d8bb70db989..6a650fc46dd 100644 --- a/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingContextOf.scala +++ b/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingContextOf.scala @@ -3,6 +3,8 @@ package com.daml.logging +import com.daml.logging.entries.{LoggingEntries, LoggingEntry} + import scala.annotation.nowarn import scala.language.implicitConversions diff --git a/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingMarker.scala b/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingMarker.scala index 0e2b63ea163..9c9e07f8dad 100644 --- a/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingMarker.scala +++ b/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingMarker.scala @@ -3,6 +3,7 @@ package com.daml.logging +import com.daml.logging.entries.{LoggingKey, LoggingValue} import com.fasterxml.jackson.core.JsonGenerator import net.logstash.logback.argument.StructuredArgument import net.logstash.logback.marker.LogstashMarker diff --git a/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingValue.scala b/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingValue.scala deleted file mode 100644 index 85e1a4e7725..00000000000 --- a/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingValue.scala +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.daml.logging - -import java.time.{Duration, Instant} - -import scala.language.implicitConversions - -sealed trait LoggingValue - -object LoggingValue { - final object Empty extends LoggingValue - - final object False extends LoggingValue - - final object True extends LoggingValue - - final case class OfString(value: String) extends LoggingValue - - final case class OfInt(value: Int) extends LoggingValue - - final case class OfLong(value: Long) extends LoggingValue - - final case class OfIterable(sequence: Iterable[LoggingValue]) extends LoggingValue - - final case class Nested(entries: LoggingEntries) extends LoggingValue - - trait ToLoggingValue[-T] { - def apply(value: T): LoggingValue - } - - @inline - implicit def from[T](value: T)(implicit toLoggingValue: ToLoggingValue[T]): LoggingValue = - toLoggingValue(value) - - // This is not implicit because we only want to expose it for specific types. - val ToStringToLoggingValue: ToLoggingValue[Any] = value => OfString(value.toString) - - implicit val `String to LoggingValue`: ToLoggingValue[String] = OfString(_) - - implicit val `Boolean to LoggingValue`: ToLoggingValue[Boolean] = { - case false => False - case true => True - } - - implicit val `Int to LoggingValue`: ToLoggingValue[Int] = OfInt(_) - - implicit val `Long to LoggingValue`: ToLoggingValue[Long] = OfLong(_) - - implicit val `Instant to LoggingValue`: ToLoggingValue[Instant] = ToStringToLoggingValue - - implicit val `Duration to LoggingValue`: ToLoggingValue[Duration] = ToStringToLoggingValue - - implicit def `Option[T] to LoggingValue`[T](implicit - elementToLoggingValue: ToLoggingValue[T] - ): ToLoggingValue[Option[T]] = { - case None => Empty - case Some(value) => elementToLoggingValue(value) - } - - implicit def `Iterable[T] to LoggingValue`[T](implicit - elementToLoggingValue: ToLoggingValue[T] - ): ToLoggingValue[Iterable[T]] = - sequence => OfIterable(sequence.view.map(elementToLoggingValue.apply)) -} diff --git a/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingValueSerializer.scala b/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingValueSerializer.scala index 02727ddb856..6c9572b7fb3 100644 --- a/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingValueSerializer.scala +++ b/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingValueSerializer.scala @@ -3,6 +3,7 @@ package com.daml.logging +import com.daml.logging.entries.LoggingValue import com.fasterxml.jackson.core.JsonGenerator private[logging] object LoggingValueSerializer { @@ -26,7 +27,7 @@ private[logging] object LoggingValueSerializer { generator.writeEndArray() case LoggingValue.Nested(entries) => generator.writeStartObject() - entries.loggingMarker.writeTo(generator) + new LoggingMarker(entries.contents).writeTo(generator) generator.writeEndObject() } } diff --git a/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/package.scala b/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/package.scala index 3fb613628d0..417707114fc 100644 --- a/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/package.scala +++ b/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/package.scala @@ -5,7 +5,4 @@ package com.daml package object logging { type LoggingContextOf[+P] = LoggingContextOf.Module.Instance.T[P] - - type LoggingKey = String - type LoggingEntry = (LoggingKey, LoggingValue) } diff --git a/libs-scala/contextualized-logging/src/test/suite/scala/com/digitalasset/logging/ContextualizedLoggerSpec.scala b/libs-scala/contextualized-logging/src/test/suite/scala/com/digitalasset/logging/ContextualizedLoggerSpec.scala index 4a1d4f84014..dae8a876665 100644 --- a/libs-scala/contextualized-logging/src/test/suite/scala/com/digitalasset/logging/ContextualizedLoggerSpec.scala +++ b/libs-scala/contextualized-logging/src/test/suite/scala/com/digitalasset/logging/ContextualizedLoggerSpec.scala @@ -6,8 +6,8 @@ package com.daml.logging import akka.actor.ActorSystem import akka.stream.Materializer import akka.stream.scaladsl.{Sink, Source} -import org.mockito.ArgumentMatchersSugar -import org.mockito.MockitoSugar +import com.daml.logging.entries.LoggingEntry +import org.mockito.{ArgumentMatchersSugar, MockitoSugar} import org.scalatest.flatspec.AnyFlatSpec import org.scalatest.matchers.should.Matchers import org.slf4j.event.{EventConstants, Level} diff --git a/libs-scala/contextualized-logging/src/test/suite/scala/com/digitalasset/logging/LoggingValueSpec.scala b/libs-scala/contextualized-logging/src/test/suite/scala/com/digitalasset/logging/LoggingValueSerializerSpec.scala similarity index 73% rename from libs-scala/contextualized-logging/src/test/suite/scala/com/digitalasset/logging/LoggingValueSpec.scala rename to libs-scala/contextualized-logging/src/test/suite/scala/com/digitalasset/logging/LoggingValueSerializerSpec.scala index 37b115a68a3..59ab8fd462d 100644 --- a/libs-scala/contextualized-logging/src/test/suite/scala/com/digitalasset/logging/LoggingValueSpec.scala +++ b/libs-scala/contextualized-logging/src/test/suite/scala/com/digitalasset/logging/LoggingValueSerializerSpec.scala @@ -5,66 +5,67 @@ package com.daml.logging import java.io.StringWriter -import com.daml.logging.LoggingValueSpec._ +import com.daml.logging.LoggingValueSerializerSpec._ +import com.daml.logging.entries.LoggingValue import com.fasterxml.jackson.core.JsonFactory import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec -class LoggingValueSpec extends AnyWordSpec with Matchers { - "a logging value" can { - "be constructed from the boolean `false`" in { +class LoggingValueSerializerSpec extends AnyWordSpec with Matchers { + "the serializer" can { + "serialize the boolean `false`" in { val value = LoggingValue.from(false) writingToGenerator(value) should be("false") } - "be constructed from the boolean `true`" in { + "serialize the boolean `true`" in { val value = LoggingValue.from(true) writingToGenerator(value) should be("true") } - "be constructed from a string" in { + "serialize a string" in { val value = LoggingValue.from("foo bar") writingToGenerator(value) should be("\"foo bar\"") } - "be constructed from an int" in { + "serialize an int" in { val value = LoggingValue.from(1981) writingToGenerator(value) should be("1981") } - "be constructed from a long" in { + "serialize a long" in { val value = LoggingValue.from(Long.MaxValue) writingToGenerator(value) should be("9223372036854775807") } - "be constructed from a defined optional value" in { + "serialize a defined optional value" in { val value = LoggingValue.from(Some(99)) writingToGenerator(value) should be("99") } - "be constructed from an empty optional value" in { + "serialize an empty optional value" in { val value = LoggingValue.from(None: Option[String]) writingToGenerator(value) should be("null") } - "be constructed from a sequence" in { + "serialize a sequence" in { val value = LoggingValue.from(Seq("a", "b", "c")) writingToGenerator(value) should be("[\"a\",\"b\",\"c\"]") } - "be constructed from an empty sequence" in { + "serialize an empty sequence" in { val value = LoggingValue.from(Seq.empty[Long]) writingToGenerator(value) should be("[]") } - "be constructed from a sequence view" in { + "serialize a sequence view" in { val value = LoggingValue.from(Seq(1, 4, 7).view.map(_ * 2)) writingToGenerator(value) should be("[2,8,14]") } } } -object LoggingValueSpec { +object LoggingValueSerializerSpec { private val testJsonFactory = new JsonFactory private def writingToGenerator(value: LoggingValue): String = { diff --git a/libs-scala/logging-entries/BUILD.bazel b/libs-scala/logging-entries/BUILD.bazel new file mode 100644 index 00000000000..c74e2b5cb95 --- /dev/null +++ b/libs-scala/logging-entries/BUILD.bazel @@ -0,0 +1,18 @@ +# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +load( + "//bazel_tools:scala.bzl", + "da_scala_library", + "da_scala_test_suite", +) + +da_scala_library( + name = "logging-entries", + srcs = glob(["src/main/scala/**/*.scala"]), + scalacopts = ["-Xsource:2.13"], + tags = ["maven_coordinates=com.daml:logging-entries:__VERSION__"], + visibility = [ + "//visibility:public", + ], +) diff --git a/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingEntries.scala b/libs-scala/logging-entries/src/main/scala/com/daml/logging/entries/LoggingEntries.scala similarity index 67% rename from libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingEntries.scala rename to libs-scala/logging-entries/src/main/scala/com/daml/logging/entries/LoggingEntries.scala index 8ae76fa3406..138ca0fd4ee 100644 --- a/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingEntries.scala +++ b/libs-scala/logging-entries/src/main/scala/com/daml/logging/entries/LoggingEntries.scala @@ -1,14 +1,11 @@ // Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -package com.daml.logging +package com.daml.logging.entries -import net.logstash.logback.argument.StructuredArgument -import org.slf4j.Marker +import scala.annotation.nowarn -final class LoggingEntries private ( - private[logging] val contents: Map[LoggingKey, LoggingValue] -) extends AnyVal { +final case class LoggingEntries(contents: Map[LoggingKey, LoggingValue]) extends AnyVal { def isEmpty: Boolean = contents.isEmpty @@ -20,14 +17,16 @@ final class LoggingEntries private ( def ++(other: LoggingEntries): LoggingEntries = new LoggingEntries(contents ++ other.contents) - - private[logging] def loggingMarker: Marker with StructuredArgument = - new LoggingMarker(contents) } object LoggingEntries { val empty: LoggingEntries = new LoggingEntries(Map.empty) + // Private so that it doesn't conflict with the other `apply` method. + @nowarn("msg=never used") + private def apply(entries: Map[LoggingKey, LoggingValue]): LoggingEntries = + new LoggingEntries(entries) + def apply(entries: LoggingEntry*): LoggingEntries = new LoggingEntries(entries.toMap) diff --git a/libs-scala/logging-entries/src/main/scala/com/daml/logging/entries/LoggingValue.scala b/libs-scala/logging-entries/src/main/scala/com/daml/logging/entries/LoggingValue.scala new file mode 100644 index 00000000000..b0eabaece49 --- /dev/null +++ b/libs-scala/logging-entries/src/main/scala/com/daml/logging/entries/LoggingValue.scala @@ -0,0 +1,30 @@ +// Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.daml.logging.entries + +import scala.language.implicitConversions + +sealed trait LoggingValue + +object LoggingValue { + object Empty extends LoggingValue + + object False extends LoggingValue + + object True extends LoggingValue + + final case class OfString(value: String) extends LoggingValue + + final case class OfInt(value: Int) extends LoggingValue + + final case class OfLong(value: Long) extends LoggingValue + + final case class OfIterable(sequence: Iterable[LoggingValue]) extends LoggingValue + + final case class Nested(entries: LoggingEntries) extends LoggingValue + + @inline + implicit def from[T](value: T)(implicit toLoggingValue: ToLoggingValue[T]): LoggingValue = + toLoggingValue(value) +} diff --git a/libs-scala/logging-entries/src/main/scala/com/daml/logging/entries/ToLoggingValue.scala b/libs-scala/logging-entries/src/main/scala/com/daml/logging/entries/ToLoggingValue.scala new file mode 100644 index 00000000000..0791e00e9e0 --- /dev/null +++ b/libs-scala/logging-entries/src/main/scala/com/daml/logging/entries/ToLoggingValue.scala @@ -0,0 +1,42 @@ +// Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.daml.logging.entries + +import java.time.{Duration, Instant} + +trait ToLoggingValue[-T] { + def apply(value: T): LoggingValue +} + +object ToLoggingValue { + // This is not implicit because we only want to expose it for specific types. + val ToStringToLoggingValue: ToLoggingValue[Any] = value => LoggingValue.OfString(value.toString) + + implicit val `String to LoggingValue`: ToLoggingValue[String] = LoggingValue.OfString(_) + + implicit val `Boolean to LoggingValue`: ToLoggingValue[Boolean] = { + case false => LoggingValue.False + case true => LoggingValue.True + } + + implicit val `Int to LoggingValue`: ToLoggingValue[Int] = LoggingValue.OfInt(_) + + implicit val `Long to LoggingValue`: ToLoggingValue[Long] = LoggingValue.OfLong(_) + + implicit val `Instant to LoggingValue`: ToLoggingValue[Instant] = ToStringToLoggingValue + + implicit val `Duration to LoggingValue`: ToLoggingValue[Duration] = ToStringToLoggingValue + + implicit def `Option[T] to LoggingValue`[T](implicit + elementToLoggingValue: ToLoggingValue[T] + ): ToLoggingValue[Option[T]] = { + case None => LoggingValue.Empty + case Some(value) => elementToLoggingValue(value) + } + + implicit def `Iterable[T] to LoggingValue`[T](implicit + elementToLoggingValue: ToLoggingValue[T] + ): ToLoggingValue[Iterable[T]] = + sequence => LoggingValue.OfIterable(sequence.view.map(elementToLoggingValue.apply)) +} diff --git a/libs-scala/logging-entries/src/main/scala/com/daml/logging/entries/package.scala b/libs-scala/logging-entries/src/main/scala/com/daml/logging/entries/package.scala new file mode 100644 index 00000000000..47eda94ad47 --- /dev/null +++ b/libs-scala/logging-entries/src/main/scala/com/daml/logging/entries/package.scala @@ -0,0 +1,9 @@ +// Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.daml.logging + +package object entries { + type LoggingKey = String + type LoggingEntry = (LoggingKey, LoggingValue) +} diff --git a/release/artifacts.yaml b/release/artifacts.yaml index f22bc8652dd..181773ceb6e 100644 --- a/release/artifacts.yaml +++ b/release/artifacts.yaml @@ -209,6 +209,8 @@ type: jar-scala - target: //libs-scala/grpc-utils:grpc-utils type: jar-scala +- target: //libs-scala/logging-entries:logging-entries + type: jar-scala - target: //libs-scala/ports:ports type: jar-scala - target: //libs-scala/resources:resources diff --git a/triggers/runner/BUILD.bazel b/triggers/runner/BUILD.bazel index dcacc3668f4..1c858c263ff 100644 --- a/triggers/runner/BUILD.bazel +++ b/triggers/runner/BUILD.bazel @@ -40,6 +40,7 @@ da_scala_library( "//ledger/ledger-api-common", "//libs-scala/auth-utils", "//libs-scala/contextualized-logging", + "//libs-scala/logging-entries", "//libs-scala/scala-utils", ], ) diff --git a/triggers/runner/src/main/scala/com/digitalasset/daml/lf/engine/trigger/Runner.scala b/triggers/runner/src/main/scala/com/digitalasset/daml/lf/engine/trigger/Runner.scala index aaea8e87958..af1caa550a2 100644 --- a/triggers/runner/src/main/scala/com/digitalasset/daml/lf/engine/trigger/Runner.scala +++ b/triggers/runner/src/main/scala/com/digitalasset/daml/lf/engine/trigger/Runner.scala @@ -3,57 +3,57 @@ package com.daml.lf.engine.trigger -import akka.NotUsed -import akka.stream._ -import akka.stream.scaladsl._ -import com.google.rpc.status.Status -import com.typesafe.scalalogging.StrictLogging -import io.grpc.StatusRuntimeException import java.time.Instant import java.util.UUID -import scalaz.{-\/, Functor, \/, \/-} -import scalaz.std.option._ -import scalaz.syntax.bifunctor._ -import scalaz.syntax.functor._ -import scalaz.syntax.tag._ -import scalaz.syntax.std.boolean._ -import scalaz.syntax.std.option._ - -import scala.annotation.{nowarn, tailrec} -import scala.concurrent.{ExecutionContext, Future} -import scala.concurrent.duration.FiniteDuration -import scala.concurrent.duration._ +import akka.NotUsed +import akka.stream._ +import akka.stream.scaladsl._ import com.daml.api.util.TimeProvider -import com.daml.lf.{CompiledPackages, PureCompiledPackages} -import com.daml.lf.archive.Dar -import com.daml.lf.data.ImmArray -import com.daml.lf.data.Ref._ -import com.daml.lf.data.ScalazEqual._ -import com.daml.lf.data.Time.Timestamp -import com.daml.lf.language.Ast._ -import com.daml.lf.speedy.{Compiler, Pretty, SExpr, SValue, Speedy} -import com.daml.lf.speedy.SExpr._ -import com.daml.lf.speedy.SResult._ -import com.daml.lf.speedy.SValue._ import com.daml.ledger.api.refinements.ApiTypes.ApplicationId +import com.daml.ledger.api.v1.command_submission_service.SubmitRequest import com.daml.ledger.api.v1.commands.{Command, Commands} import com.daml.ledger.api.v1.completion.Completion -import com.daml.ledger.api.v1.command_submission_service.SubmitRequest import com.daml.ledger.api.v1.event._ import com.daml.ledger.api.v1.ledger_offset.LedgerOffset import com.daml.ledger.api.v1.transaction.Transaction import com.daml.ledger.api.v1.transaction_filter.{Filters, InclusiveFilters, TransactionFilter} import com.daml.ledger.client.LedgerClient import com.daml.ledger.client.services.commands.CompletionStreamElement._ -import com.daml.logging.{ContextualizedLogger, LoggingContextOf, LoggingEntry, LoggingValue} -import LoggingContextOf.{label, newLoggingContext} +import com.daml.lf.archive.Dar +import com.daml.lf.data.ImmArray +import com.daml.lf.data.Ref._ +import com.daml.lf.data.ScalazEqual._ +import com.daml.lf.data.Time.Timestamp +import com.daml.lf.language.Ast._ +import com.daml.lf.speedy.SExpr._ +import com.daml.lf.speedy.SResult._ +import com.daml.lf.speedy.SValue._ +import com.daml.lf.speedy.{Compiler, Pretty, SExpr, SValue, Speedy} +import com.daml.lf.{CompiledPackages, PureCompiledPackages} +import com.daml.logging.LoggingContextOf.{label, newLoggingContext} +import com.daml.logging.entries.{LoggingEntry, LoggingValue} +import com.daml.logging.{ContextualizedLogger, LoggingContextOf} import com.daml.platform.participant.util.LfEngineToApi.toApiIdentifier import com.daml.platform.services.time.TimeProviderType -import com.daml.script.converter.Converter.{DamlAnyModuleRecord, DamlTuple2, unrollFree} import com.daml.script.converter.Converter.Implicits._ +import com.daml.script.converter.Converter.{DamlAnyModuleRecord, DamlTuple2, unrollFree} import com.daml.script.converter.ConverterException import com.google.protobuf.empty.Empty +import com.google.rpc.status.Status +import com.typesafe.scalalogging.StrictLogging +import io.grpc.StatusRuntimeException +import scalaz.std.option._ +import scalaz.syntax.bifunctor._ +import scalaz.syntax.functor._ +import scalaz.syntax.std.boolean._ +import scalaz.syntax.std.option._ +import scalaz.syntax.tag._ +import scalaz.{-\/, Functor, \/, \/-} + +import scala.annotation.{nowarn, tailrec} +import scala.concurrent.duration.{FiniteDuration, _} +import scala.concurrent.{ExecutionContext, Future} sealed trait TriggerMsg final case class CompletionMsg(c: Completion) extends TriggerMsg @@ -454,7 +454,7 @@ class Runner( val machine: Speedy.Machine = Speedy.Machine.fromPureSExpr(compiledPackages, SEValue(SUnit)) - import UnfoldState.{toSourceOps, toSource, flatMapConcatNodeOps, flatMapConcatNode} + import UnfoldState.{flatMapConcatNode, flatMapConcatNodeOps, toSource, toSourceOps} val runInitialState = toSource(freeTriggerSubmits(clientTime, initialStateFree)) @@ -580,7 +580,8 @@ class Runner( // any other error will cause the trigger's stream to fail } } - import io.grpc.Status.Code, Code.RESOURCE_EXHAUSTED + import io.grpc.Status.Code + import Code.RESOURCE_EXHAUSTED def retryableSubmit(req: SubmitRequest) = submit(req).map { case Some(SingleCommandFailure(_, s)) diff --git a/triggers/service/BUILD.bazel b/triggers/service/BUILD.bazel index a6b028f9844..539579e45db 100644 --- a/triggers/service/BUILD.bazel +++ b/triggers/service/BUILD.bazel @@ -79,6 +79,7 @@ da_scala_library( "//ledger/ledger-api-common", "//libs-scala/contextualized-logging", "//libs-scala/doobie-slf4j", + "//libs-scala/logging-entries", "//libs-scala/scala-utils", "//triggers/runner:trigger-runner-lib", "//triggers/service/auth:middleware-api",