daml/ledger
Samir Talwar c5d9d1014e
ledger-api-test-tool: Run tests on Canton, and fix a few issues. (#3446)
* ledger-api-test-tool-on-canton: Run Canton.

* ledger-api-test-tool-on-canton: Run the SemanticTests against Canton.

This was _so_ much work.

These will probably be flaky, so can't merge them in until we fix the
underlying issues with the tests around multi-participant allocation.

* ledger-api-test-tool: Wait for parties to arrive on all participants.

Thanks to Canton for exacerbating this bug.

Can't turn on all the tests on Canton yet as there are other spurious
failures. Will investigate next.

* ledger-api-test-tool: Move all contract key tests to ContractKeys.

If a ledger doesn't support ContractKeys, they need to be able to turn
these tests off.

* ledger-api-test-tool: If a test name is misspelled, fail immediately.

I keep getting names slightly wrong in the `--exclude` arguments and
wondering why it didn't work.

* client_server: Revert client_server_test.bzl.

Turns out I don't know what I'm doing. ¯\_(ツ)_/¯

* sandbox: Don't call `.toString` on an array. Doesn't do much.

* dev-env: Don't untar netcat automatically.

It needs to be installed with Pacman.
2019-11-13 17:27:28 +01:00
..
api-server-damlonx/reference-v2 Remove font coloring (#3448) 2019-11-13 12:38:22 +00:00
ledger-api-akka Replace bazel-deps by rules_jvm_external (#3253) 2019-10-28 13:53:14 +01:00
ledger-api-auth Add a JWT authentication to sandbox (#3283) 2019-11-07 23:04:16 +01:00
ledger-api-client Authenticated ledger identifier call in LedgerClient (#3426) 2019-11-12 09:36:54 +00:00
ledger-api-common Fix potentical race condition in Dispatcher (#3415) 2019-11-11 17:36:50 +01:00
ledger-api-domain Use TreeMap for storing transaction nodes (#3418) 2019-11-12 13:55:03 +01:00
ledger-api-grpc-utils Add GrpcException extractor (#3344) 2019-11-06 14:44:06 +00:00
ledger-api-integration-tests Mark ledger-api-integration-tests as flaky on Windows (#3442) 2019-11-13 12:39:15 +00:00
ledger-api-scala-logging Replace bazel-deps by rules_jvm_external (#3253) 2019-10-28 13:53:14 +01:00
ledger-api-test-tool ledger-api-test-tool: Run tests on Canton, and fix a few issues. (#3446) 2019-11-13 17:27:28 +01:00
ledger-api-test-tool-on-canton ledger-api-test-tool: Run tests on Canton, and fix a few issues. (#3446) 2019-11-13 17:27:28 +01:00
participant-state correct package path for ReferenceServer (#3439) 2019-11-12 22:39:41 +00:00
participant-state-index Replace bazel-deps by rules_jvm_external (#3253) 2019-10-28 13:53:14 +01:00
sandbox ledger-api-test-tool: Run tests on Canton, and fix a few issues. (#3446) 2019-11-13 17:27:28 +01:00
sandbox-perf Port command-related integration tests (#3320) 2019-11-04 17:30:31 +01:00
scripts update copyright notices (#2499) 2019-08-13 17:23:03 +01:00
test-common daml-lf: freeze version 1.7 (#3340) 2019-11-07 09:51:18 +00:00
API.md open-sourcing daml 2019-04-04 09:33:38 +01:00
README.md Update README.md (#640) 2019-04-23 17:47:54 +00:00

ledger

Home of our reference ledger implementation (Sandbox) and various ledger related libraries.

v1 gRPC API

The v1 gRPC API is described here

Logging

Logging Configuration

Ledger Server uses Logback for logging configuration.

Log Files

By default our log configuration creates two log files:

  • a plaintext file logs/ledger.log
  • a json file logs/ledger.json.log (for Logstash type log processors)

The path the file is stored in can be adjusted by setting -Dlogging.location=some/other/path. The filename used can be adjusted by setting -Dlogging.file=my-process-logs.

By default no output is sent to stdout (beyond logs from the logging setup itself).

standard streams logging

For development and testing it can be useful to send all logs to stdout & stderr rather than files (for instance to use the IntelliJ console or getting useful output from docker containers).

We ship a logging configuration for this which can be enabled by using -Dlogback.configurationFile=classpath:logback-standard.xml -Dlogging.config=classpath:logback-standard.xml.

INFO level and below goes to stdout. WARN and above goes to stderr.

_Note: always use both -Dlogback.configurationFile and -Dlogging.config. Logback is first initialized with the configuration file from logback.configurationFile. When the Spring framework boots it recreates logback and uses the configuration specified in logging.config.

Log levels

As most Java libraries and frameworks, ledger server uses INFO as the default logging level. This level is for minimal and important information (usually only startup and normal shutdown events). INFO level logging should not produce increasing volume of logging during normal operation.

WARN level should be used for transition between healthy/unhealthy state, or in other close to error scenarios.

DEBUG level should be turned on only when investigating issues in the system, and usually that means we want the trail loggers. Normal loggers at DEBUG level can be useful sometimes (e.g. DAML interpretation).

gRPC and back-pressure

RPC

Standard RPC requests should return with RESOURCE_EXHAUSTED status code to signal back-pressure. Envoy can be configured to retry on these errors. We have to be careful not to have any persistent changes when returning with such an error as the same original request can be retried on another service instance.

Streaming

gRPC's streaming protocol has built-in flow-control, but it's not fully active by default. What it does it controls the flow between the TCP/HTTP layer and the library so it builds on top of TCP's own flow control. The inbound flow control is active by default, but the outbound does not signal back-pressure out of the box.

AutoInboundFlowControl: The default behaviour for handling incoming items in a stream is to automatically signal demand after every onNext call. This is the correct thing to do if the handler logic is CPU bound and does not depend on other reactive downstream services. By default it's active on all inbound streams. One can disable this and signal demand by manually calling request to follow demands of downstream services. Disabling this feature is possible by calling disableAutoInboundFlowControl on CallStreamObserver.

ServerCallStreamObserver: casting an outbound StreamObserver manually to ServerCallStreamObserver gives us access to isReady and onReadyHandler. With these methods we can check if there is available capacity in the channel i.e. we are safe to push into it. This can be used to signal demand to our upstream flow. Note that gRPC buffers 32Kb data per channel and isReady will return false only when this buffer gets full.