private void TruncateAndFlush(DefaultMessageManager manager, long timestamp) { IMessageTree tree = _mTree; Stack <ITransaction> stack = _mStack; IMessage message = tree.Message; if (message is DefaultTransaction) { if (tree.MessageId == null) { tree.MessageId = manager.NextMessageId(); } string rootId = tree.RootMessageId; string childId = manager.NextMessageId(); DefaultTransaction source = message as DefaultTransaction; DefaultTransaction target = new DefaultTransaction(source.Type, source.Name, manager); target.Timestamp = source.Timestamp; target.DurationInMicros = source.DurationInMicros; target.AddData(source.Data); target.Status = PureCatConstants.SUCCESS; MigrateMessage(manager, stack, source, target, 1); var list = stack.ToList(); for (int i = list.Count - 1; i >= 0; i--) { DefaultTransaction tran = list[i] as DefaultTransaction; tran.Timestamp = timestamp; tran.DurationInMicros = -1; } IEvent next = new DefaultEvent(PureCatConstants.TYPE_REMOTE_CALL, "Next"); next.AddData(childId); next.Status = PureCatConstants.SUCCESS; target.AddChild(next); IMessageTree t = tree.Copy(); t.Message = target; _mTree.MessageId = childId; _mTree.ParentMessageId = tree.MessageId; _mTree.RootMessageId = rootId ?? tree.MessageId; manager.Flush(t); } }
private void TruncateAndFlush(long timestamp) { var tree = _mTree; var stack = _mStack; var message = tree.Message; if (message is DefaultTransaction) { var id = tree.MessageId ?? _manager.NextMessageId(); var rootId = tree.RootMessageId; var childId = _manager.NextMessageId(); var source = message as DefaultTransaction; var target = new DefaultTransaction(source.Type, source.Name, _manager); target.Timestamp = source.Timestamp; target.DurationInMicros = source.DurationInMicros; target.AddData(source.Data); target.Status = PureCatConstants.SUCCESS; MigrateMessage(stack, source, target, 1); var list = stack.ToList(); for (var i = list.Count - 1; i >= 0; i--) { var tran = list[i] as DefaultTransaction; if (tran != null) { tran.Timestamp = timestamp; tran.DurationInMicros = -1; } } var next = new DefaultEvent(PureCatConstants.TYPE_REMOTE_CALL, "Next"); next.AddData(childId); next.Status = PureCatConstants.SUCCESS; target.AddChild(next); var t = tree.Copy(); t.Message = target; _mTree.MessageId = childId; _mTree.ParentMessageId = id; _mTree.RootMessageId = rootId ?? tree.MessageId; _manager.Flush(t); } }
/// <summary> /// 添加Event和Heartbeat /// </summary> /// <param name="manager"> </param> /// <param name="message"> </param> public void Add(DefaultMessageManager manager, IMessage message) { if ((_mStack.Count == 0)) { var tree = _mTree.Copy(); tree.MessageId = manager.NextMessageId(); tree.Message = message; manager.Flush(tree); } else { var entry = _mStack.Peek(); entry.AddChild(message); } }
private void TruncateAndFlush(DefaultMessageManager manager, long timestamp) { IMessageTree tree = _mTree; Stack<ITransaction> stack = _mStack; IMessage message = tree.Message; if (message is DefaultTransaction) { if (tree.MessageId == null) { tree.MessageId = manager.NextMessageId(); } string rootId = tree.RootMessageId; string childId = manager.NextMessageId(); DefaultTransaction source = message as DefaultTransaction; DefaultTransaction target = new DefaultTransaction(source.Type, source.Name, manager); target.Timestamp = source.Timestamp; target.DurationInMicros = source.DurationInMicros; target.AddData(source.Data); target.Status = PureCatConstants.SUCCESS; MigrateMessage(manager, stack, source, target, 1); var list = stack.ToList(); for (int i = list.Count - 1; i >= 0; i--) { DefaultTransaction tran = list[i] as DefaultTransaction; tran.Timestamp = timestamp; tran.DurationInMicros = -1; } IEvent next = new DefaultEvent(PureCatConstants.TYPE_REMOTE_CALL, "Next"); next.AddData(childId); next.Status = PureCatConstants.SUCCESS; target.AddChild(next); IMessageTree t = tree.Copy(); t.Message = target; _mTree.MessageId = childId; _mTree.ParentMessageId = tree.MessageId; _mTree.RootMessageId = rootId ?? tree.MessageId; manager.Flush(t); } }
/// <summary> /// 添加Event和Heartbeat /// </summary> /// <param name="manager"> </param> /// <param name="message"> </param> public void Add(DefaultMessageManager manager, IMessage message) { if ((_mStack.Count == 0)) { IMessageTree tree = _mTree.Copy(); tree.MessageId = manager.NextMessageId(); tree.Message = message; manager.Flush(tree); } else { ITransaction entry = _mStack.Peek(); entry.AddChild(message); } }