Skip to content
Discussions/App Development/Metric for open contractsForum ↗

Metric for open contracts

App Development6 posts240 views3 likesLast activity Feb 2025
FR
FrankieOP
Jan 2022

Hi, is there any metrics that showing the number of open contracts on the ledger? i.e. number of active contracts.

MA
Max
Jan 2022

Hi @frankie,
In what setting / context are you trying to get active contracts? You can get all active contracts based on templates, see the “Get all active contracts” section in the JSON-API docs.

Let me know if that helps!

FR
Frankie
Jan 2022

Hi @Max, I’d like to get the number of active contracts for monitoring purpose. The memory usage seems goes up when the number of active contracts goes up.

MA
Mate_Varga
Jan 2022

Generally speaking, we do not track the number of active contracts as a metric. Which component do you experience consuming more and more memory depending on the size of the active contract set? If you are using an in-memory query store for JSON API, having a connection between the ACS size and the memory consumption is given.

ST
Stephen
Jan 2022
Mate_Varga:

in-memory query store

Slight wrinkle, there is no such thing; if you don’t configure a database i.e. query store, json-api always streams and filters from the participant server. Naturally ACS blocks will transiently consume as much memory as they need, but they go away after the request.

This is just to emphasize that the configuration details really matter. What process is consuming unexpected amounts of memory? How is it configured?

WA
WallaceKelly
Feb 2025
Frankie:

Hi, is there any metrics that showing the number of open contracts on the ledger? i.e. number of active contracts.

It’s been a while since this thread was started. I find these two metrics (apparently introduced in the 2.8.11 time frame?):

daml.parallel_indexer.archivals

  • Summary: The number of archive events persisted to the database.
  • Description: The number of archive events persisted to the database.
  • Type: Counter
  • Qualification: Traffic

daml.parallel_indexer.creates

  • Summary: The number of create events persisted to the database.
  • Description: The number of create events persisted to the database.
  • Type: Counter
  • Qualification: Traffic

I wonder if these two could be used to estimate the count of ACS contracts.

EDIT: No. These cannot be used to estimate the size of the ACS. The counts reset if the process resets.

← Back to Discussions