FdbTransactionLog
Namespace: FoundationDB.Filters.Logging · class
Container that logs all operations performed by a transaction
Constructors
FdbTransactionLog
FdbTransactionLog()
Properties
Attempts
int Attempts { get; }
Total number of attempts to commit this transaction
This value is increment on each call to Commit()
CallSite
StackTrace CallSite { get; set; }
StackTrace of the method that created this transaction
Only if the option is set
Commands
List<Command> Commands { get; set; }
List of all commands processed by the transaction
CommitSize
long? CommitSize { get; }
Commit size of the last commit attempt
This value only account for write commands in the last attempt
It will be null for transactions that are read-only, or did not attempt to commit
CommittedUtc
DateTimeOffset? CommittedUtc { get; }
Timestamp (UTC) of the last successful commit of the transaction
CommittedVersion
long? CommittedVersion { get; }
Committed version of the transaction (if a commit was successful)
Completed
bool Completed { get; }
If true, the transaction has completed (either Commit() completed successfully or Dispose was called)
Fields
FdbLoggedFields Fields { get; set; }
Logging options for this log
HasConflict
bool HasConflict { get; }
Sets to true if at least one attempt of the transaction fails to commit with NotCommitted
HasError
bool HasError { get; }
Sets to true if at least one command failed to execute
Id
int Id { get; set; }
Sequence ID of the logged transaction
This is a sequential counter of the transactions inside the current process
Use Uuid if you require a globally unique identifier
IsReadOnly
bool IsReadOnly { get; set; }
True if the transaction is Read Only
Operations
int Operations { get; }
Number of operations performed by the transaction
Origin
string Origin { get; set; }
Unique ID of the source of this transaction
This will be null for locally generated transaction.
ReadSize
long ReadSize { get; }
Read size of the last commit attempt
This value only account for read commands in the last attempt
Segments
List<int> Segments { get; }
List of the start of each segment in the log (attempt or retry).
Each entry in the list corresponds to the index of the first command for the corresponding segment
If the list is null (or empty), then the log contains only a single segment
For example, in a log with 20 commands and segments [0, 7, 15], then commands 0 to 6 belong to the first attempt, commands 7 to 14 belong to the second attempt, and commands 15 to 19 belong to the third and last attempt.
SessionId
string SessionId { get; set; }
Session ID of the logged transaction
If non-null, this is used to merge transaction logs produced by different "nodes" in the same "run", after the fact, in order to recreate a global timeline.
StartTimestamp
long StartTimestamp { get; }
Timestamp of the start of transaction
StartedUtc
DateTimeOffset StartedUtc { get; }
Timestamp (UTC) of the start of transaction
Step
int Step { get; }
Internal step counter of the transaction
This counter is used to detect sequential vs parallel commands
StopTimestamp
long? StopTimestamp { get; }
Timestamp of the end of transaction
StoppedUtc
DateTimeOffset? StoppedUtc { get; }
Timestamp (UTC) of the end of the transaction
TotalCommitSize
long? TotalCommitSize { get; }
Total of the commit size of all attempts performed by this transaction
This value include the size of all previous retry attempts
It will be null for transactions that are read-only, or did not attempt to commit
TotalDuration
TimeSpan TotalDuration { get; }
Total duration of the transaction (including all attempts)
If the transaction is still ongoing, returns the time elapsed since the start.
Uuid
Guid Uuid { get; set; }
Unique ID for this transaction
VersionStamp
VersionStamp? VersionStamp { get; }
Receives the actual value of the VersionStamps generated by this transaction
This value will be non-null only if the last attempt used VersionStampedKey or VersionStampedValue operations and committed successfully.
WriteSize
long WriteSize { get; }
Write size of the last commit attempt
This value only account for write commands in the last attempt
Methods
AddOperation
void AddOperation(Command cmd, bool countAsOperation = true)
Adds a new already completed command to the log
Annotate
void Annotate(string text)
Adds a debug annotation to the log
BeginOperation
void BeginOperation(Command cmd)
Starts tracking the execution of a new command
EndOperation
void EndOperation(Command cmd, Exception error = null)
Marks the end of the execution of a command
FromJson
static FdbTransactionLog FromJson(JsonObject obj)
GetCommandsReport
string GetCommandsReport(bool detailed = false, KeyResolver keyResolver = null)
Generate an ASCII report with all the commands that were executed by the transaction
GetTimingsReport
string GetTimingsReport(bool showCommands = false, KeyResolver keyResolver = null)
Generate a full ASCII report with the detailed timeline of all the commands that were executed by the transaction
ToJson
JsonObject ToJson(bool readOnly = true)