Commit Graph

662 Commits

Author SHA1 Message Date
Paul Brauner
818bb1e6e8
Clean up some bazel rules (#17359)
* Fix a probable typo in //daml-fl/encoder/testing-dar-*

* apply TODOs in bazel files

* remove obsolete comments in bazel files

* use 'default' instead of 'latest' for targets relying on 'latest' in order to ensure interfaces are supported
2023-09-06 08:25:58 +02:00
Moisés Ackerman
6ae0e0111e
Upgrade to Bazel 5 (again) (#17319)
* Update to rules_haskell v0.16
* Update comments re bazel patches
* clean up bazel overrides
* Upgrade to Bazel 5.2.0
* Remove '--distinct_host_configuration=false'
* Update buildifier to 6.3.2
* Suffix macos and ubuntu caches with yyyymm
* bump windows cache to v14
* [REVERTME] bump linux/macos/darwin timeout to 4h
2023-09-01 15:15:36 +02:00
Samuel Williams
9179b2e7d0
Jar licensing (#17299)
* Add _distribute.jar target with correct license
Use it everywhere

* Fixes from review

* Change NOTICES to NOTICES.txt for consistency
2023-08-22 15:56:29 +01:00
Raphael Speyer
47d21fe717
JSON API: add PruningTest and make it pass (#17167)
If the ledger has been pruned more recently that the last cached copy, then attempting to fetch the changes since that last offset will fail, rending the relevant template(s) unqueryable. This PR detects that condition, clears the cache for the relevant template and queries again, which will refresh the cache with a fresh copy of the ACS for that template, and serve the query from that.

I also made some usability tweaks around running canton-ee tests, to help improve the dev experience for failures I came across while trying to run them. Specifically
* Use `--config=canton-ee` to opt into the tests which require canton-ee
* When downloading that EE from artifactory, provide better diagnostics if the required auth isn't set up.
2023-07-27 09:12:22 +10:00
Remy
235abfa8ed
Revert "[LF] make Timestamp parsing consistent accross Java versions (#17053)" (#17170)
This reverts commit db7a5b3653.
2023-07-24 16:11:00 +00:00
Remy
db7a5b3653
[LF] make Timestamp parsing consistent accross Java versions (#17053)
* [LF] make Timestamp parsing consistent between Java 11 and Java 17

Between Java 11 and Java 17 there is one bug fix on Instant.parse
that expands the range of values that can be parsed into an
Instant. See https://bugs.openjdk.org/browse/JDK-8166138

Daml-LF happened to uses Instant.parse to parse a string into a
Daml-LF timestamp and we observe a different behavior when running
Daml on Java 11 and Java 17

additionally make explicit that conversion form java Instant and
string may drop nanoseconds, i.e. we create a lenient version that may
drop the significant nanoseconds (legacy or) and a strict
version that reject instant/string that cannot be converted without
loss of precision.
2023-07-20 16:18:01 +02:00
Raphael Speyer
c6dc7db512
JSON API: enable running tests which prune the ledger (#17046)
* Pruning needs to be retried, with artificial activity added, until the safe-offset has advanced far enough for it to succeed.
* The "max deduplication duration" needs to be dropped, otherwise pruning cannot be done for at least the default of 168h.
* The "reconciliation interval" needs to be lowered. This is a dynamic config, so we set it via a bootstrap script. The change is not effected immediately, but asynchronously some time after startup. Lowering this enables the safe-offset to catch up faster.
* We need to ensure the relevant tests are only enabled when testing against an Enterprise edition of Canton.

Contributes to https://digitalasset.atlassian.net/browse/LT-17
2023-07-19 09:49:24 +10:00
Remy
9e0493cc1a
add support for Canton EE available to JSON API (#17034)
Co-authored-by: Gary Verhaegen <gary.verhaegen@digitalasset.com>
2023-06-29 09:03:32 +00:00
Erwin Ramirez
bba554481b
Add json api endpoint refresh cache (#16987)
* added new end point to refresh the cache

* formatting

* returning old logic

* added logic to update the cache with a specific offset provided in the body

* formatting

* addressed comments

* formatting

* formatting

* formatting

* Return unit instead of List for processing refresh

* last changes on logic

* formatting

* simplify conversion

* comments addressed
2023-06-23 19:49:34 +10:00
Raphael Speyer
640a12610d
JSON API: Avoid populating both "result" and "errors" in response (#16967)
According to current documentation, only one of these may be set, but we can currently return both.

Also in this case we currently return a status code of 501, which is not one of the documented status codes. This PR switches that to 500 instead.

https://docs.daml.com/json-api/index.html#http-status-codes
2023-06-13 18:56:56 +10:00
Erwin Ramirez
fb6a564bb4
updated README.md http-json-perf (#16955) 2023-06-08 11:45:10 +10:00
Raphael Speyer
1f351b418e
JSON API: fix benchmarks and avoid excessive iterations (#16963)
* reduce fork count, measurement and warmup iterations, and extra parameters which had a multiplicative effect on total work done
* fix db connection setup - the combination of annotations and inheritance meant it was trying to setup the trial twice, causing Postgres benchmarks to fail
* log when an error occurs during test setup
* add logback resources to the benchmarks, to enable configuration of logging, and avoid dumping all the debug logs by default

With these changes, on my 20 core 64G linux laptop, the benchmarks now all run in under 6 mins.
Without this change, it took over 9 hours in total and none of the Postgres benchmarks were successful.
2023-06-07 08:09:24 +10:00
Erwin Ramirez
cfc499fbb6
Addition metrics on update cache (#16930)
* added cache update to metrics

* formatting

* added extra logs as commented

* added logs and metrics on query request failure/ success

* comments addressed

* further comments addressed

* formatting
2023-06-02 17:37:47 +10:00
peterkvokacka-da
6c3f997499
LT-25 publish JSON-API HikariCP metrics (#16921)
* JSON-API: publish HikariCP metrics

* formatting

* address review comment
2023-05-30 11:47:22 +10:00
Erwin Ramirez
dfeec9c423
Improvements logs json api (#16924)
* updated logback json to allow env to set the root log level with default info
Added logs on iteration to ledger when updating the query-storage cache

* formatting scala code

* comments addressed

* removed unneeded variable

* formatting

* Update ledger-service/http-json/src/main/scala/com/digitalasset/http/ContractsFetch.scala

Co-authored-by: Raphael Speyer <raphael.speyer@digitalasset.com>

* remove debug block

---------

Co-authored-by: Raphael Speyer <raphael.speyer@digitalasset.com>
2023-05-30 11:04:55 +10:00
Raphael Speyer
8fe0d7ed5c
JSON API: Add some tests around the size limits of field names that are supported by querying. (#16925)
The tests are not comprehensive.
We demonstrate that if the Oracle payload index is on, the names of fields with type Int may not exceed 251 chars.
For other configurations, Int and Text fields can have a name with lengths of at least 512 chars.

Also updated the naming and explanation of the guards which disable some tests when using Oracle with JSON index.
2023-05-27 09:33:40 +10:00
Raphael Speyer
b53effd6e0
JSON API: fix empty string comparisons on Oracle (#16892)
Oracle conflates empty strings with NULL, which breaks comparison operations against empty strings.

This change makes Oracle-backed queries have the behaviour you'd expect when comparing empty strings, in line with what we see on Postgres and in-memory backed queries.

We had to take a bit of care to ensure it worked irrespective of whether the JSON index was enabled.

Fixes https://digitalasset.atlassian.net/browse/LT-24
2023-05-24 13:47:23 +10:00
mziolekda
06abd5c649
Clean up ledger dependencies (#16894)
* remove sandbox-on-x project

update bazel readme

update release artifacts

comment out last remaining SoX test

remove ledger-runner-common

remove participant-state-kv-errors

remove recovering-indexer-integration-tests

remove participant-integration-api

update doc pages

cleanup ledger-api-auth usage

remove participant-state

fix build

fix build

clean up ledger-api-common part I

clean up ledger-api-comon part II

clean up ledger-api-common part III

remove ledger/metrics

clean up ledger-api-health and ledger-api-domain

* remove ledger-configuration ad ledger-offset

* remove ledger-grpc and clean up participant-local-store

* reshuffle few more classes

* format
2023-05-23 13:44:17 +00:00
Raphael Speyer
9c2e7c28f9
JSON API: increase size of the multiple-observers test (#16884)
to 1000 observers x 185 chars.
2023-05-23 18:26:30 +10:00
mziolekda
95cc249ddd
Remove sandbox on x (#16890)
* remove sandbox-on-x project

* update bazel readme

* update release artifacts

* comment out last remaining SoX test

* remove ledger-runner-common

* remove participant-state-kv-errors

* remove recovering-indexer-integration-tests

* remove participant-integration-api

* update doc pages

* cleanup ledger-api-auth usage

* remove participant-state

* fix build

* fix build
2023-05-23 09:25:54 +02:00
Remy
81272e313d
Move com.daml.caching in libs-scala (#16868) 2023-05-22 15:32:53 +00:00
Raphael Speyer
50b2c59572
Make template id lookup concurrency-safe. (#16883) 2023-05-18 14:55:12 -04:00
Remy
a863d69d34
Move CatonFixture in its own bazel module (#16824) 2023-05-10 23:15:26 +00:00
Samuel Williams
537447d92c
Json Api tests to canton (#16782)
Co-authored-by: Remy <remy.haemmerle@daml.com>
2023-05-10 16:01:39 +01:00
Raphael Speyer
7a82b02b38
JSON API: Oracle: Pass string as a literal when querying json payload if index is enabled (#16717)
Previously, when using an Oracle-based ACS cache, JSON queries such as
```
 {
 ...
 "query": {
    "si_detail": {
      "si_input_no": {
        "%gt": "foo"
      }
    }
  }
}
```

were resulting in SQL queries containing 
```
JSON_EXISTS(payload, '$."si_detail"."si_input_no"?(@ > $X)' PASSING ? AS X)
```

which works when the payload json index is disabled, but when the index is enabled it results in an error.

We can avoid this by passing in the literal value rather than using a query parameter when the index is enabled, e.g.

```
JSON_EXISTS(payload, '$."si_detail"."si_input_no"?(@ > $X)' PASSING 'foo' AS X)
```

Fixes https://github.com/digital-asset/daml/issues/15006

And contributes towards https://digitalasset.atlassian.net/browse/LT-14
2023-04-21 17:01:23 +10:00
Gary Verhaegen
f8050f1f18
Add license file (#16697)
See [DAML-358] for details.

[DAML-358]: https://digitalasset.atlassian.net/browse/DAML-358
2023-04-17 11:33:04 +00:00
Raymond Roestenburg (Actually RayRoestenburg)
e9912f3138
Fix for warning in logback output, if can’t be inside appender. (#16687) 2023-04-13 07:49:10 +02:00
Raphael Speyer
ef732d7e63
Fix SQL used to build view in Oracle to handle larger number of observers. (#16683)
When the `observers` list was too long, we were getting an `ORA-40478: output value too large (maximum 4000)` error from Oracle.

This was being hit when the `contract_stakeholders` view was being updated. An intermediate part of the expression which updates the view was being defaulted to a type which didn't allow larger values. Adding an explicit type fixes the problem.

- Added test which could reproduce the previous failure. 
- Moved `randomTextN` to be accessible to the new test.

Fixes https://digitalasset.atlassian.net/browse/LT-11
2023-04-13 09:45:08 +10:00
Stephen Compall
15ee6823f4
test payloadBlob and multiple disclosed contracts in JSON API exercise, create-and-exercise (#16635)
* restore transaction fetch from #16529 497b195043

* add a view so we can ask for blobs

* perform the extra disclosure and check its response text

* remove a layer we won't use

* include token; test passes with user management

* rename to reflect multiple contracts
2023-04-06 10:59:00 -04:00
Stephen Compall
182d8a854a
allow disclosed contracts to be passed to create-and-exercise (#16611) 2023-03-31 00:07:23 +00:00
Stephen Compall
ddc4930f1a
explicit disclosure parameters for JSON API (#16529)
Adds a `disclosedContracts` optional list field to the `meta` argument
for `create`, `exercise` and `create-and-exercise` endpoints.

The argument is ignored in all cases but `exercise` (#16611 builds on
this PR to add `create-and-exercise` support). A single disclosed
contract looks more or less like follows:

    { 
      "contractId": "abcd", 
      "templateId": "Mod:Tmpl", 
      $argumentsJsonField, 
      "metadata": { 
        "createdAt": "2023-03-21T18:00:33.246813Z", 
        "contractKeyHash": "77656c6c2068656c6c6f", 
        "driverMetadata": "dGhlcmUgcmVhZGVy" 
      } 
    }

where `argumentsJsonField` may be either one of these, setting aside the
extra quotes added for these tests:

    "payload": {"owner": "Alice"}
    
    "payloadBlob": { 
      "typeUrl": "type.googleapis.com/com.daml.ledger.api.v1.Record", 
      "value": "Eg4KBW93bmVyEgVaA0JvYg==" 
    }

(Note that `typeUrl` is variable, not constant; use the actual blob's
`typeUrl` contents, **do not assume it is exactly the above example**.)

This PR uses base-64 for `payloadBlob.value` and
`metadata.driverMetadata`, and base-16 for `metadata.contractKeyHash`.
2023-03-30 20:41:36 +00:00
Brian Healey
b80dca2dd8
identity provider id awareness for party and user management apis through ledger client (#16632)
* identity provider id awareness for party and user management apis through ledger client

* none case for ObjectMetadata translation
2023-03-30 18:26:53 +00:00
Raphael Speyer
e5053bd4cc
Fix fetching contracts with Numerics in their keys. (#16605)
Switch to an LF converter which preserves the numeric's scale, allowing keys to match correctly.

Co-authored-by: = <=>
2023-03-27 11:06:10 +02:00
Nicu Reut
209e6ec947
Deprecate non-labeled metrics factories [PLEN-183] (#16441) 2023-03-15 11:09:16 +01:00
BryceStansfieldAt-da
b7bcbae2e0
more determinism in delete order (forward port of #16401) (#16471)
* Forward port of #16401

* specify arguments for delete in a fixed order

* disable backpressure transaction batching for Oracle update

* deterministic specification of offset update DMLs

* switch to updateMany for delete instead of `in` on Oracle

- suggested by @ray-roestenburg-da; thanks

* don't update ledger_offset table or start transaction stream if caught up to ledger end

* include tpid in delete order consideration

---------

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2023-03-08 10:32:21 -05:00
BryceStansfieldAt-da
27530a7132
log suppressed errors out-of-band (Forward Port of #16261) (#16472)
* forward port of: #16261 b718717dec

* [JSON API] Log errors suppressed during streaming of /v1/query and
  /v1/fetch results

---------

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2023-03-07 19:43:18 +00:00
Nicu Reut
7246a21520
Use labeled metrics for the CacheMetrics [PLEN-163][PLEN-167] (#16406) 2023-03-02 11:55:37 +01:00
mziolekda
d8d55ca412
upgrade to scala 2.13.10 (#16423)
* update build system to scala 2.13.10

* fix failing scala files

* format

* fix compatibility

* resolve conflict on maven_install_2.13.json
2023-02-28 23:21:53 +00:00
Nicu Reut
7e87912cd5
Add ability to configure histograms through the config files [PLEN-159] (#16387) 2023-02-28 10:50:26 +00:00
Nicu Reut
cc0db80b3a
Remove duplicate HTTP metrics replaced by the golden signal metrics [PLEN-117] (#16341) 2023-02-22 13:42:24 +01:00
mziolekda
1a3980bf89
Separate test-common from the rest of the ledger code (#16307)
* move files

* format

* wrong file

* fix conformance tests

* add readme

* fix compatibility tests

* fix haskell tests
2023-02-14 15:29:13 +00:00
mziolekda
d9974984fd
Remove circular dependency on the //ledger project caused by ledger-resources [DPP-1410] (#16295)
* remove circular dependency on the //ledger project caused by ledger-resources

* format
2023-02-13 08:38:44 +00:00
Nicu Reut
50701da79b
Use OpenTelemetry metrics for the non-repudiation modules [PLEN-106] (#16271) 2023-02-09 15:20:19 +00:00
Luc Bourlier
313aaad4a6
Common metrics reporter config format [PLEN-91] (#16213)
* Common metrics reporter config format

Fixed the config for metrics reporter for trigger service and oauth
middleware.
They are using a common config definition, as well as the JSON API
service.
The format matches the one used in canton configs.

CHANGELOG_BEGIN
CHANGELOG_END
2023-02-03 09:10:10 +01:00
Sergey Kisel
c04019de4e
Restrict the use of non-allocated party in User Mnmgt API for ParticipantAdmin [DPP-1385] (#16111) 2023-01-28 11:49:11 +01:00
Nicu Reut
a87412b68c
Introduce LabeledMetricsFactory trait to mark metrics factories that support labels [PLEN-98] (#16159) 2023-01-26 16:01:37 +00:00
Stephen Compall
81b4e17f00
reduce package service calls to avoid THREADPOOL_OVERLOADED errors (#16116)
* confirm that monadifying the package fetch still suppresses the error

* thread ExecutionContext from request

- makes the error less likely
- but still fairly easy to repro with 3 tabs

* experiment with setting executor

* explain that the cache isn't a cache

* random order, maybe

- #3090 mentions keeping the order as a goal; I don't see why we should,
  though

* random order with groups of 8

* embed the decoding

- this slows down the processing of a group, yielding somewhat less
  granular contention
- and also makes hits cost much less, at the cost of making granular
  contention more expensive

* reduce diff size before resolution

- this won't improve contention, but does nearly eliminate the cost of
  resolution for already-resolved packages, making hits nearly free
  (amortized)

* randomize groups instead

- while groups themselves can overlap with this arrangement, each
  costing ParallelLoadFactor granular contention, on average it seems to
  perform a little better due to groups never overlapping

* refactor StatusEnvelope to utils

* constant 250ms retry

* detect contention earlier and skip decode

* factor traverseFM
2023-01-26 10:18:13 -05:00
Luc Bourlier
e809344c00
Metrics for node status [PLEN-63] (#16052)
* Metrics for node status [PLEN-63]

CHANGELOG_BEGIN

* Node status metric: daml_health_status

CHANGELOG_END
2023-01-26 12:01:14 +01:00
Nicu Reut
fee45895d8
[metrics] Remove the API allowing us to read the state of a counter [PLEN-97] (#16141) 2023-01-26 09:05:56 +01:00
Nicu Reut
17596abd1b
Expose opentelemetry jvm metrics alongside dropwizard metrics [PLEN-67] (#16133) 2023-01-24 19:58:20 +01:00