/// <summary> /// Initializes a new instance of the <see cref="GroupedMonitored{TKey, TElement}" /> class. /// </summary> /// <param name="group">The group.</param> /// <param name="name">The name.</param> /// <param name="order">The order.</param> /// <param name="surrogate">The surrogate.</param> /// <param name="keywords">The keywords.</param> public GroupedMonitored( IGroupedObservable <TKey, TElement> group, string name, double order, IMonitorSurrogate <TElement> surrogate, params string[] keywords) { _key = group.Key; _groupStream = group.Monitor(name, order, surrogate, keywords); }
/// <summary> /// Monitors many streams (like window). /// </summary> /// <typeparam name="T"></typeparam> /// <param name="instance">The instance.</param> /// <param name="name">The name.</param> /// <param name="orderingBaseIndex">Index of the ordering base.</param> /// <param name="surrogate">The surrogate.</param> /// <param name="keywords">The keywords.</param> /// <returns></returns> public static IObservable <IObservable <T> > MonitorMany <T>( this IObservable <IObservable <T> > instance, string name, double orderingBaseIndex, IMonitorSurrogate <T> surrogate, params string[] keywords) { int index = 0; var xs = from obs in instance let idx = Interlocked.Increment(ref index) select obs.Monitor(name + " " + idx, orderingBaseIndex + (idx / 100000.0), surrogate, keywords); return(xs); }
/// <summary> /// Monitor IObservable stream /// </summary> /// <typeparam name="T"></typeparam> /// <param name="instance">The instance.</param> /// <param name="name">The name.</param> /// <param name="orderingIndex">Index of the ordering.</param> /// <param name="surrogate">a surrogate.</param> /// <param name="keywords">The keywords.</param> /// <returns></returns> public static IObservable <T> Monitor <T>( this IObservable <T> instance, string name, double orderingIndex, IMonitorSurrogate <T> surrogate, params string[] keywords) { var monitor = new MonitorOperator <T>( name, orderingIndex, surrogate, keywords); var watcher = monitor.AttachTo(instance); return(watcher); }
public MonitorOperator( string name, double indexOrder, IMonitorSurrogate <T> surrogate, string[] keywords) { #region Validation if (keywords == null) { keywords = new string[0]; } if (keywords == null) { keywords = new string[0]; } if (surrogate == null) { surrogate = _defaultSurrogate; } #endregion Validation _name = name; _surrogate = surrogate; _keyworkds = keywords; _indexOrder = indexOrder; try { if (VisualRxSettings.CollectMachineInfo) { _machineName = Environment.MachineName; } } #region Exception Handling catch (Exception ex) { TraceSourceMonitorHelper.Warn("fail to collect machine information {0}", ex); } #endregion Exception Handling }
/// <summary> /// Monitor Group by stream /// </summary> /// <typeparam name="TKey">The type of the key.</typeparam> /// <typeparam name="TElement">The type of the element.</typeparam> /// <param name="instance">The instance.</param> /// <param name="name">The name.</param> /// <param name="orderingBaseIndex">Index of the ordering base.</param> /// <param name="elementSurrogate">The element surrogate.</param> /// <param name="keywords">The keywords.</param> /// <returns></returns> public static IObservable <IGroupedObservable <TKey, TElement> > MonitorGroup <TKey, TElement>( this IObservable <IGroupedObservable <TKey, TElement> > instance, string name, double orderingBaseIndex, IMonitorSurrogate <TElement> elementSurrogate, params string[] keywords) { var keySurrogate = new MonitorSurrogate <IGroupedObservable <TKey, TElement> >( (g, m) => "Key = " + g.Key); instance = instance.Monitor(name + " (keys)", orderingBaseIndex, keySurrogate, keywords); int index = 0; var xs = from g in instance let idx = Interlocked.Increment(ref index) let ord = orderingBaseIndex + (idx / 100000.0) select new GroupedMonitored <TKey, TElement>( g, $"{name}:{g.Key} ({idx})", ord, elementSurrogate, keywords); return(xs); }