private Transaction AddEvent(Transaction root, Even node) { if (root.Depth == 0) { root.NewEven(node); return root; } root.Evens.Peek().Depth += 1; var T = root.Evens.Peek().Transactions.Pop(); var newT = AddEvent(T, node); root.Evens.Peek().Transactions.Push(newT); return root; }
private Even AddTransction(Even root, Transaction node) { if (root.Depth == 0) { root.Transactions.Push(node); return root; } root.Transactions.Peek().Depth += 1; var even= root.Transactions.Peek().Evens.Pop(); var newEven = AddTransction(even, node); root.Transactions.Peek().Evens.Push(newEven); return root; }
/// <summary> /// 创建监测业务事务 /// </summary> /// <param name="type"></param> /// <param name="name"></param> public void NewTransaction(string type, string name) { var ctx = _manager.GetContext(); var t = new Transaction(type, name); var rootEven = new Even("root", "root"); if (ctx.Transaction != null) { rootEven.Depth = 10000; rootEven.Transactions.Push(ctx.Transaction); } var newEven = AddTransction(rootEven, t); ctx.Transaction = newEven.Transactions.Peek(); }
public void NewEven(Even e) { Evens.Push(e); }
/// <summary> /// 创建详细业务事件 /// </summary> /// <param name="name"></param> /// <param name="description"></param> public void LogEvent(string name, string description) { var ctx = _manager.GetContext(); var e = new Even(name, description); ctx.Transaction = AddEvent(ctx.Transaction, e); }