Esempio n. 1
0
        /// <summary>Called by MetricsRecordImpl.remove().</summary>
        /// <remarks>
        /// Called by MetricsRecordImpl.remove().  Removes all matching rows in
        /// the internal table of metric data.  A row matches if it has the same
        /// tag names and values as record, but it may also have additional
        /// tags.
        /// </remarks>
        protected internal virtual void Remove(MetricsRecordImpl record)
        {
            string recordName = record.GetRecordName();

            AbstractMetricsContext.TagMap    tagTable  = record.GetTagTable();
            AbstractMetricsContext.RecordMap recordMap = GetRecordMap(recordName);
            lock (recordMap)
            {
                IEnumerator <AbstractMetricsContext.TagMap> it = recordMap.Keys.GetEnumerator();
                while (it.HasNext())
                {
                    AbstractMetricsContext.TagMap rowTags = it.Next();
                    if (rowTags.ContainsAll(tagTable))
                    {
                        it.Remove();
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>Called by MetricsRecordImpl.update().</summary>
        /// <remarks>
        /// Called by MetricsRecordImpl.update().  Creates or updates a row in
        /// the internal table of metric data.
        /// </remarks>
        protected internal virtual void Update(MetricsRecordImpl record)
        {
            string recordName = record.GetRecordName();

            AbstractMetricsContext.TagMap     tagTable      = record.GetTagTable();
            IDictionary <string, MetricValue> metricUpdates = record.GetMetricTable();

            AbstractMetricsContext.RecordMap recordMap = GetRecordMap(recordName);
            lock (recordMap)
            {
                AbstractMetricsContext.MetricMap metricMap = recordMap[tagTable];
                if (metricMap == null)
                {
                    metricMap = new AbstractMetricsContext.MetricMap();
                    AbstractMetricsContext.TagMap tagMap = new AbstractMetricsContext.TagMap(tagTable
                                                                                             );
                    // clone tags
                    recordMap[tagMap] = metricMap;
                }
                ICollection <KeyValuePair <string, MetricValue> > entrySet = metricUpdates;
                foreach (KeyValuePair <string, MetricValue> entry in entrySet)
                {
                    string      metricName    = entry.Key;
                    MetricValue updateValue   = entry.Value;
                    Number      updateNumber  = updateValue.GetNumber();
                    Number      currentNumber = metricMap[metricName];
                    if (currentNumber == null || updateValue.IsAbsolute())
                    {
                        metricMap[metricName] = updateNumber;
                    }
                    else
                    {
                        Number newNumber = Sum(updateNumber, currentNumber);
                        metricMap[metricName] = newNumber;
                    }
                }
            }
        }
Esempio n. 3
0
 protected internal override void Remove(MetricsRecordImpl record)
 {
 }
Esempio n. 4
0
 protected internal override void Update(MetricsRecordImpl record)
 {
 }