public interface Transaction extends Message
Transaction is any interesting unit of work that takes time to complete and may fail.
Basically, all data access across the boundary needs to be logged as a Transaction since it may fail and
time consuming. For example, URL request, disk IO, JDBC query, search query, HTTP request, 3rd party API call etc.
Sometime if A needs call B which is owned by another team, although A and B are deployed together without any
physical boundary. To make the ownership clear, there could be some Transaction logged when A calls B.
Most of Transaction should be logged in the infrastructure level or framework level, which is
transparent to the application.
All CAT message will be constructed as a message tree and send to back-end for further analysis, and for monitoring.
Only Transaction can be a tree node, all other message will be the tree leaf. The transaction without
other messages nested is an atomic transaction.
| 限定符和类型 | 方法和说明 |
|---|---|
Transaction |
addChild(Message message)
Add one nested child message to current transaction.
|
List<Message> |
getChildren()
Get all children message within current transaction.
|
long |
getDurationInMicros()
How long the transaction took from construction to complete.
|
long |
getDurationInMillis()
How long the transaction took from construction to complete.
|
boolean |
hasChildren()
Has children or not.
|
boolean |
isStandalone()
Check if the transaction is stand-alone or belongs to another one.
|
void |
setDurationInMillis(long durationInMills)
set duration in millisecond.
|
addData, addData, complete, getData, getName, getStatus, getTimestamp, getType, isCompleted, isSuccess, setStatus, setStatus, setSuccessStatus, setTimestampTransaction addChild(Message message)
message - to be addedList<Message> getChildren()
Typically, a Transaction can nest other Transactions, Events and
Heartbeat s, while an Event or Heartbeat can't nest other messages.
long getDurationInMicros()
long getDurationInMillis()
void setDurationInMillis(long durationInMills)
boolean hasChildren()
boolean isStandalone()
Copyright © 2022. All rights reserved.