datomic 2025-10-09

Is is possible for a metrics callback function running inside a transactor to determine whether that transactor is an active transactor or a standby transactor?

The logs report an event in the datomic.lifecycle namespace that will report transactor/standby :

;standby example
2017-02-14 15:33:59.944 INFO  default    datomic.lifecycle-ext - {:event :transactor/standby, :rev 10127704, :missed 0, :timestamp 1487086439310, :pid 9, :tid 16}

;active example:
2017-02-11 04:24:11.703 INFO  default    datomic.lifecycle - {:tid 16, :username "Uhop48pFJo0G4A/bJIwbcxipUUi7Ly3K+snqMVCGVxI=", :port 4334, :rev 10067870, :host "0.0.0.0", :pid 8, :event :transactor/heartbeat, :version "0.9.5530", :timestamp 1486787051694, :encrypt-channel true}

Hmm ... so the idea would be to configure a logger and have it set some state visible to the metrics callback?

What is the difference between these metrics? 1. Datoms - "Number of unique datoms in the index" 2. IndexDatoms - "Number of datoms stored by the index, all sorts" Does "the index" here mean that each of these metrics is reported for each of the four Datomic indexes? If so, is there a way to tell which metric value corresponds to which index? Or does "the index" just mean the database? Apologies for the flurry of questions.

said differently: IndexDatoms must always be at least 2x the Datoms value (because EAVT and AEVT each contain every unique datom), and at most 4x (if every single datom is both a ref, thus in VAET, and value-indexed, thus in AVET).

"the index" in this language is the entire index

so all four "sorts": eavt, aevt, etc

I see, and that’s true for both metrics?

IndexDatoms is sum of datoms in all sorts; Datoms is just the unique datoms, so == to the sum of datoms in EAVT or AEVT