concurix-transactionlog
Logs transactions (by string id) and collects stats over time about them. This tool is part of the concurix node.js instrumentation.
var TransactionLog = require("concurix-transactionlog")
var tlog = new TransactionLog({
raw_subset: true,
subset_stats: true,
transactions_per_ms: true
})
tlog.update("/index.html", 13)
tlog.update("/index.html", 22)
tlog.update("/user/foo?blah=zap", 101)
var subset = tlog.reapSubset()
console.log(JSON.stringify(subset, null, 2))
setTimeout(function () {
tlog.update("/index.html", 50)
var subset = tlog.reapSubset()
console.log(JSON.stringify(subset, null, 2))
}, 1000)
API
var transactionLog = require("concurix-transactionlog")(config)
Create a new transaction log
config:
- raw_subset [false]: show the raw values for each member of this subset
- subset_stats: [true]: show stats for just this subset
- transactions_per_ms: [true]: show transactions per millisecond stats
transactionLog.update(transactionId, measurement)
Log an instance of this transaction. transactionId
should be a string and measurement
should be a number.
transactionLog.reapSubset()
Extract the current subset of the transaction log and clear the subset buffer.
When reaped, statistics for each transaction id that was active in this subset is returned, with optional fields depending on the config
provided.
- stats: statistics for this tansaction id for all history
- subset: raw values for this subset
- subset_stats: statistics for just this subset
- transactions_per_ms: Instances of this transaction id per millisecond, sampled at each
reapSubset()
call for all history.
Long-term stats are kept intact between reapSubset
calls.
transactionLog.clearAll()
Completely empty the transaction log of all transactions and long-term stats.
LICENSE
Concurix Terms Of Service