Fork me on GitHub
#datomic
<
2023-11-25
>
cl_j08:11:07

Hi guys, is the transaction id tx and basis t of the transaction one to one mapping? Looks like it is, because I can get the same list of transactions using tx or t in the tx-range query:

(d/tx-range conn {:start tx-or-basis-t :end (inc tx-or-basis-t)})

favila14:11:01

Entity ids including tx have two parts: a high-bit partition part and a low-bit counter part. Entity ids for non-schema entities (including transaction entities) are minted from a single db-wide counter. The T is the counter value part of a tx entity id. You convert between t and tx using d/t->tx (which adds in tx partition bits) or d/tx->t (which strips off partition bits from any entity id, including tx). The t part of entity ids tells you which transaction minted it because of how that T counter gets advanced. You can construct an entity id using d/entid-at

👍 1
indy10:11:09

Are you using APMs with your Datomic Ion? I'm trying to integrate New Relic (Cloudwatch doesn't fit my requirments here). Since I don't have control over the java process startup for the ion I can't start the new relic java agent. I don't know if dynamically loading the the new relic agent would work.

cch114:11:56

I think it’s not uncommon to service ion endpoints with handler(s) that close over a system (using integrant or component or similar) in a delay. You can stuff agent startup in there.

indy14:11:44

Yeah that’s what I (and I guess everyone else using ions) do for things like loading up config and the system from integrant. But java agents are quite different. They have the ability to inject instrumentation into the byte code which I guess requires control during the java process startup. I’m not able to find any New Relic API to lead the agent dynamically.

cch120:11:01

There is the ability to provide startup parameters to the JVM running the ion code. I’ve seen java agents that can be started that way. Are you familiar with that parameterization and would that help?

shane14:11:02

Do you know of an example or docs for setting java agents? I'd like to do the same with honeycomb. https://docs.honeycomb.io/getting-data-in/opentelemetry/java-distro/#run

cch114:11:23

I don’t know about setting java agents, but you can provide arbitrary java startup arguments to ions instances via the OverrideSettings CloudFormation template parameter. I have seen some agents started that way.

👍 1
shane15:11:47

Ah! you need to customize the template - I guess that makes sense, thanks! Offhand do you happen to know of any projects that do this and are open source?

cch117:11:38

I customize the template to start a socket repl. But it’s not really worth a project -it’s just some JVM startup flags.

cch117:11:29

FWIW, here’s the value of OverrideSettings that I use:

export JVM_FLAGS="$JVM_FLAGS -Dclojure.server.repl={:address,\"0.0.0.0\",:port,50505,:accept,clojure.core.server/repl}"