Skip to content

Instantly share code, notes, and snippets.

@moxious
Created April 9, 2020 13:11
Show Gist options
  • Save moxious/05571dee9102dada42ace8ac4116a11f to your computer and use it in GitHub Desktop.
Save moxious/05571dee9102dada42ace8ac4116a11f to your computer and use it in GitHub Desktop.
How to list transactions in Neo4j for 3.5 vs. 4.0
== 3.5 ==
CALL dbms.queryJmx("org.neo4j:instance=kernel#0,name=Transactions")
YIELD attributes WITH attributes as a
RETURN
a.NumberOfRolledBackTransactions.value as rolledBack,
a.NumberOfOpenTransactions.value as open,
a.LastCommittedTxId.value as lastCommittedId,
a.NumberOfOpenedTransactions.value as opened,
a.PeakNumberOfConcurrentTransactions.value as concurrent,
a.NumberOfCommittedTransactions.value as committed
== 4.0 ==
CALL dbms.queryJmx('neo4j.metrics:name=neo4j.' + $db + '.transaction.active')
YIELD attributes WITH attributes.Value.value as open
CALL dbms.queryJmx('neo4j.metrics:name=neo4j.' + $db + '.transaction.active_read')
YIELD attributes WITH attributes.Value.value as active_read,
open
CALL dbms.queryJmx('neo4j.metrics:name=neo4j.' + $db + '.transaction.active_write')
YIELD attributes WITH attributes.Value.value as active_write,
active_read, open
CALL dbms.queryJmx('neo4j.metrics:name=neo4j.' + $db + '.transaction.committed')
YIELD attributes WITH attributes.Count.value as committed,
active_write, active_read, open
CALL dbms.queryJmx('neo4j.metrics:name=neo4j.' + $db + '.transaction.active')
YIELD attributes WITH attributes.Value.value as active,
committed, active_write, active_read, open
CALL dbms.queryJmx("neo4j.metrics:name=neo4j." + $db + ".transaction.peak_concurrent")
YIELD attributes WITH attributes.Count.value as concurrent,
active, committed, active_write, active_read, open
CALL dbms.queryJmx("neo4j.metrics:name=neo4j." + $db + ".transaction.rollbacks")
YIELD attributes WITH attributes.Count.value as rolledBack,
concurrent, active, committed, active_write, active_read, open
CALL dbms.queryJmx("neo4j.metrics:name=neo4j." + $db + ".transaction.started")
YIELD attributes WITH attributes.Count.value as opened,
rolledBack, concurrent, active, committed, active_write, active_read, open
RETURN
rolledBack,
open,
-1 as lastCommittedId, /* 4.0 TODO Not yet supported by neo4j.metrics:name=neo4j.system.transaction.last_committed_tx_id */
opened,
concurrent,
committed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment