예제 #1
0
 // Records stats with a set of tags.
 internal void Record(ITagContext tags, IList <IMeasurement> stats, ITimestamp timestamp)
 {
     lock (_lck) {
         foreach (var measurement in stats)
         {
             IMeasure measure = measurement.Measure;
             registeredMeasures.TryGetValue(measure.Name, out IMeasure value);
             if (!measure.Equals(value))
             {
                 // unregistered measures will be ignored.
                 continue;
             }
             IList <MutableViewData> views = mutableMap[measure.Name];
             foreach (MutableViewData view in views)
             {
                 measurement.Match <object>(
                     (arg) =>
                 {
                     view.Record(tags, arg.Value, timestamp);
                     return(null);
                 },
                     (arg) =>
                 {
                     view.Record(tags, arg.Value, timestamp);
                     return(null);
                 },
                     (arg) =>
                 {
                     throw new ArgumentException();
                 });
             }
         }
     }
 }